About Web Services
Sometimes you may want to include more complex features in your survey. Maybe you want to pull in the top 10 headlines from a news website into your survey, or you want to automate a second survey distribution to be emailed to the respondents of a first survey exactly two hours later. A Web Service would allow you to do just that by making requests to a designated URL.
Adding a Web Service
Our Web Service feature allows you to choose from a series of Methods to request information from your specified URL.
|GET||The Web Service goes to the URL and retrieves information.||Retrieve information about a member of your contact list. See the Get Contact API call for more details.|
|POST||Go to the URL and save information there.||Save a message to your library.|
|PUT||Update or replace existing information.||Change a username. This is one of the things you can do with the Update User call.|
|PATCH||Update or replace existing information. Very similar to PUT. While our Web Service offers this method, our API does not use PATCH calls.||Modify data saved on your server.|
|DELETE||Remove information.||Delete a graphic from your library.|
If you are using our API calls, the documentation will tell you which method to use, as indicated in the screenshot below.
There are currently three types of Parameters you can append to your request.
- Query parameter: Instead of adding a query string to the end of your Web Service URL, place your query parameters here.
- Body parameter: This parameter is not available for GET or DELETE requests. It comes with two formatting options:
a) application/x-www-form-urlencoded: Rather than entering your body parameters into the specified area of the Web Service, add them as a query string at the end of your specified URL.
b) application/json: Enter your keys in Dot Notation. For example, our API call may ask you to specify a header[fromEmail]. In Dot Notation, this becomes header.fromEmail.
- Custom header: Insert URL headers here.
If you’re using our API calls, the documentation will tell you what kind of parameters to include. The example below provides Body parameters to set.
Adding Parameters to Your Web Service
- Select any of the three Add a parameter to send to web service options indicated in the previous section. In the above example, we are indicating the Query Parameters.
- Type in the name of the parameter in the Parameter to Web Service box on the left.
- Type the corresponding value of the parameter in the Value box on the right.
- Click the plus (+) sign to the right of the parameter to add another.
- Click Save Flow when finished.
Testing Your Parameters
Once you have pasted in your URL and set up your parameters, you can test your URL to see what Fields you can pull in.
- Click Test URL to see which information you can pull from the external Web Service.
- Select any fields that you want to use or record in your survey. The Field Name appears on the left and a corresponding Example Value appears on the right.
- Click Add Embedded Data to add selected fields to your data.
Qtip: You can change the Embedded Data names associated with the fields of your Web Service under the Set Embedded Data column. The Embedded Data names are to the left of the equals (=) sign, indicated by a green ED icon. The right side should not be altered. The names you set on the left will be the names of the fields as they appear in your data.
- If you select Fire and Forget, you will not save any of the data returned from the web service call. This feature is useful when you do not need to save the returned data.
Qtip: Fire and Forget allows your survey to make a request to a Web Service without waiting for a response. This means that your respondents will be able to complete the full survey without any delay due to the Web Service. You may want to use this option if you have a Web Service request that takes a while to process, but we would recommend that you only use this feature during testing, since it will prevent Embedded Data from saving.
- When you’re done, click Save Flow.
Random Number Generator
Back when Qualtrics was first getting started, we encouraged users to use a Web Service calling a random number generator to create IDs for survey respondents. However, based on feedback, we found that this process can be long, difficult, and painful.
There are now much easier ways to generate random numbers for your respondents using Piped Text. For even more support setting up your randomized IDs and displaying them to respondents, see the Assigning Random IDs to Respondents page.