Posting response via API gives error when using multiple choice

I am trying to post a response using the V3 endpoint: https://api.surveysparrow.com/v3/responses

This works fine if I am posting a text answer, but if my answer is a multiple choice type then i get the following error:

"message": "Invalid value passed or missing values in payload"

This is an example of my post body:

{
"survey_id": 424967,
"answers": [
{
"question_id": 7115241,
"answer": "Yes"
}
]
}

I cant see anything in the documentation that is marked as required that i am missing from my request or anything that indicates what should be different for non text questions.

Any ideas?

Hi Aaron,

We're glad to have you as part of our community! :wave:

Regarding your question, for the "answer" parameter, you'll need to provide the corresponding choice ID.

Let me know if it works!! :smiley:

Hi,

Thanks for the quick reply, unfortunately that doesnt seem to be working still, payload:

{
"survey_id": 4249456,
"answers": [
{
"question_id": 7115241,
"answer": 18245279
}
]
}

I have tried the ID as a string and as a number.

Thanks

Hi Aaron,

I apologize for not mentioning this earlier. It is necessary for us to pass the choice id in an array format. I have provided a snapshot below for your reference.

Let me know if you have any questions! :slightly_smiling_face:

Perfect! works now thank you :slight_smile:

Hello, I am receiving the same error as Aaron and have tried the following payload similar to what is listed in your screenshot with no luck. I am changing the survey id and question id and answer for this post by removing the las 3 digits.

{
"survey_id": "514",
"answers": [
{
"question_id": 9163,
"answer": [23729]
}
]
}

Hi Marsy,

Welcome aboard to the community! :smile:

Expect an email from us shortly requesting more details.