BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
H-elmu-t
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
H-elmu-t
Obsidian | Level 7

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.

View solution in original post

4 REPLIES 4
H-elmu-t
Obsidian | Level 7
Thanks for the hint!
H-elmu-t
Obsidian | Level 7

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

H-elmu-t
Obsidian | Level 7

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 8105 views
  • 0 likes
  • 2 in conversation