BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Mayt
Quartz | Level 8

Hi everyone

I've tried to use proc http to call intelligent decision api in sas studio but it I didn't got expected response as I got in postman. It showed 415 unsupported media type in log tab. Do yo guys know how to fix it? please let me know.

 

response in postman

Mayt_0-1690431657287.png

 

What I've tried; all I got was 415 unsupported media type

1.

filename rept temp;
proc http
	url = &url.
	out = rept
	method = "post"
	in = form  ("Fg_1m_6m_"="0"
			    "Fg_2m_6m_"="0"
			    "Wd_3m_"="0"
			    "AvgOut_3m_6m_"="0.25713"
				"Avgdr_9m_"="0.11111"
				"TermOverDueAR_"="0");
	headers 
    	"Authorization" = &token.;
run;

2.

filename rept temp;
proc http
	url = &url.
	out = rept
	method = "post"
	in='{"inputs":[{"name": "Fg_1m_6m_", "value": 0},{"name": "Fg_2m_6m_", "value": 0},{"name": "Wd_3m_", "value": 0},{"name": "AvgOut_3m_6m_", "value": 0.25713},{"name": "Avgdr_9m_", "value": 0.11111},{"name": "TermOverDueAR_", "value": 0}]}';
	headers 
    	"Authorization" = &token.;
run;

3.

filename rept temp;
proc http
	url = &url.
	out = rept
	method = "post"
	in= 'Fg_1m_6m_=0&Fg_2m_6m_=0&Wd_3m_=0&AvgOut_3m_6m_=0.25713&Avgdr_9m_=0.11111&TermOverDueAR_=0';
	headers 
    	"Authorization" = &token.;
run;

4.

filename json_in temp;
data _null_;
file json_in;
input;
put _infile_;
datalines;
	{"Fg_1m_6m_":0}
	{"Fg_2m_6m_":0}
	{"Wd_3m_":0}
	{"AvgOut_3m_6m_":0.25713}
	{Avgdr_9m_":0.11111}
	{"TermOverDueAR_":0}
	;
run;
filename rept temp;
proc http
	url = &url.
	out = rept
	method = "post"
	in =json_in;
	headers 
    	"Authorization" = &token.;
run;

5.

filename rept temp;
proc http
	url = &url.
	out = rept
	method = "post"
	in= 'Fg_1m_6m_=0&Fg_2m_6m_=0&Wd_3m_=0&AvgOut_3m_6m_=0.25713&Avgdr_9m_=0.11111&TermOverDueAR_=0';
	headers 
    	"Authorization" = &token.;
run;

6.

filename json_in TEMP;
data _null_;
file json_in;
put '{';
put '"name": "Fg_1m_6m_", "value": 0,';
put '"name": "Fg_2m_6m_", "value": 0,';
put '"name": "Wd_3m_", "value": 0,';
put '"name": "AvgOut_3m_6m_", "value": 0.25713,';
put '"name": "Avgdr_9m_", "value": 0.11111,';
put '"name": "TermOverDueAR_", "value": 0,';
put '}';
run;

filename resp TEMP;
proc http 
   METHOD="POST" 
   url=&url.
   in=json_in
   out=resp
   oauth_bearer = sas_services;
   headers 'Authorization'=  &token;
   run;
libname resp clear;
libname resp json;

7.

filename resp TEMP;
proc http METHOD="POST" 
   url=&url.
   in='{"name": "Fg_1m_6m_", "value": 0},{"name": "Fg_2m_6m_", "value": 0},{"name": "Wd_3m_", "value": 0},{"name": "AvgOut_3m_6m_", "value": 0.25713},{"name": "Avgdr_9m_", "value": 0.11111},{"name": "TermOverDueAR_", "value": 0}'
  out=resp
  oauth_bearer = sas_services;
   headers 'Authorization'=&token.;
   run;
libname resp clear;
libname resp json;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Of the examples you provided, #2 looks the closest/most correct. The PROC HTTP data should be the same JSON you supply in Postman. Also, be sure to add the CT= option for this call to tell the API what to expect:

 

'Content-Type': 'application/vnd.sas.microanalytic.module.step.input+json'

 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

Of the examples you provided, #2 looks the closest/most correct. The PROC HTTP data should be the same JSON you supply in Postman. Also, be sure to add the CT= option for this call to tell the API what to expect:

 

'Content-Type': 'application/vnd.sas.microanalytic.module.step.input+json'

 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Mayt
Quartz | Level 8
It worked!! Thank you very much.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 2025 views
  • 2 likes
  • 2 in conversation