Events

Create a new event

This endpoint creates a new eTrusted event.

NB: In compliance with GDPR, customers should be given the option to opt-in to receive review invitations from you. Therefore, create events using data of only customers who have opted-in.

Parameters

HTTP Headers

Name Description
Authorization

An OAuth2 authorization header with an access token, see OAuth2

Body

Content-Type Type
application/json EventRequest
{ "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }

Responses

202 - Accepted

Name Description
application/json EventPostResponse
{ "Message": "Your event (`evt-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx`) was accepted for processing.", "EventRef": "evt-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }

400 - Bad Request

Name Description
application/json ValidationError
{ "Message": "Invalid request: instance requires property `type`" }

401 - Unauthorized

Name Description
application/json UnauthorizedError
{ "Message": "Access to this resource is forbidden" }

500 - Internal Server Error

Name Description
application/json InternalServerError
{ "Message": "The server encountered an unexpected condition which prevented it from fulfilling the request." }

503 - Service Unavailable

Name Description
application/json ServiceUnavailable
{ "Message": "This service is temporarily unavailable" }
POST
https://api.etrusted.com/events
/** * Please be aware that storing your Authorization on the client side is strongly discourge. * This code example should only be used for testing purposes. */ //#region Parameters const baseUrl = 'https://api.etrusted.com'; const headers = { 'Authorization': null, // Change me! }; const body = { "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }; //#endregion let url = `${baseUrl}/events`; const xhr = new XMLHttpRequest(); xhr.open('POST', url, true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('Authorization', `${headers["Authorization"]}`); 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 headers = { 'Authorization': null, // Change me! }; const body = { "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }; //#endregion let urlAsString = `${baseUrl}/events`; 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: { 'Authorization': `${headers["Authorization"]}`, 'Content-Type': 'application/json' } }; 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"; # Some query parameters are optional and should only be set if needed. queryStringParameters = { } routeParameters = { } headers = { "Authorization": nil, # Change me! } queryStringValues = queryStringParameters.to_a queryStringPairs = queryStringValues.map { |entry| entry[0].to_s + "=" + (entry[1] || '') }; queryString = queryStringPairs.join('&') urlAsString = baseUrl + "/events" + (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["Authorization"] = headers["Authorization"] request["Content-Type"] = "application/json" request.body = JSON.dump({ "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }) 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\": \"checkout\",") .append(" \"defaultLocale\": \"de_DE\",") .append(" \"customer\": {") .append(" \"firstName\": \"John\",") .append(" \"lastName\": \"Doe\",") .append(" \"email\": \"john.doe@example.com\",") .append(" \"address\": \"Anystr. 17, 12345, Anycity, Anystate 12345\",") .append(" \"mobile\": \"+49123456789\",") .append(" \"reference\": \"cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx\"") .append(" },") .append(" \"channel\": {") .append(" \"id\": \"chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx\",") .append(" \"type\": \"etrusted\"") .append(" },") .append(" \"transaction\": {") .append(" \"reference\": \"order-12345\",") .append(" \"date\": \"value goes here\"") .append(" },") .append(" \"estimatedDeliveryDate\": \"2017-01-07\",") .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(" \"system\": \"customer_system_name\",") .append(" \"systemVersion\": \"1.0\",") .append(" \"metadata\": {") .append(" \"metaKey1\": \"metaValue1\",") .append(" \"metaKey2\": \"metaValue2\"") .append(" },") .append(" \"createdAt\": \"2018-02-01T17:09:41.790Z\"") .append("}") .toString(); String baseUrl = "https://api.etrusted.com"; headers.put("Authorization", null); // Change me! //#endregion String urlAsString = baseUrl + "/events"; 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'; $headers = array( "Authorization" => null, // Change me! ); // Change me! $body = json_decode('{ "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }'); //#endregion $url = "$baseUrl/events"; $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", "Authorization: " . $headers["Authorization"], ), )); $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 # Some query parameters are optional and should only be set if needed. query_string_parameters = { } route_parameters = { } headers = { 'Content-Type': 'application/json' 'Authorization': '', # Change me! } url_as_string = 'https://api.etrusted.com/events'.format(**{ **query_string_parameters, **route_parameters }) payload = '' payload = json.dumps({ "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }) 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/events' \ --request POST \ --data-raw '{ "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }' \ --header 'Content-Type: application/json' \ --header 'Authorization: value' \ --location

      <?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.etrusted.com/events",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>
  '{
    "type": "checkout",
    "customer": {
      "firstName": "John",
      "lastName": "Doe",
      "email": "john.doe@example.com",
      "mobile": "+49123456789",
      "address": "Anystr. 17, 12345"
    },
    "channel": {
      "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
      "type": "etrusted"
    },
    "transaction": {
      "reference": "order-12345",
      "date": "2017-01-01T13:30:15.000Z"
    },
    "products": [
      {
        "name": "Specialbrand T-Shirt White M",
        "sku": "1234-TS-WH-M",
        "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg",
        "url": "https://www.specialbrandshop.com/article123-TS-WH-M/",
        "brand": "specialbrand",
        "gtin": "1234567890123",
        "mpn": "23687778"
      }
    ],
    "system": "customer_system_name",
    "systemVersion": "1.0",
    "metadata": {
      "metaKey1": "metaValue1",
      "metaKey2": "metaValue2"
    }
  }',
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer {access_token}",
    "Content-Type: application/json",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


    

      var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.etrusted.com/events",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer {access_token}",
    "Content-Type": "application/json",
    "cache-control": "no-cache"
  },
  "processData": false,
  "data": {
    "type": "checkout",
    "customer": {
      "firstName": "John",
      "lastName": "Doe",
      "email": "john.doe@example.com",
      "mobile": "+49123456789",
      "address": "Anystr. 17, 12345"
    },
    "channel": {
      "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx",
      "type": "etrusted"
    },
    "transaction": {
      "reference": "order-12345",
      "date": "2017-01-01T13:30:15.000Z"
    },
    "products": [
      {
        "name": "Specialbrand T-Shirt White M",
        "sku": "1234-TS-WH-M",
        "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg",
        "url": "https://www.specialbrandshop.com/article123-TS-WH-M/",
        "brand": "specialbrand",
        "gtin": "1234567890123",
        "mpn": "23687778"
      }
    ],
    "system": "customer_system_name",
    "systemVersion": "1.0",
    "metadata": {
      "metaKey1": "metaValue1",
      "metaKey2": "metaValue2"
    }
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


    

      OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,
  "{" +
    "\"type\": \"checkout\"," +
    "\"customer\": {" +
      "\"firstName\": \"John\"," +
      "\"lastName\": \"Doe\"," +
      "\"email\": \"john.doe@example.com\"," +
      "\"mobile\": \"+49123456789\"," +
      "\"address\": \"Anystr. 17, 12345\"" +
    "}," +
    "\"channel\": {" +
      "\"id\": \"chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx\"," +
      "\"type\": \"etrusted\"" +
    "}," +
    "\"transaction\": {" +
      "\"reference\": \"order-12345\"," +
      "\"date\": \"2017-01-01T13:30:15.000Z\"" +
    "}," +
    "\"products\": [" +
      "{" +
        "\"name\": \"Specialbrand T-Shirt White M\"," +
        "\"sku\": \"1234-TS-WH-M\"," +
        "\"imageUrl\": \"https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg\"," +
        "\"url\": \"https://www.specialbrandshop.com/article123-TS-WH-M/\"," +
        "\"brand\": \"specialbrand\"," +
        "\"gtin\": \"1234567890123\"," +
      "}" +
    "]," +
    "\"system\": \"customer_system_name\"," +
    "\"systemVersion\": \"1.0\"," +
    "\"metadata\": {" +
      "\"metaKey1\": \"metaValue1\"," +
      "\"metaKey2\": \"metaValue2\"" +
    "}" +
  "}"
);
Request request = new Request.Builder()
  .url("https://api.etrusted.com/events")
  .post(body)
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("Content-Type", "application/json")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();


    
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!

Get an event

This endpoint retrieves an eTrusted event by its ID.

It can be used to check if your events has been created correctly after a POST request.

Parameters

Route Parameters

Name Description
eventRef

This is the event ID in eTrusted UUID format as a reference. Event references are included in the response when you create an event via POST request.

HTTP Headers

Name Description
Authorization

An OAuth2 authorization header with an access token, see OAuth2

Responses

200 - The event with the ID that equals `eventRef`.

Name Description
application/json EventGetResponse
{ "id": "evt-eacef7fe-5176-47b5-877d-b90a53a1cc68", "accountRef": "acc-863c9d8d-1108-4591-868d-5e0aaad26cf4", "type": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": "+49123456789", "reference": "cus-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "tracking": { "client": "PUBLIC_EVENTS_API", "medium": "API" }, "transaction": { "reference": "order-12345", "date": "value goes here" }, "estimatedDeliveryDate": "2017-01-07", "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/" } ], "system": "customer_system_name", "systemVersion": "1.0", "metadata": { "metaKey1": "metaValue1", "metaKey2": "metaValue2" }, "createdAt": "2018-02-01T17:09:41.790Z" }

401 - Unauthorized

Name Description
application/json UnauthorizedError
{ "Message": "Access to this resource is forbidden" }

404 - Not Found

No body is sent for this status code.
GET
https://api.etrusted.com/events/{eventRef}
/** * Please be aware that storing your Authorization on the client side is strongly discourge. * This code example should only be used for testing purposes. */ //#region Parameters const baseUrl = 'https://api.etrusted.com'; const eventRef = null; // Change me! const headers = { 'Authorization': null, // Change me! }; const body = ""; //#endregion let url = `${baseUrl}/events/${eventRef}`; const xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.setRequestHeader('Authorization', `${headers["Authorization"]}`); 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 eventRef = null; // Change me! const headers = { 'Authorization': null, // Change me! }; const body = ""; //#endregion let urlAsString = `${baseUrl}/events/${eventRef}`; 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: 'GET', headers: { 'Authorization': `${headers["Authorization"]}`, } }; 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"; # Some query parameters are optional and should only be set if needed. queryStringParameters = { } routeParameters = { "eventRef": nil, # Change me! } headers = { "Authorization": nil, # Change me! } queryStringValues = queryStringParameters.to_a queryStringPairs = queryStringValues.map { |entry| entry[0].to_s + "=" + (entry[1] || '') }; queryString = queryStringPairs.join('&') urlAsString = baseUrl + "/events/{eventRef}" + (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::Get.new(url) request["Authorization"] = headers["Authorization"] 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 baseUrl = "https://api.etrusted.com"; routeParameters.put("eventRef", null); // Change me! headers.put("Authorization", null); // Change me! //#endregion String urlAsString = baseUrl + "/events/{eventRef}"; 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("GET"); 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'; // Some query parameters are optional and should only be set if needed. $eventRef = null; // Change me! $headers = array( "Authorization" => null, // Change me! );//#endregion $url = "$baseUrl/events/$eventRef"; $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 => "GET", CURLOPT_HTTPHEADER => array( "Authorization: " . $headers["Authorization"], ), )); $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 # Some query parameters are optional and should only be set if needed. query_string_parameters = { } route_parameters = { 'eventRef': '', # Change me! } headers = { 'Authorization': '', # Change me! } url_as_string = 'https://api.etrusted.com/events/{eventRef}'.format(**{ **query_string_parameters, **route_parameters }) payload = '' url = urlparse(url_as_string) http_client = http.client.HTTPSConnection(url.netloc) http_client.request("GET", url_as_string, payload, headers) response = http_client.getresponse() data = response.read() print(data.decode("utf-8"))
curl 'https://api.etrusted.com/events/{eventRef}' \ --request GET \ --header 'Authorization: value' \ --location

      <?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.etrusted.com/events/{eventRef}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer {access_token}",
    "Content-Type: application/json",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


    

      var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.etrusted.com/events/{eventRef}",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer {access_token}",
    "cache-control": "no-cache",
  },
  "processData": false,
  "data": ""
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


    

      OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.etrusted.com/events/{eventRef}")
  .post(null)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();


    
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

EventRequest

This object represents the request payload for creating an eTrusted event.

NB: In compliance with GDPR, customers should be given the option to opt-in to receive review invitations from you. Therefore, create events using data of only customers who have opted-in.

Properties

type
string
 

The event type. It represents the touchpoint that triggered the event. You can only use an event type that exists in your eTrusted configuration. Check out the event type documentation to read more about it.

defaultLocale
string

The default locale for this event. If set, the default locale determines the language of the invite and the questionnaire that are triggered by the event. If not set, the channel locale will be used instead.

customer
object
 

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

Properties
firstName
string

First name of the customer.

lastName
string

Last name of the customer.

email
string
 

Email address of the customer. It must be a valid email address.

address
string

Address of the customer.

mobile
string

Mobile telephone number of the customer. The mobile number must have international format including + and country code. (e.g. +49123456789).

reference
string

The customer's ID as a reference UUID.

channel
object
 

This object holds information about the channel associated with the event.

Properties
id
string
 

The unique identifier of the channel. This can either be an eTrusted UUID or an identifier from your own software eco-system. Please see Channel IDs.

type
string

This can be set to either user_defined if you defined the channel id yourself or etrusted if it was generated by the eTrusted system thus its in the format chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx. Please see Channel IDs for more.

transaction
object
 

The event transaction holds a reference to the transaction, order, process etc. within your own system that triggers the event.

Properties
reference
string
 

The transaction reference identifies your internal transaction, order, process etc.

This string must be unique. For example, it can be an order or invoice number such as order-12345.

date
string

The date and time when the transaction took place. It is a timestamp in the ISO 8601 and RFC 3339 compliant format yyyy-MM-dd’T’HH:mm:ss.SSSZ. Check the glossary for examples of valid datetime formats.

estimatedDeliveryDate
string

The estimated date of the delivery. It is a date in the ISO 8601 and RFC3339 compliant format yyyy-MM-dd. Check the glossary for examples of valid datetime formats.

products
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.

system
string
 

This is the system that issues the events API call. This way you can identify the source system that called the events API.

systemVersion
string
 

This is the version of the source system.

metadata
object

Add more information to your event via the metadata object. This may be anything that you want to track or evaluate.

createdAt
string

The date and time when the event was created, in the ISO 8601 and RFC3339 compliant format yyyy-MM-dd’T’HH:mm:ss.SSSZ. Check the glossary for examples of valid datetime formats.

EventPostResponse

Properties

Message
string

The response message: "Your event (evt-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx) was accepted for processing".

EventRef
string

The event reference UUID.

ValidationError

Properties

Message
string

The error message details. In case of a missing required property, the message looks like this: "Invalid request: instance requires property type"

UnauthorizedError

Properties

Message
string

The error message details. If the request was not authorized, access is forbidden: "Access to this resource is forbidden"

InternalServerError

Properties

Message
string

The error message details. E.g. "The server encountered an unexpected condition which prevented it from fulfilling the request"

ServiceUnavailable

Properties

Message
string

The error message details. In case the server is down, it says "This service is temporarily unavailable".

EventGetResponse

This object represents the response object of an eTrusted event.

Properties

id
string

The unique identifier of the event.

accountRef
string

The account reference ID the event belongs to

type
string

The event type. It represents the touchpoint that triggered the event. You can only use an event type that exists in your eTrusted configuration.

defaultLocale
string

The default locale for this event. If set, the default locale determines the language of the invite and the questionnaire that are triggered by the event. If not set, the channel locale will be used instead.

customer
object

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

Properties
firstName
string

First name of the customer.

lastName
string

Last name of the customer.

email
string
 

Email address of the customer. It must be a valid email address.

address
string

Address of the customer.

mobile
string

Mobile telephone number of the customer. The mobile number must have international format including + and country code. (e.g. +49123456789).

reference
string

The customer ID as a reference UUID.

channel
object

This object holds information about the channel associated with the event.

Properties
id
string
 

The unique identifier of the channel. This can either be an eTrusted UUID or an identifier from your own software eco-system. Please see Channel IDs.

type
string

This can be set to either user_defined if you defined the channel id yourself or etrusted if it was generated by the eTrusted system thus its in the format chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx. Please see Channel IDs for more.

tracking
object

Provides information regarding where a review is coming.

Properties
client
string

Identifies the name of the client eg: PUBLIC_EVENTS_API.

medium
string

Describes the medium through which the review will be collected ie: API, WIDGET, WEB_APP, MOBILE_APP

transaction
object

The event transaction holds a reference to the transaction, order, process etc. within your own system that triggers the event.

Properties
reference
string
 

The transaction reference identifies your internal transaction, order, process etc.

This string must be unique. For example, it can be an order or invoice number such as order-12345.

date
string

The date and time when the transaction took place. It is a timestamp in the ISO 8601 and RFC 3339 compliant format yyyy-MM-dd’T’HH:mm:ss.SSSZ. Check the glossary for examples of valid datetime formats.

estimatedDeliveryDate
string

The estimated date of the delivery. It is a date in the ISO 8601 and RFC3339 compliant format yyyy-MM-dd. Check the glossary for examples of valid datetime formats.

products
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.

system
string

This is the system that issues the events API call. This way you can identify the source system that called the events API.

systemVersion
string

This is the version of the source system.

metadata
object

Add more information to your event via the metadata object. This may be anything that you want to track or evaluate.

createdAt
string

The date and time when the event was created, in the ISO 8601 and RFC3339 compliant format yyyy-MM-dd’T’HH:mm:ss.SSSZ. Check the glossary for examples of valid datetime formats.

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.