How do I use API to add options to drop-down fields?

0

I’ve been trying to create an API that will add an option to a dropdown question. Right now, I have tried these two things:

https://restapi.surveygizmo.com/v5/survey/3655670/surveyquestion/57.xml?&_method=POST&options[10147]=NewOption&api_token12345…

https://restapi.surveygizmo.com/v5/survey/3655670/surveyquestion/57.xml?&_method=POST&options[10147]=NewOption&api_token12345…

The latter is listed in the API documentation as the proper way to do this, but it is not adding the option “NewOption” as I expected. Looking at the XML output, it adds an entry under varname, but I need it to create a new node under options. Otherwise, the provided option does not appear in the survey question. What am I doing wrong?

Community Admin answered
    0

    Hi Jake,

    Here is an example call to create an option in a dropdown menu:

    https://restapi.surveygizmo.com/v5/survey/1234567/surveyquestion/2/surveyoption?_method=PUT&title=new&value=new

     

    Your call looks like a post aka update to an existing option rather than a call to create a new option.

    Here is the documentation for creating a new option for your reference:

    https://apihelp.surveygizmo.com/help/surveyoption-sub-object-v5#createobject

    I hope this helps!

    Bri Hillmer
    Documentation Coordinator
    SurveyGizmo Customer Experience Team

    Community Admin answered
      ×

      Login

      Question stats

      • Active
      • Views1120 times
      • Answers1 answer
      • Followers1 follower