Hello,
I have a question/problem regarding cURL.
I have SAS job on a remote server, that I can successfully run using PROC HTTP:
filename out1 temp;
proc http
url='https://myserver.net/SASJobExecution/?_program=/Public/code/model/score'
out=out1
OAUTH_BEARER="&ACCESS_TOKEN."
method="GET";
run;
As a response I get the HTML results back in out1 (as expected and required).
Note:The macro variable &ACCESS_TOKEN. has been set before successfully already.
Then I tried to run the same call using cURL (on Windows) with the following command:
curl -X GET "https://myserver.net/SASJobExecution/?_program=/Public/code/model/score" -H "Authorization: Bearer %ACCESS_TOKEN%"
Again %ACCESS_TOKEN% has been assigned previously already.
The server also executes the job successfully - I can see and check the results directly on server myserver.net.
But - if the execution of the job was successfully - the curl command does not return me the response.
Only if the job fails (e. g. due to a syntax error), then the curl command returns me the response to the console (stdout).
Can someone help me:
Do I have to specify a special cURL option to get back the HTML output of the executed SAS job?
Thank you in advance!
Best regards,
Helmut
Hi,
Adding curl option -L to the call solves the issue:
curl -X GET "https://myserver.net/SASJobExecution/?_program=/Public/code/model/score" -H "Authorization: Bearer %ACCESS_TOKEN%" -L
Best regards,
H.
You may have more success asking this in a curl-related place, like the curl users mailing list:
Hi again,
I meanwhile do not think that my problem is related to curl (in Windows).
I am able to send curl requests to a couple of servers using Window curl successfully and I always get a response.
But when sending my request to the SAS server, I get only response in case of an error (as described in my original post).
If the SAS job has been executed successfully, then I receive no output in curl... 😞
Any ideas why this is the case...?
Thanks,
Helmut
Hi,
Adding curl option -L to the call solves the issue:
curl -X GET "https://myserver.net/SASJobExecution/?_program=/Public/code/model/score" -H "Authorization: Bearer %ACCESS_TOKEN%" -L
Best regards,
H.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.