cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2126
Views
20
Helpful
9
Replies

Call Studio REST Element POST request

jc12
Beginner
Beginner

I'm new to working with the CVP Rest Element within Call Studio and I'm trying to figure out what is wrong with my POST request.  Just for reference what I am trying to accomplish is to offload some of our IVR customer to SMS chat if they chose to do so.

 

I have downloaded Postman and create a response with OAuth1.0 credentials and all the tokens / keys provided by the vendor and it is successful, however when I build my app and test I keep getting a 401 error;

         r_APIcall1,custom,response,{"error":"No Authorization Header"}

 

Maybe I am putting the authentication in the wrong place within the REST element but I'm not exactly sure.

I have the app key, secret, access token, access token secret, and signature method all as name/value pairs configured as parameters which didn't seem to work so I tried putting them in the header and that still returned the same error.

 

I have Require HTTP authentication set to false.  Maybe that should be set to true and the username / password is one of my parameter settings?  

 

The request body is in JSON format if that matters.  Right now I'm just trying to get the authentication straight.  Does anyone have an example POST request using OAuth1.0?

1 Accepted Solution

Accepted Solutions

jc12
Beginner
Beginner

Just to close the loop on the authentication piece on the OAuth 1.0 authentication you need to have "Authorization" as the key and the value will look like below;

 

OAuth oauth_consumer_key="<key>",oauth_token="<token>",oauth_signature_method="HMAC-SHA1",oauth_timestamp="<timestamp>",oauth_nonce="<nonce>",oauth_version="1.0",oauth_signature="<signature>"

 

After putting in the information I was provided I was able to authenticate.

View solution in original post

9 Replies 9

Gerry O'Rourke
Rising star
Rising star

If you could post a screen shot of your working Postman request (black out any sensitive data) and a screen shot of your current CVP Call Studio REST Element config for comparison - it would likely help see where your issue might be.

 

Regards,

Gerry

 

I attached them.

 

For the rest element under parameters I have just 1 parameter

Content-Type=application/json

 

Headers 

Signature Method=""

Consumer Key=""

Consumer Secret=""

Access Token=""

Token Secret=""

siteID=""

 

After taking a screen shot of the postman API call I looked around a bit more.  There is an authorization section where I enter all my data, which is where i came up with the authentication names but maybe that is the issue.  I can see that the authorization data is actually added as a header with the key named: Authorization and the values are; 

OAuth oauth_consumer_key="",

           oauth_token="",

           oauth_signature_method="",

           oauth_timestamp="",

           oauth_nonce="",

           oauth_version="1.0",

           oauth_signature=""

 

Maybe that is part of the issue...

Anyone know of a good post example using OAuth 1.0 authentication?

" For the rest element under parameters I have just 1 parameter

Content-Type=application/json"

 

This could not be correct. Content-Type is a Header and not a parameter.

Can you show a screen shot of your headers in Postman and the authentication configuration?

Can you show a screen shot of the Call Studio  with the Header and Parameter detail expanded - shown?

Black out any sensitive data - but leave as much not blacked out as you can.

 

Gerry

 

Header Key in postman is "Authorization"

The value is;

OAuth oauth_consumer_key="<key>",oauth_token="<token>",oauth_signature_method="HMAC-SHA1",oauth_timestamp="<timestamp>",oauth_nonce="<nonce>",oauth_version="1.0",oauth_signature="<signature>"

 

Sensitive data removed.

 

In the screen shot you see for the headers I have Authentication in place of App Key, which was there earlier, I'm going to try to just use Authentication as the header then past the string above with credentials in the value.

Tried it and received 400 error and it is saying there is no site id present in the request body but I have it listed.  Format for my request body is below;

 

{
"siteId":"",
"skill":"",
"customerCountryCode":"1",
"customerPhoneNumber":"",
"beginTimeStamp":"Data.Session.datetime",
"dialedPhoneNumber":"",
"dialedCountryCode":""
}

Hi jc12,

How did you resolve this error related to siteId not present in request body? I am also getting this now.

Can you please share screenshot of your REST element and expand Parameters, Headers and Body sections of it ?

 

Thanks.

jc12
Beginner
Beginner

Just to close the loop on the authentication piece on the OAuth 1.0 authentication you need to have "Authorization" as the key and the value will look like below;

 

OAuth oauth_consumer_key="<key>",oauth_token="<token>",oauth_signature_method="HMAC-SHA1",oauth_timestamp="<timestamp>",oauth_nonce="<nonce>",oauth_version="1.0",oauth_signature="<signature>"

 

After putting in the information I was provided I was able to authenticate.

Hi jc12,

Can you please explain more about how did you use credential parameters and how did you generate OAuth authentication header to be used with your POST request ?

 

Thanks.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: