Ask Your Question
1

Extract Predix Token

asked 2017-12-08 01:49:28 -0600

Gerhard Willemse gravatar image

updated 2017-12-08 10:50:14 -0600

metadaddy gravatar image

Please give me guidance on how to run curl extract in StreamSets if it is possible

I currently retrieve a daily token to authorize access to a Predix dataset with:

curl 'https://810be097-b1e3-4f9c-b0bb-0d18052080bf.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token' -H 'Pragma: no-cache' -H 'content-type: application/x-www-form-urlencoded' -H 'Cache-Control: no-cache' -H 'authorization: Basic bW9ybmVkZXZpbGxpZXJzX2FwcDoxMDgxME1vcm5lQCM=' --data 'client_id=secret_app&grant_type=client_credentials'
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-12-08 10:58:56 -0600

metadaddy gravatar image

There are a couple of options here.

  • If retrieving the token is an idempotent operation, that is, you can do it many times a day without a problem, configure an HTTP Client origin in your pipeline to get the token from that URL, with the relevant headers, and then an HTTP Client processor to actually use the token against the Predix API.
  • If you can only call the token API once a day, then you'll need to use something like the Dev Random origin to drive the pipeline, then a script evaluator (Groovy / JavaScript / Jython) with logic to persist the token to a file on disk, and only retrieve it from the API when necessary. You could possibly skip the disk storage and just keep it in the state variable if you envisage the pipeline running continuously, so your script would retrieve it on pipeline start, and then every day.
edit flag offensive delete link more

Comments

Thank you for your advise

Gerhard Willemse gravatar imageGerhard Willemse ( 2017-12-08 21:31:18 -0600 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2017-12-08 01:49:28 -0600

Seen: 13 times

Last updated: Dec 08 '17