Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
JHayes1633008804
Contributor
Contributor

Check for null response from API

I would like to be able to check the response of an API call and document that the result was null

I currently have a job that reads a series of API parameters from a database and does separate API calls for each set. Most of them work but if there is no data for that day from the vendor the API just returns a null which causes an error in the translation. I would like to be able to make a condition that would read before the error and allow me to write into a separate DB table that it came back with no results and return to the calling process for the next set.

I currently have a tDBInput --> tFlowTolerate --> tRunJob that calls the API process tRestClient --> tExtractJsonFields --> tdbOutput which runs but I do get an error when trying to translate the API calls that return nulls.

Thank you for any help

Labels (3)
1 Reply
Anonymous
Not applicable

Hi

Which step throws the error? tDBOutput? If so, you can change the child job as below:

tRestClient --> tExtractJsonFields --> tJavaFelx--tHashOutput1(cache the records into memory)

--runIf--tHashInput1--main-->tdbOutput

 

on tJavaFlex:

begin part:

int counter=0;

 

main part:

counter++;

end part:

globalMap.put("keyName",counter);

 

set the condition of runIf as:

(Integer)globalMap.get("keyName")>0

 

in this job, use a runIf connector to trigger next process based on the condition.

 

Regards

Shong