Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi All,
I need to use a web service that needs authorization and consumes a token for it.
I know that I need to use some of the snippets function (ContentLoaderFunctions),
but I need someone to provide me some kind of example 'cause none of them has a field that uses my token.
Thanks,
Anselmo.
Solved! Go to Solution.
Looks like we cant use a webservice that consumes a token...
And that's the answer.
You will most likely need to declare that token through the header.
Something like "token:laksjdflksdajfladsjfjdsk"
Something like this?
var token = {token:"abcdef"};
var params = {
headers: token /* JSON */,
ignoreSSLErrors: true /* BOOLEAN */,
url: "http://mymachine:8080/myapi" /* STRING */,
timeout: 30 /* NUMBER */,
};
Well, it didnt work out.
See the error mesage below:
Error executing service MyService. Message :: Connect to 192.168.229.139:8080 [/192.168.229.139] failed: connect timed out - See Script Error Log for more details.
Nobody?
Hello?
When you tried that call what was the response? Check application log.
Can you list the actual documentation of the API call?
The only response I received was this error mesage:
Error executing service MyService. Message :: Connect to 192.168.229.139:8080 [/192.168.229.139] failed: connect timed out - See Script Error Log for more details.
Documentation (my command is described in the page 26):
http://help.geautomation.com/Historian55/Subsystems/iHistGS/content/restapi.pdf
The Manual you linked states the following example:
curl -i -H "Accept: application/json" -H "Authorization: Bearer <TOKEN>” https://<nodename>:8443/
SAMPLE cURL COMMAND:historian-rest-api/v1/tags?nameMask=*&maxNumber=<Number_Of_Tags>
That seems to say that you can define it in the header not as token: token value but looks like
Authorization: Bearer tokenValue
Looks like we cant use a webservice that consumes a token...
And that's the answer.