How To Send a Request to an External Webservice using SurveyToGo


SurveyToGo allows you to send an asynchronous web service request directly from your survey scripts.

The SurveyToGo WebService functions:

The SurveyToGo user logic has two asynchronous functions dedicated for sending a request to a webservice:

1. Post request: string WebServicePost(string inUrl, string inData)

inUrl: The URL to send the post request to.

inData: The Data to post.

2. Get request:  string WebServiceGet(string inUrl)

inUrl: The URL to send the get request to.

Getting the webservice response:

Since the functions are asynchronous you will no get the response from the server immediately when calling the function.

In order to get the response from the webservice you will have to add the OnWebServiceResult overload to the surveys advanced script.

In Addition the SurveyToGo user logic has a function to parse the response from the WebServicePost/ WebServiceGet functions into an object, assuming that the answer from the webservice is in a legal Json format:

Object ParseJson(string JsonString);

An example of an overload to the OnWebServiceResult callback with a call to the ParseJson function which will set the response value to a global variable:

function OnWebServiceResult(inTicket, inOriginalUrl, inXMLResult, inIsError, inHttpStatus, inContentType)
Vars["response"] = ParseJson(inXMLResult);


Please Note:
On Android please make sure that you do not have any spaces included in the URL, to overcome you can use one of the following options:
1. Add %20 instead of the spaces 
2. use a JavaScript function to do it, for example: 

encodeURI("Thanks for being a part of the survey")


That’s it!

Visit us at:



Was this article helpful?
0 out of 1 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.