[Solved] Determine Status Of A Survey Link

0

Hi there,

Is there a way for me to check (through PHP code) the status of a SurveyGizmo link?

For example, if the link is “sgizmo.com/i21412/523-0” – if I grab the HTML results of that page, is there a unique identifier in there that will tell me that this link is either
“Complete” / “Disqualified”?

 

Shopper Army asked

    Best answer

    0

    Hello Shopper Army!

    While it may be possible to manually fetch the HTML contents of the page that a specific unique survey link generates, and parse/munge that HTML markup to try and determine the status of that response, you will be far better off accessing this information via SurveyGizmo’s REST API.

    The unique link you’ve used as an example looks very much like the unique links that our Email Campaign feature generates, so I’ll use that as an example. Part of the unique link will be a contact ID (this will be appended as the “sguid” variable). You may use this contact ID in a filter string to fetch that specific survey response, when calling the “GET LIST” method of the SurveyResponse object:

    http://apihelp.surveygizmo.com/help/article/link/surveyresponse-sub-object#getlist

    http://apihelp.surveygizmo.com/help/article/link/filters

    An example URI for requesting a specific contact ID’s response could be like so:

    https://restapi.surveygizmo.com/v4/survey/SURVEY_ID_HERE/surveyresponse?api_token=API_TOKEN_HERE&filter[field][0]=contact_id&filter[operator][0]==&filter[value][0]=CONTACT_ID_HERE

    I recommend using a library to make the API request from PHP, such as Ryan McCue’s aptly-named “Requests for PHP” library.

    Once you have received the response, you can access the “status” property of the first item in the “data” section, to see the status of that response. Use var_dump if you’re unsure what I mean by that, or if you seem to be getting an invalid response.

    I hope this helps!

    Nathan - Survey Astronaut answered
      ×

      Login

      Question stats

      • Active
      • Views331 times
      • Answers1 answer
      • Followers0 followers