REST beginner question - what's going wrong with these input parameters?
Question

I have a working app with several working REST API calls. And when I test this POST call, it works fine. But when I pass input parameters to the body, it breaks. I have attached the debug of my request and also the sample body for this request. I have verified I'm using a good Device ID. This is a webex API method I'm consuming.


Any advice is appreciated.

Solution

Hey @Jason Brown 

I thing the input which you pass in request is not matching with the attribute in request data type.
Could you please confirm it whether it is matching or not.

Thanks

Yogesh

You are not specifying how does it break, so there's options. 

There are two differences in the screenshots you provided, and both can cause misbehaviour depending on how receiving end is handling things:

  • Passphrases are different in those provided examples - is it purposeful or is this why your call fails?
  • Role names: Does it make a difference if role name is "Integrator" (in your serialized JSON example) vs "Integrate" (in debug screenshot)?

I'd start by checking those two, and then checking how the structure is serialized and what is actually sent in the call using debugger (preferably at OnBeforeRequest event).

What do you mean by it breaks. What error you are getting in this API call.

Hi Jason,

Could you please provide more information about the error message and HTTP Status Code?

Could you check your request data structure if Name in JSON is properly set. Especially for deviceId and arguments list ?

Solution

Hey @Jason Brown 

I thing the input which you pass in request is not matching with the attribute in request data type.
Could you please confirm it whether it is matching or not.

Thanks

Yogesh

You are not specifying how does it break, so there's options. 

There are two differences in the screenshots you provided, and both can cause misbehaviour depending on how receiving end is handling things:

  • Passphrases are different in those provided examples - is it purposeful or is this why your call fails?
  • Role names: Does it make a difference if role name is "Integrator" (in your serialized JSON example) vs "Integrate" (in debug screenshot)?

I'd start by checking those two, and then checking how the structure is serialized and what is actually sent in the call using debugger (preferably at OnBeforeRequest event).

@Mikko Nieminen the issue was that, as you pointed out, one of the role names was misspelled. I can't believe I miassed that. The application stores the role names in an entity. And it was just a typo.

It was a 400 Bad Request. I was assuming it was malformed rather than something wrong inthe request details. Thanks very much for the extra eyes on this. As I said, I'm new to REST services and still learning every day.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.