Events

Create a new event

This method creates a new eTrusted event.

Parameters

Body

Content-Type Type
application/json Event
{ "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": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345" }, "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" } }

Responses

202 - Accepted

Name Description
application/json EventPostResponse

400 - Bad Request

Name Description
application/json ValidationError

401 - Unauthorized

Name Description
application/json UnauthorizedError

500 - Internal Server Error

Name Description
application/json InternalServerError

503 - Service Unavailable

Name Description
application/json ServiceUnavailable
POST
https://api.etrusted.com/events
//#region Parameters const baseUrl = 'https://api.etrusted.com'; 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": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345" }, "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" } }; //#endregion let url = `${baseUrl}/events`; 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": "checkout", "defaultLocale": "de_DE", "customer": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "address": "Anystr. 17, 12345, Anycity, Anystate 12345", "mobile": 49123456789, "reference": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345" }, "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" } }; //#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: { } }; 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 + "/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["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": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345" }, "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" } }) 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\": \"cst-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(" },") .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("}") .toString(); String baseUrl = "https://api.etrusted.com"; //#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'; // 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": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345" }, "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" } }'); //#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", ), )); $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/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": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345" }, "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" } }) 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": "cst-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx" }, "channel": { "id": "chl-xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx", "type": "etrusted" }, "transaction": { "reference": "order-12345" }, "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" } }' \ --header 'Content-Type: application/json' \ --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 method 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.

Responses

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

Name Description
application/json Event

401 - Unauthorized

Name Description
application/json UnauthorizedError

404 - Not Found

No body is sent for this status code.
GET
https://api.etrusted.com/events/{eventRef}
//#region Parameters const baseUrl = 'https://api.etrusted.com'; const eventRef = null; // Change me! const body = ""; //#endregion let url = `${baseUrl}/events/${eventRef}`; const xhr = new XMLHttpRequest(); xhr.open('GET', 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 eventRef = 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: { } }; 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 = { "eventRef": nil, # Change me! } headers = { } 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) 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! //#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'; $eventRef = null; // Change me! $body = ""; //#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_POSTFIELDS => json_encode($body), CURLOPT_HTTPHEADER => array( ), )); $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 = { 'eventRef': '', # Change me! } headers = { } 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 \ --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

Event

This object represents an eTrusted event.

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.

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

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

The channel type is either etrusted or user_defined. Please see Channel IDs.

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.

estimatedDeliveryDate
string

The estimated date of the delivery. It is a date in the ISO 8601 and RFC3339 compliant format yyyy-MM-dd.

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.

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.

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 authorised, 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".

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.