NAV Navbar
shell javascript swift java

Introduction

Welcome to the Trust-Place API! You can use our API to access our public API endpoints, which can get information about products and certificates.

We have language bindings in Shell, JavaScript, Swift, and Java! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

Get an account

Our Trust-Place team will create an account for your brand that will allow you to access to our dashboard.

Connect to the account

Use your credentials to login into our dashboard.

Login Page

Get api key

Go to your profile.

Profile Menu

Copy your api key from there.

Profile

Products

Get Product

curl "https://api.trust-place.com/api/public/products/scan/<product_reference>"
  -H "x-api-key: MyApiKey"
const request = require('request');
const options = {
  'method': 'GET',
  'url': 'https://api.trust-place.com/api/public/products/scan/<product_reference>',
  'headers': {
    'x-api-key': 'MyApiKey'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/products/scan/<product_reference>")

var request = URLRequest(url: url!)

request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in
  guard let data = data else {
      print(String(describing: error))
      return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

OkHttpClient client = new OkHttpClient()
  .newBuilder()
  .build();

Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/products/scan/<product_reference>")
  .method("GET", null)
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-type", "application/json")
  .build();

client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
    e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

The above command returns JSON structured like this:

{
    "success": true,
    "data": {
        "_id": "xxxxxxxxxxxxxxxxxxx",
        "name": "Product Name",
        "color": "Product Color",
        "size": [ "Size 1", "Size 2" ],
        "price": [ "$ 379.00" ],
        "reference": "productReference",
        "description": "Product description",
        "provenance": "Product provenance",
        "vimage": "https://product-vertical.image",
        "himage": "https://product-horizontal.image",
        "brand": {
          "_id": "brandId",
          "name": "Brand Name"
        },
        "certified": false,
        "transfered": false,
        "returned": false,
        "reported": false,
    }
}

This endpoint retrieves a specific product.

HTTP Request

GET https://api.trust-place.com/api/public/products/scan/<product_reference>

URL Parameters

Parameter Description
product_reference The product's unique reference

Get product certificate

curl "https://api.trust-place.com/api/public/products/verify/<product_reference>"
  -H "x-api-key: MyApiKey"
const request = require('request');
const options = {
  'method': 'GET',
  'url': 'https://api.trust-place.com/api/public/products/verify/<product_reference>',
  'headers': {
    'x-api-key': 'MyApiKey'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/products/verify/<product_reference>")

var request = URLRequest(url: url!)

request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in
  guard let data = data else {
      print(String(describing: error))
      return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

OkHttpClient client = new OkHttpClient()
  .newBuilder()
  .build();

Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/products/verify/<product_reference>")
  .method("GET", null)
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-type", "application/json")
  .build();

client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
    e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

The above command returns JSON structured like this:

{
    "success": true,
    "data": {
        "_id": "xxxxxxxxxxxxxxxxxxx",
        "name": "Product Name",
        "color": "Product Color",
        "size": [ "Size 1", "Size 2" ],
        "price": [ "$ 379.00" ],
        "reference": "productReference",
        "description": "Product description",
        "provenance": "Product provenance",
        "vimage": "https://product-vertical.image",
        "himage": "https://product-horizontal.image",
        "brand": {
          "_id": "brandId",
          "name": "Brand Name"
        },
        "certified": true,
        "transfered": false,
        "returned": false,
        "reported": false,
        "selectedPrice": "$ 379.00",
        "SelectedSize": "Size 1",
        "certificate": {
          "state": "CHAINED",
          "reported": false,
          "_id": "Certificate Id",
          "productRef": "productReference",
          "productName": "Product name",
          "ownerEmail": "owner@email.com",
          "ownerFirstName": "Owner FirstName",
          "ownerLastName": "Owner LastName",
          "ownerPhoneNumber": "0x xx xx xx xx",
          "location": "Selling location",
          "product": "Product Id",
          "owner": "Owner Id",
          "brand": "Brand Id",
          "pdfUrl": "https://pdf.url",
          "blkChaineId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"
        },
        "certifiedAt": "2022-08-23T13:43:27.397Z",
        "owner": {
          "_id": "Owner Id",
          "email": "owner@email.com",
          "firstName": "Owner FirstName",
          "lastName": "Owner LastName",
          "phoneNumber": "0x xx xx xx xx",
          "country": "Country",
        }
    }
}

This endpoint retrieves a specific product's certificate.

HTTP Request

GET https://api.trust-place.com/api/public/products/verify/<product_reference>

URL Parameters

Parameter Description
product_reference The product's unique reference

List customer's products

This endpoint lists a customer's products.

curl --request GET 'https://api.trust-place.com/api/public/products/list/<email>' \
--header 'x-api-key: MyApiKey'
const request = require('request');
const options = {
  'method': 'GET',
  'url': 'https://api.trust-place.com/api/public/products/list/<email>',
  'headers': {
    'x-api-key': 'MyApiKey'
  },
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/products/list/<email>")

var request = URLRequest(url: url!)
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.httpMethod = "GET"

do {
  request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
} catch let error {
  print(error.localizedDescription)
}

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    guard let data = data else {
        print(String(describing: error))
        return
    }
    print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/products/list/<email>")
  .method("GET", null)
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-type", "application/json")
  .build();
client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
   e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

The above command returns JSON structured like this:

{
  "success": true,
  "data": [{
    "_id": "xxxxxxxxxxxxxxxxxxx",
    "name": "Product Name",
    "color": "Product Color",
    "size": [ "Size 1", "Size 2" ],
    "price": [ "$ 379.00" ],
    "reference": "productReference",
    "description": "Product description",
    "provenance": "Product provenance",
    "vimage": "https://product-vertical.image",
    "himage": "https://product-horizontal.image",
    "brand": {
      "_id": "brandId",
      "name": "Brand Name"
    },
    "certified": true,
    "transfered": false,
    "returned": false,
    "reported": false,
    "selectedPrice": "$ 379.00",
    "SelectedSize": "Size 1",
    "certifiedAt": "2022-08-23T13:43:27.397Z",
    "certificate": "Certificate Id",
    "owner": "Owner Id"
  }]
}

HTTP Request

POST https://api.trust-place.com/api/public/products/list/<email>

URL Parameters

Parameter Description
email Customer's email

Certificate

Create certificate for product

curl --request POST 'https://api.trust-place.com/api/public/certificates/create' \
--header 'x-api-key: MyApiKey' \
--header 'Content-Type: application/json' \
--data-raw '{
  "products": [{
    "reference": "productReference",
    "price": "$ 379.00",
    "size": "Size 1",
  }],
  "owner": {
    "email": "owner@email.com",
    "firstName": "Owner FirstName",
    "lastName": "Owner LastName",
    "phoneNumber": "0x xx xx xx xx",
  },
  "invoiceNumber": "123456789"
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': 'https://api.trust-place.com/api/public/certificates/create',
  'headers': {
    'x-api-key': 'MyApiKey',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "products": [{
    "reference": "productReference",
    "price": "$ 379.00",
    "size": "Size 1",
  }],
  "owner": {
    "email": "owner@email.com",
    "firstName": "Owner FirstName",
    "lastName": "Owner LastName",
    "phoneNumber": "0x xx xx xx xx",
  },
  "invoiceNumber": "123456789"
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/certificates/create")
let parameters = [
  "products": [
    [
      "reference": "productReference",
      "price": "$ 379.00",
      "size": "Size 1",
    ]
  ],
  "owner": [
    "email": "owner@email.com",
    "firstName": "Owner FirstName",
    "lastName": "Owner LastName",
    "phoneNumber": "0x xx xx xx xx",
  ],
  "invoiceNumber": "123456789"
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"

do {
    request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
} catch let error {
    print(error.localizedDescription)
}

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    guard let data = data else {
        print(String(describing: error))
        return
    }
    print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

JSONObject rootJson = new JSONObject();
JSONObject product = new JSONObject();
JSONArray products = new JSONArray();
try {
  //productJSON
  product.put("reference", "productReference");
  product.put("size", "Size 1");
  product.put("price", "$ 379.00");
  products.put(product);

  //rootJSON
  rootJson.put("products", products);

  // ownerJSON
  JSONObject owner = new JSONObject();
  owner.put("email", "owner@email.com");
  owner.put("firstName", "Owner FirstName");
  owner.put("lastName", "Owner LastName");
  owner.put("phoneNumber", "0x xx xx xx xx");

  rootJson.put("owner", owner);

  rootJson.put("invoiceNumber", "123456789");
} catch (JSONException e) {
  e.printStackTrace();
}

MediaType JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(rootJson.toString(), JSON); // new
Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/certificates/create")
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-Type", "application/json")
  .post(body)
  .build();
client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
   e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

This endpoint creates products certificates.

HTTP Request

POST https://api.trust-place.com/api/public/certificates/create

Body Parameters

Parameter Description
products Array of products to certify
product.reference Product's reference
product.price Product's price
product.size Product's size
owner Owner data
owner.email Owner's email
owner.firstName Owner's first number
owner.phoneNumber Owner's phone number
invoiceNumber The invoice number

Gift certificate for product

curl --request POST 'https://api.trust-place.com/api/public/certificates/gift' \
--header 'x-api-key: MyApiKey' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "productReference",
  "sender": "Sender ID",
  "receiver": {
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  }
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': 'https://api.trust-place.com/api/public/certificates/gift',
  'headers': {
    'x-api-key': 'MyApiKey',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "reference": "productReference",
  "sender": "Sender ID",
  "receiver": {
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  }
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/certificates/gift")
let parameters = [
  "reference": "productReference",
  "sender": "Sender ID",
  "receiver": [
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  ]
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"

do {
    request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
} catch let error {
    print(error.localizedDescription)
}

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    guard let data = data else {
        print(String(describing: error))
        return
    }
    print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

JSONObject rootJson = new JSONObject();
try {
  //rootJSON
  rootJson.put("reference", "productReference");
  rootJson.put("sender", "Sender ID");

  JSONObject receiver = new JSONObject();

  receiver.put("email", "receiver@email.com");
  receiver.put("firstName", "Receiver firstName");
  receiver.put("lastName", "Receiver lastName");

  rootJson.put("receiver", receiver);
} catch (JSONException e) {
  e.printStackTrace();
}

MediaType JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(rootJson.toString(), JSON); // new
Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/certificates/gift")
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-Type", "application/json")
  .post(body)
  .build();
client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
   e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

This endpoint gift a product's certificate.

HTTP Request

POST https://api.trust-place.com/api/public/certificates/gift

Body Parameters

Parameter Description
reference Product's reference
sender Sender's Id
receiver Receiver's data
email Receiver's email
firstName Receiver's first name
lastName Receiver's last name

Resale certificate to reseller

curl --request POST 'https://api.trust-place.com/api/public/certificates/resale' \
--header 'x-api-key: MyApiKey' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "productReference",
  "reseller": "Reseller ID",
  "owner": "Owner Email"
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': 'https://api.trust-place.com/api/public/certificates/resale',
  'headers': {
    'x-api-key': 'MyApiKey',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "reference": "productReference",
  "reseller": "Reseller ID",
  "owner": "Owner Email"
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/certificates/resale")
let parameters = [
  "reference": "productReference",
  "reseller": "Reseller ID",
  "owner": "Owner Email"
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"

do {
    request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
} catch let error {
    print(error.localizedDescription)
}

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    guard let data = data else {
        print(String(describing: error))
        return
    }
    print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

JSONObject rootJson = new JSONObject();
try {
  //rootJSON
  rootJson.put("reference", "productReference");
  rootJson.put("reseller", "Reseller ID");
  rootJson.put("owner", "Owner Email");
} catch (JSONException e) {
  e.printStackTrace();
}

MediaType JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(rootJson.toString(), JSON); // new
Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/certificates/resale")
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-Type", "application/json")
  .post(body)
  .build();
client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
   e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

This endpoint gift a product's certificate.

HTTP Request

POST https://api.trust-place.com/api/public/certificates/resale

Body Parameters

Parameter Description
reference Product's reference
reseller Reseller's Id
owner Owner email

Resale certificate from reseller to Customer

curl --request POST 'https://api.trust-place.com/api/public/certificates/resale/done' \
--header 'x-api-key: MyApiKey' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "productReference",
  "reseller": "Reseller ID",
  "receiver": {
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  }
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': 'https://api.trust-place.com/api/public/certificates/resale/done',
  'headers': {
    'x-api-key': 'MyApiKey',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "reference": "productReference",
  "reseller": "Reseller ID",
  "receiver": {
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  }
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/certificates/resale/done")
let parameters = [
  "reference": "productReference",
  "reseller": "Reseller ID",
  "receiver": [
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  ]
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"

do {
    request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
} catch let error {
    print(error.localizedDescription)
}

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    guard let data = data else {
        print(String(describing: error))
        return
    }
    print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

JSONObject rootJson = new JSONObject();
try {
  //rootJSON
  rootJson.put("reference", "productReference");
  rootJson.put("reseller", "Reseller ID");

  JSONObject receiver = new JSONObject();

  receiver.put("email", "receiver@email.com");
  receiver.put("firstName", "Receiver firstName");
  receiver.put("lastName", "Receiver lastName");

  rootJson.put("receiver", receiver);
} catch (JSONException e) {
  e.printStackTrace();
}

MediaType JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(rootJson.toString(), JSON); // new
Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/certificates/resale/done")
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-Type", "application/json")
  .post(body)
  .build();
client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
   e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

This endpoint gift a product's certificate.

HTTP Request

POST https://api.trust-place.com/api/public/certificates/resale/done

Body Parameters

Parameter Description
reference Product's reference
reseller Reseller's Id
receiver Receiver's data
email Receiver's email
firstName Receiver's first name
lastName Receiver's last name

Resale certificate from Sender to Receiver through Reseller

curl --request POST 'https://api.trust-place.com/api/public/certificates/resale/through' \
--header 'x-api-key: MyApiKey' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "productReference",
  "reseller": "Reseller ID",
  "sender": "Sender Email",
  "receiver": {
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  }
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': 'https://api.trust-place.com/api/public/certificates/resale/through',
  'headers': {
    'x-api-key': 'MyApiKey',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "reference": "productReference",
  "reseller": "Reseller ID",
  "sender": "Sender Eamil",
  "receiver": {
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  }
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "https://api.trust-place.com/api/public/certificates/resale/through")
let parameters = [
  "reference": "productReference",
  "reseller": "Reseller ID",
  "sender": "Sender Email",
  "receiver": [
    "email": "receiver@email.com",
    "firstName": "Receiver firstName",
    "lastName": "Receiver lastName",
  ]
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("MyApiKey", forHTTPHeaderField: "x-api-key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"

do {
    request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
} catch let error {
    print(error.localizedDescription)
}

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    guard let data = data else {
        print(String(describing: error))
        return
    }
    print(String(data: data, encoding: .utf8)!)
}

task.resume()
// Don't foget to add the okhttp dependency
// if you are using gradle *compile 'com.squareup.okhttp:okhttp:2.5.0'*
// if you are using Maven com.squareup.okhttp

JSONObject rootJson = new JSONObject();
try {
  //rootJSON
  rootJson.put("reference", "productReference");
  rootJson.put("reseller", "Reseller ID");
  rootJson.put("sender", "Sender Email");

  JSONObject receiver = new JSONObject();

  receiver.put("email", "receiver@email.com");
  receiver.put("firstName", "Receiver firstName");
  receiver.put("lastName", "Receiver lastName");

  rootJson.put("receiver", receiver);
} catch (JSONException e) {
  e.printStackTrace();
}

MediaType JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(rootJson.toString(), JSON); // new
Request request = new Request.Builder()
  .url("https://api.trust-place.com/api/public/certificates/resale/through")
  .addHeader("x-api-key", "MyApiKey")
  .addHeader("Content-Type", "application/json")
  .post(body)
  .build();
client.newCall(request).enqueue(new Callback() {
  @Override
  public void onFailure(@NotNull Call call, @NotNull IOException e) {
   e.printStackTrace();
  }

  @Override
  public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
    try {
      if (response.isSuccessful()) {
        //Parse your response
        System.out.println(response.body().toString());
      } else {
        //Get error response code //response.code()
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
});

This endpoint gift a product's certificate.

HTTP Request

POST https://api.trust-place.com/api/public/certificates/resale/through

Body Parameters

Parameter Description
reference Product's reference
reseller Reseller's Id
sender Sender's Email
receiver Receiver's data
email Receiver's email
firstName Receiver's first name
lastName Receiver's last name

Errors

Our public API uses the following error codes:

State Error Code Meaning
404 Not Found -- The specified requested item could not be found.
500 Internal Server Error -- We had a problem with our server. Try again later.
Response Error Code Meaning
1013 Product not found.
1021 Product already certified.

Troubleshooting

If any questions please feel free to reach us on contact@trust-place.com