Update Post Survey Redirect URL through REST API

0

How do we update the Redirect URL on the “Thank You Page” using the REST API? Here is a very simple python script that creates a new Survey object and updates the Redirect URL. However when I take the survey or view it in the Dashboard the Redirect URL is not updated.

params = {'api_token': settings.SG_API_TOKEN, 'options[internal_title]': 'Test Internal Title', 'title': 'Test Title', 'type': 'survey'}
base_url = 'https://restapi.surveygizmo.com/v5/survey'
r = requests.put(base_url, data=params)
redirect_url = 'http://google.com'
params = {'api_token': settings.SG_API_TOKEN, 'properties[url]': redirect_url}
url = "{base_url}/{survey_id}/surveyquestion/{question_id}".format(base_url=base_url, survey_id=r.json()['data']['id'], question_id=1)
z = requests.post(url, data=params)

z.json()

{u’data’: {u’comment’: None, u’options’: [], u’description’: [], u’title’: {u’English’: u’Thank you for taking our survey. Your response is very important to us.’}, u’varname’: [], u’properties’: {u’url’: u’http://google.com’, u’map_key’: u’instructions’, u’hidden’: False}, u’has_showhide_deps’: None, u’base_type’: u’Decorative’, u’shortname’: None, u’type’: u’INSTRUCTIONS’, u’id’: 1}, u’result_ok’: True}

Lola Gill answered
    0
    Lola Gill 6.78K Rep.

    It looks like you should be able to use the SurveyQuestion Sub-Object to update the url redirect url:

    https://apihelp.surveygizmo.com/help/surveyquestion-sub-object-v5#updateobject

    You might consider creating a ‘question’ of type url as described in the create object call:

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

    This should allow you to create a new url redirect with the defined URL instead of utilizing the default post-survey action (unless you’ve already worked out the issue).

    Hope this helps a bit!

    Lola Gill answered
      ×

      Login

      Question stats

      • Active
      • Views516 times
      • Answers1 answer
      • Followers1 follower