HTTP Function

🔌 What is an HTTP Function ?

The Http security function enables you to easily extend ngSurvey with your own remote HTTP REST based functions.

Using the HTTP security function you can setup a custom user interface to gather data from respondent before the survey is shown, send that data to a specific HTTP REST based endpoint as simple JSON object, do any kind of business logic you need with the data and return a new JSON object from your HTTP endpoint that will be stored along the respondent answers and that can be used anywhere in the survey using ngSurvey piping features.

☁️ What is sent and received ?

The object sent that will be sent to your HTTP endpoint by ngSurvey is a simple JSON formatted object as follow

{
 properynamefromyouruserinterface1 : 'value', 
 properynamefromyouruserinterface2 : 'value'
}

Along with the user interface values entered by the respondent ngSurvey also sends following extra properties to the endpoint :

{
 ngsSurveyId : 'abcd' // ID of the survey, 
 ngsRemoteip : '127.0.0.1' // IP of the respondent
}

Object returned by the HTTP endpoint must be formatted as a JSON object structure as shown below, you can send back any number of properties you want.

{
yourproperty1:'value', 
yourproperty2:'value'
}

🧙 Values returned from your HTTP endpoint can be piped anywhere in your survey question texts or answers using following pipe format __yourproperty1__

🔅 HTTP Function properties

  • Http endpoint URL must be the http url that will receive the data entered in the user interface. ngSurvey sends the data either as a JSON object if set to post or as key / values that are added to the endpoint url.

  • Transfer query values if enabled ngSurvey will forward all querystring key/values that have been setup on the survey URL.

  • Call on load Http function will immediately be called once the security item is loaded without showing the user interface. This can be useful if you want to use the endpoint using querystring parameters without asking any information using the user interface.

  • Secured let you setup a JWT token that will be used to authorize the http endpoint.

  • Unique value property name is the property name from the object that is return by the Http endpoint that will be used as "primary key" to uniquely identify the returned data. This unique key will be used to forbid duplicate entries and to enable save/resume features if the Http security function security item is set as a key provider..

  • Loading Small message that will be showing during the call on load.

  • Introduction message Small message that will be shown above the user interface.

Last updated

(c) 2024 Data Illusion Zumbrunn. All rights reserved. Reproduction strictly forbidden.