10-01-2020 11:18 PM
has anyone got any any experience with JSON and make rest API step. is it possible to make a REST API call to webex which uses Oauth access token , i thought to pass the token in the header but it is not letting me leave the user id and password field blank, throws an error "Unable to parse expression, no formula entered".
Also am not sure how to pass the body, what i did is , i uploaded a text document like below in the repository
{
"title": "Project Unicorn - Sprint 0",
}
after this i executed a CREATe JSON step to convert this doc to JSON
then i used GET JSON step with JSON path as : "$.title" , not sure if it is correct
in the scripting guide it says that "Result data" should be a document variable, but body in the make REST call step has to be a string, do i need to convert the document to a string some way and how can i take care of the authentication when i have a token
10-02-2020 07:39 AM
You can just put empty quotes for user/pass like this ""
For the body, leave it a string like this
u"{\"title\": \"Project Unicorn - Sprint 0\",}"
10-02-2020 12:41 PM
is u in the beginning a typo or it is needed and do we need a , at the end, before the curly bracket?
Thanks.
10-02-2020 12:44 PM
without u it gives me an error so i will take 'u' in the beginning for an answer..
10-02-2020 01:03 PM
getting this error in the status
"Client response status: 412"
does it mean that access to the target resource has been denied.
10-05-2020 08:28 AM
I'm not sure what is causing the 412, but I just tried it myself and it worked.
Variables
new String[] { // HTTP Request Section // Index 0 - Request URL "https://webexapis.com/v1/rooms", // Index 1 - Basic Auth Username "", // Index 2 - Basic Auth Password "", // Index 3 - Content-Type Header "application/json", // Index 4 - Authorization Header "Bearer ZmMxY2U0ZGMtZTA5NC00NmZiLThkZTItNTQ****", // Index 5 - Body Payload for POST/PUT Requests u"{\"title\": \"Project Unicorn - Sprint 0\"}", // HTTP Response Section // Index 6 - Response Body "", // Index 7 - Status Code "", // Index 8 - Status Detail "" }
Script Steps
Properties of Make REST Call step
10-05-2020 07:28 AM
Yes, the u prefix is important.
No, the comma is optional. I just copied and pasted what you shared, which had the comma. This works too:
u"{\"title\": \"Project Unicorn - Sprint 0\"}"
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide