Hi all,
I am running into issues understanding how I should use “Make an API call”.
As an example, I am going to share an API call that I am trying to make to update a contact in SurveySparrow. (see screenshot attached)
Also, this is the link to their API documentation for “Update Contact”: SurveySparrow APIs | Connect and REST assured
In my eyes, I am following the steps correctly, however, I still get the “The operation failed with an error. [400] Invalid request payload JSON format” error.
Can anyone tell me where am I making a mistake with this?
Looks like you are missing a forward slash /
at the start of your URL.
Read the description below for an example.
3 Likes
@Mehran_Zafar nice to meet you.
You don’t have the slash before v3.
Don’t hesitate to contact us if you require further assistance.
//VLAD
Unfortunately, when I add the slash the issue doesn’t go away.
So I am guessing this is not what causes the error.
You cannot use the field “Query String” for this.
You need to send your data in the BODY field, as “application/json”.
e.g.:
{
full_name: "Jane Doe",
email: "janedoe@surveysparrow.com",
phone: "91234567833",
mobile: "1653452783",
job_title: "Manager"
}
Click on the “Try” button for an example:
2 Likes
Before writing the post I also tried with the body.
It returns an error either way.
This is frustrating. Because if I try to get the same user with API everything works fine. But when trying to update I can’t seem to make it work.
Ah, in JSON, the KEYS also need to be double-quoted.
{
"full_name": "Jane Doe",
"email": "janedoe@surveysparrow.com",
"phone": "91234567833",
"mobile": "1653452783",
"job_title": "Manager"
}
You can check the validity of JSON by using this website https://jsonformatter.org, if it doesn’t format, it’s invalid.
3 Likes