HTTP GET - how to?


(Danny Ryan) #1

Hi Team,

I am looking to create a plan that will receive in customer first names, and pass the value over HTTP GET. Genderize API will then return Gender of the name and the probability of the gender being true.

This may be helpful to others trying to do the same,so thought id would share the name of the API.

Using the genderize.io API, which is free for 1000 names/day.

Id like to pass the url of https://api.genderize.io/?name=daniel
and return the JSON value of {“name”:“daniel”,“gender”:“male”,“probability”:1,“count”:8180}

I am thinking the correct component to use is the “JSON Call” one, but seem to confusing myself on the data stream/general tab.

Any recommendations or advise you can offer would be gratefully appreciated.

Many thanks
Danny.


(Artem Setkin) #2

Hello Danny,

Apologies for not replying sooner.
Using JSON Call is the correct way here.
You can get more detailed info regarding data streams in built-in help in Ataccama DQC.
Here is the way how to configure it for the given example. Please notice, Path field in Data Streams configuration window is using JSONPath query language.

Kind regards,
Artem


#3

Hello,

I am trying to learn/test the JSON call component in Ataccama DQC 10.4 leveraging the example above.
However, the output is not being written to the file. The Plan I am using is attached. Not sure what I am missing to make this JSON call to write to a file. Any recommendations or advise you can offer would be gratefully appreciated.

Regards
Satya
JSON-Test.plan (4.2 KB)


(Damyan Malinov) #4

Hi Artem,

Instead of ?name=vlad in the url can you show a way how to use parameter instead? I mean an actual column in the plan that has different names - so we have different urls for each row passing through the json call step.

Thanks,
Damyan


(Evgeni Enchev) #5

Hello Damyan,

You can use DQC expressions and variables in the URL parameter of the JSON call step. First, you’d need to declare the signs indicating the beginning and the end of the expression, like this:


By default they are both %, so any code to be evaluated needs to be nested inside %% block.
Then, modify the URL parameter in the step accordingly, e.g if the name in each row is in variable “name”, your URL suffix would become: ?name=%name%

Regards,
Evgeni


(Damyan Malinov) #6

Thanks for the help Evgeni and detailed explanation.