Questionnaires

Retrieve a questionnaire link

Each questionnaire link points to a specific rendered questionnaire. The link will expire after a set amount of time.

Parameters

Body

Content-Type Type
application/json QuestionnaireLinkRequest
{ "type": "sales", "questionnaireTemplate": { "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f" }, "customer": { "id": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "mobile": 49123456789, "address": "Anystr. 17, 12345" }, "channel": { "id": "example_unique_identifier", "type": "user_defined" }, "transaction": { "reference": "order-12345", "date": "2017-01-01T13:30:15Z" }, "products": [ { "gtin": "1234567890123", "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg", "name": "Specialbrand T-Shirt White M", "mpn": "23687778", "sku": "1234-TS-WH-M", "brand": "specialbrand", "url": "https://www.specialbrandshop.com/article123-TS-WH-M/" } ], "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "system": "customer_system_name", "systemVersion": "1.0" }

Responses

200 - OK

Name Description
application/json QuestionnaireLinkResponse

400 - Bad Request

No body is sent for this status code.

401 - Unauthorized

No body is sent for this status code.

403 - Forbidden

No body is sent for this status code.
POST
https://api.etrusted.com/questionnaire-links
//#region Parameters const baseUrl = 'https://api.etrusted.com'; const body = { "type": "sales", "questionnaireTemplate": { "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f" }, "customer": { "id": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "mobile": 49123456789, "address": "Anystr. 17, 12345" }, "channel": { "id": "example_unique_identifier", "type": "user_defined" }, "transaction": { "reference": "order-12345", "date": "2017-01-01T13:30:15Z" }, "products": [ { "gtin": "1234567890123", "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg", "name": "Specialbrand T-Shirt White M", "mpn": "23687778", "sku": "1234-TS-WH-M", "brand": "specialbrand", "url": "https://www.specialbrandshop.com/article123-TS-WH-M/" } ], "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "system": "customer_system_name", "systemVersion": "1.0" }; //#endregion let url = `${baseUrl}/questionnaire-links`; const xhr = new XMLHttpRequest(); xhr.open('POST', url, true); xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { console.log(xhr.responseText); } }; xhr.send(body || undefined);
const https = require('https'); //#region Parameters const baseUrl = 'https://api.etrusted.com'; const body = { "type": "sales", "questionnaireTemplate": { "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f" }, "customer": { "id": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "mobile": 49123456789, "address": "Anystr. 17, 12345" }, "channel": { "id": "example_unique_identifier", "type": "user_defined" }, "transaction": { "reference": "order-12345", "date": "2017-01-01T13:30:15Z" }, "products": [ { "gtin": "1234567890123", "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg", "name": "Specialbrand T-Shirt White M", "mpn": "23687778", "sku": "1234-TS-WH-M", "brand": "specialbrand", "url": "https://www.specialbrandshop.com/article123-TS-WH-M/" } ], "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "system": "customer_system_name", "systemVersion": "1.0" }; //#endregion let urlAsString = `${baseUrl}/questionnaire-links`; const queryString = Object .keys(queryParameters) .map(key => `${key}=${encodeURIComponent(queryParameters[key])}`) .join('&'); urlAsString = queryString ? `${urlAsString}?${queryString}` : urlAsString; const url = new URL(urlAsString); const options = { hostname: url.hostname, port: url.port, path: url.path, method: 'POST', headers: { } }; const req = https.request(options, res => { console.log(`statusCode: ${res.statusCode}`) res.on('data', d => { process.stdout.write(d) }); }); req.on('error', error => { console.error(error) }); if (body) { req.write(JSON.stringify(data)); } req.end();
require "uri" require "json" require "net/http" baseUrl = "https://api.etrusted.com"; queryStringParameters = { } routeParameters = { } headers = { } queryStringValues = queryStringParameters.to_a queryStringPairs = queryStringValues.map { |entry| entry[0].to_s + "=" + (entry[1] || '') }; queryString = queryStringPairs.join('&') urlAsString = baseUrl + "/questionnaire-links" + (queryString != "" ? "?" + queryString : "") urlAsString.gsub!(/\{[^\}]*\}/) { |m| routeParameters[m[1...-1].to_sym] } if urlAsString url = URI(urlAsString) https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request.body = JSON.dump({ "type": "sales", "questionnaireTemplate": { "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f" }, "customer": { "id": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "mobile": 49123456789, "address": "Anystr. 17, 12345" }, "channel": { "id": "example_unique_identifier", "type": "user_defined" }, "transaction": { "reference": "order-12345", "date": "2017-01-01T13:30:15Z" }, "products": [ { "gtin": "1234567890123", "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg", "name": "Specialbrand T-Shirt White M", "mpn": "23687778", "sku": "1234-TS-WH-M", "brand": "specialbrand", "url": "https://www.specialbrandshop.com/article123-TS-WH-M/" } ], "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "system": "customer_system_name", "systemVersion": "1.0" }) response = https.request(request) puts response.read_body
//#region Imports import java.net.URL; import java.net.URLEncoder; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.lang.StringBuffer; import java.util.Map; import java.util.HashMap; import java.util.AbstractMap; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.ArrayList; //#endregion public class main { public static final Pattern PATTERN = Pattern.compile("\\{([^\\}]*)\\}"); public static void main(String[] args) throws IOException { try { Map<String, String> headers = new HashMap<>(); Map<String, String> queryStringValues = new HashMap<>(); Map<String, String> routeParameters = new HashMap<>(); //#region Parameters String body = new StringBuilder() .append("{") .append(" \"type\": \"sales\",") .append(" \"questionnaireTemplate\": {") .append(" \"id\": \"tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f\"") .append(" },") .append(" \"customer\": {") .append(" \"id\": \"cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx\",") .append(" \"firstName\": \"John\",") .append(" \"lastName\": \"Doe\",") .append(" \"email\": \"john.doe@example.com\",") .append(" \"mobile\": 49123456789,") .append(" \"address\": \"Anystr. 17, 12345\"") .append(" },") .append(" \"channel\": {") .append(" \"id\": \"example_unique_identifier\",") .append(" \"type\": \"user_defined\"") .append(" },") .append(" \"transaction\": {") .append(" \"reference\": \"order-12345\",") .append(" \"date\": \"2017-01-01T13:30:15Z\"") .append(" },") .append(" \"products\": [") .append(" {") .append(" \"gtin\": \"1234567890123\",") .append(" \"imageUrl\": \"https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg\",") .append(" \"name\": \"Specialbrand T-Shirt White M\",") .append(" \"mpn\": \"23687778\",") .append(" \"sku\": \"1234-TS-WH-M\",") .append(" \"brand\": \"specialbrand\",") .append(" \"url\": \"https://www.specialbrandshop.com/article123-TS-WH-M/\"") .append(" }") .append(" ],") .append(" \"metadata\": {") .append(" \"metaKey1\": \"metaValue1\",") .append(" \"metaKey2\": \"metaValue2\"") .append(" },") .append(" \"system\": \"customer_system_name\",") .append(" \"systemVersion\": \"1.0\"") .append("}") .toString(); String baseUrl = "https://api.etrusted.com"; //#endregion String urlAsString = baseUrl + "/questionnaire-links"; Matcher matcher = PATTERN.matcher(urlAsString); StringBuffer out = new StringBuffer(); while (matcher.find()) { String variable = routeParameters.get(matcher.group(1)); matcher.appendReplacement(out, variable); } matcher.appendTail(out); urlAsString = out.toString(); ArrayList<String> queryStringParts = new ArrayList<>(); for (String key : queryStringValues.keySet()){ queryStringParts.add(key + "=" + URLEncoder.encode(queryStringValues.get(key))); } if (queryStringParts.size() > 0) { urlAsString += "?" + String.join("&", queryStringParts); } URL url = new URL(urlAsString); HttpURLConnection httpRequest = (HttpURLConnection) url.openConnection(); for (String key : headers.keySet()){ httpRequest.setRequestProperty(key, headers.get(key)); } httpRequest.setRequestMethod("POST"); httpRequest.setRequestProperty("Content-Type", "application/json"); httpRequest.setDoOutput(true); OutputStream outputStream = httpRequest.getOutputStream(); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, "UTF-8"); outputStreamWriter.write(body); outputStreamWriter.flush(); outputStreamWriter.close(); outputStream.close(); httpRequest.connect(); BufferedReader in = new BufferedReader(new InputStreamReader(httpRequest.getInputStream())); String inputLine; StringBuffer content = new StringBuffer(); while ((inputLine = in.readLine()) != null) { content.append(inputLine); } in.close(); int status = httpRequest.getResponseCode(); httpRequest.disconnect(); System.out.println("Response Status: " + String.valueOf(status)); System.out.println("Response Body: " + content.toString()); } catch (MalformedURLException ex) { System.out.println("URL provided not valid"); } catch (IOException ex) { System.out.println("Error reading HTTP connection" + ex.toString()); throw ex; } } }
<?php //#region Parameters $baseUrl = 'https://api.etrusted.com'; // Change me! $body = json_decode('{ "type": "sales", "questionnaireTemplate": { "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f" }, "customer": { "id": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "mobile": 49123456789, "address": "Anystr. 17, 12345" }, "channel": { "id": "example_unique_identifier", "type": "user_defined" }, "transaction": { "reference": "order-12345", "date": "2017-01-01T13:30:15Z" }, "products": [ { "gtin": "1234567890123", "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg", "name": "Specialbrand T-Shirt White M", "mpn": "23687778", "sku": "1234-TS-WH-M", "brand": "specialbrand", "url": "https://www.specialbrandshop.com/article123-TS-WH-M/" } ], "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "system": "customer_system_name", "systemVersion": "1.0" }'); //#endregion $url = "$baseUrl/questionnaire-links"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode($body), CURLOPT_HTTPHEADER => array( "Content-Type: application/json", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
import http.client import json from urllib.parse import urlparse query_string_parameters = { } route_parameters = { } headers = { 'Content-Type': 'application/json' } url_as_string = 'https://api.etrusted.com/questionnaire-links'.format(**{ **query_string_parameters, **route_parameters }) payload = '' payload = json.dumps({ "type": "sales", "questionnaireTemplate": { "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f" }, "customer": { "id": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "mobile": 49123456789, "address": "Anystr. 17, 12345" }, "channel": { "id": "example_unique_identifier", "type": "user_defined" }, "transaction": { "reference": "order-12345", "date": "2017-01-01T13:30:15Z" }, "products": [ { "gtin": "1234567890123", "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg", "name": "Specialbrand T-Shirt White M", "mpn": "23687778", "sku": "1234-TS-WH-M", "brand": "specialbrand", "url": "https://www.specialbrandshop.com/article123-TS-WH-M/" } ], "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "system": "customer_system_name", "systemVersion": "1.0" }) url = urlparse(url_as_string) http_client = http.client.HTTPSConnection(url.netloc) http_client.request("POST", url_as_string, payload, headers) response = http_client.getresponse() data = response.read() print(data.decode("utf-8"))
curl 'https://api.etrusted.com/questionnaire-links' \ --request POST \ --data-raw '{ "type": "sales", "questionnaireTemplate": { "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f" }, "customer": { "id": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "mobile": 49123456789, "address": "Anystr. 17, 12345" }, "channel": { "id": "example_unique_identifier", "type": "user_defined" }, "transaction": { "reference": "order-12345", "date": "2017-01-01T13:30:15Z" }, "products": [ { "gtin": "1234567890123", "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg", "name": "Specialbrand T-Shirt White M", "mpn": "23687778", "sku": "1234-TS-WH-M", "brand": "specialbrand", "url": "https://www.specialbrandshop.com/article123-TS-WH-M/" } ], "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "system": "customer_system_name", "systemVersion": "1.0" }' \ --header 'Content-Type: application/json' \ --location
This feature is coming soon!
The operation tester will give you the possibility to pre-test operations with our sandbox environment.
What would you expect from the operation tester? Tell us your opinion!

Models

QuestionnaireLinkRequest

The request parameters for generating a transactional questionnaire link.

Properties

type
string

The type parameter defines the transactional event type. This parameter is useful to connect a feedback with a specific transaction type (e.g. sales, after-sales, checkout, etc.). By default the type is link_generation.

questionnaireTemplate
object
 

The questionnaireTemplate property identifies the questionnaire template used to render the actual questionnaire.

Properties
id
string
 

The id property is the eTrusted ID of the questionnaire template to use.

There are a host of questionnaire templates to choose from:

TemplateDescriptionID
Standard Questionnaire TemplateCollect service reviewstpl-qst-aabd1dee-2676-4303-995a-1e6762a78b44
Standard Questionnaire Template (COVID-19)Collect service reviews with COVID-19 messagetpl-qst-1605077d-f768-422d-8fad-809f93d7a18f
Extended Questionnaire TemplateMultipage service review templatetpl-qst-baaec16a-7fd6-4815-b119-9aadea3cf986
Extended Questionnaire Template (COVID-19)Multipage service review template with COVID-19 messagetpl-qst-fc188b0e-5777-4a26-be03-ef186aab9cd1
Standalone Product Review TemplateCollect just product reviewstpl-qst-a62a58a3-2dbe-4cc0-8be7-d57d1b1a075a

Please visit the help center to see what each template looks like.

customer
object
 

The customer object includes all data of the customer who is invited to leave a review.

If developers do not want to use the optional properties, they should omit them instead of including empty strings as their values.

Properties
id
string

The ID of the customer who is invited to leave a review.

firstName
string

First name of the customer who is invited to leave a review (e.g. John).

lastName
string

Last name of the customer who is invited to leave a review (e.g. Doe).

email
string
 

Email address of the customer who is invited to leave a review (e.g. john.doe@example.com). This must be a valid email address.

mobile
string

Mobile telephone number of the customer who is invited to leave a review. The mobile number must have international format including + and country code. (e.g. +49123456789).

address
string

Address of the customer who is invited to leave a review (e.g. Anystreet 17, Anycity, Anystate 12345).

channel
object
 

A company can interact with their customers through different channels (e.g. online, offline, app, etc.). Those channels can be mapped in eTrusted under the account. The channel object contains the information about the channel associated with the review.

Properties
id
string
 

The property id is the unique identifier of the channel associated with the review. Organisations can choose to use the eTrusted ID of the channel or an ID of any external system (e.g. CH-123456) if eTrusted is properly configured.

type
string

etrusted: if the organisation chooses to use the eTrusted ID. user_defined: if the organisation chooses to use an ID of an external system.

transaction
object
 

The transaction object defines the transaction for which the customer shall write a review.

If developers do not want to use the optional date property, they should omit it instead of including an empty strings as its value.

Properties
reference
string
 

The reference property can contain any reference used by organisations to identify the transaction. This string must be unique (the order or invoice number, e.g. order-12345).

date
string

The date reference specifies the date at which the event to be reviewed took place. It is a timestamp in the ISO 8601 and RFC3339 compliant format yyyy-MM-dd’T’HH:mm:ss.SSSZ.

products
[object Object][]

This is a list of products.

It contains the products that are associated with the event.

It includes all data needed for product reviews for these products.

NB: The products property is required in case the questionnaireTemplate property is set to the id of the Standalone Product Review Template. If the product property is filled out for any of the other four questionnaireTemplate above, the product reviews page will be added to the generated questionnaire.

metadata
object

This object can be used to add information (besides what eTrusted provides by default) about the customer, event or anything else, e.g. for analysis purposes.

system
string
 

The system property identifies the system that issued the questionnaire link API call (e.g. “salesforce”, “sap”, etc.).

systemVersion
string
 

The systemVersion property identifies the version of the source system (e.g. “1.0”). This offers organisations the option to use different versions of the same integration without putting this information into the system name.

QuestionnaireLinkResponse

Properties

id
string
 

The property id identifies the actual questionnaire which was rendered (e.g. qre-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx).

link
string
 

This is a link to the questionnaire which can be provided to the customer via the channel the organisation chooses (e.g., SMS, email, etc.). The link is shortened automatically so that it can also be used for channels with space limitations (e.g. SMS).

token
string
 

The questionnaireToken is the jwt token of the questionnaire which was rendered. eTrusted uses the compact serialisation format as defined in JSON Web Signature (JWS) standard rfc7515, like "head.payload.signature".

Need further support?

Visit the Help Centre for further information, or contact us. Are some words or terms unfamiliar? Then visit the glossary for clarification.