Skip to main content

I am currently adding integrations for different typeform events (triggers & actions) to our platform. I am unable to find the correct API syntax for the event - “Update Dropdown, Multiple Choice or Ranking Question Options

 

I am trying to update the options of a multi-choice question via API. Here is the Api details and error message i am getting:

 

API Endpoint - https://api.typeform.com/forms/:formId

Method - PATCH

 

Body used - 

g
{
"op": "replace",
"path": "/fields",
"value":
{
"id": "Multichoice_Question/Field_id",
"properties":{
"choices":
{ "label": "Red" },
{ "label": "Green" },
{ "label": "Blue" }
]
}
}
]
}
]

 

error message - 

{
"code": "VALIDATION_ERROR",
"description": "The payload is invalid.",
"details":
{
"code": "NOT_ALLOWED_VALUE",
"description": "should be equal to one of the allowed values",
"field": "/0/path",
"in": "body"
}
]
}

 

How should the body be defined for this API?
I can see that api doc defines certain fixed values which "path" can take. But then how are we supposed to update a multi-choice questions' options using this API?

Hi @nikko Happy Tuesday!

@picsoung or @mathio do either of you happen to know the answer to this? 


Hello @nikko 

I dont think you can update a field via PATCH endpoint. You will need to use PUT endpoint instead. You will need to GET full form definition, and then send it to the PUT endpoint with changed values.


Just confirming what @mathio mentioned.

The PATCH endpoint can only modify form settings.
If you want to modify anything about the form, you must manipulate the whole definition.

First, by getting the latest version calling GET /forms/{form_id} doc
You can get the JSON and then do the modification you want.
Once you are ready, push it back to Typeform by calling PUT /forms/{form_id} doc

You can update the form as many times as you want. Consider a list of choices, like classes or availability from another system. Or if you want to remove the choice after it has been selected X many times.


Hello everyone!

Thankyou for your quick replies. Will try it out.

Thanks again! 😊 

 


Let us know how it went, @nikko !


TBH you have one of the worst REST APIs I have to work with.
Developers hate you, any tech-savvy people hate you.

This feature is asked for years, how the heck can’t you provide a “form field” API so we can update multichoice questions options in 1 single HTTP call ?

 

You cost me an full time day of work to allow my team trigger the update of a single field.
A day.


Hi ​@article1data Thanks for stopping by and sharing this. I can certainly pass along this request to our product team!


Reply