Back
Online

External real-time information integrated into online surveys

25 March 2019

If you want to conduct an online survey that refers to frequently changing information, or needs to extract relevant information from a large database, you’ll need to connect your survey to an external source via an API. This is easily achievable with Nfield Online.

There is a wide range of scenarios which might call for this. To give just a few examples, you might want to show:

Or you might need to utilize real-time information to route your survey according to current stock status.

How to connect to your external source

The connection to your external source consists of one or two components:

  1. a URL (always necessary) and
  2. parameters (optional)

To illustrate how it works, let’s take a look at the Cryptocurrency demo we’ve set up. This demo survey connects to https://cex.io/api/tickers/USD/EUR to retrieve the latest cryptocurrency prices. As you can see, this URL takes you some JSON code. Copying this code into a JSON editor will present it as shown in the illustration below. Note that Nfield will only load the content from the “data” section and will ignore other information.

Step 1 is therefore to identify the URL to connect to your survey. However, every survey has its own unique requirements and ready-made API URLs are rarely available. Your IT team will actually need to create the URL(s) that return the relevant JSON format data results. Of course, NIPO can provide any support you need for doing this.

Step 2 is to set this up in Nfield Online. Under Survey Default Settings, simply add the URL as an API end point and give it a name. Doing this tells Nfield that calling “CryptoCurrency” from the survey script refers to a call to this particular URL.

Step 3 is to call the API from your survey setup.

The call status is stored in “result” and the answers are stored in the arrays of var1 and var2. In our example var1 is filled with the ‘pair’ info and var2 with ‘ask’ (asking price) information, so our *GETDATA command looks like this:

*GETDATA result pair,ask "CryptoCurrency:"

Note that our demo example doesn’t utilize the second component option for parameters.

Always here to help

We hope this article inspires you to explore the possibilities opened up by the use of API endpoints. If you have any questions or require any assistance, please feel free to contact us.

Get a first impression, scheduled soon.

Get a first impression, scheduled soon.

Request a demo to see how NIPO can help you meet your requirements with our smart survey solutions.