NAV Navbar
shell javascript swift java

Introduction

Welcome to the Saint Laurent Trust-Place API ! With our API, you have the opportunity to access public API endpoints that provide details about certificates and transactions.

We offer language bindings in Shell, JavaScript, Swift, and Java. On the right-hand side, you'll find illustrative code snippets, and you can easily switch between programming languages using the tabs located in the upper right corner.

API Key

Get the key

To use the Saint Laurent Trust-Place API you need The API Key that will be provided to you by the Trust-Place Team.

Base Urls

Development

https://api-ysl-dev.trust-place.com/

Production

https://api-ysl.trust-place.com/

Certificates

Get All Certificates

This endpoint retrieves all the certificates, and allows users to access relevant details about these certificates, it accepts an optional query param clientId to retrieve client's certificates.

HTTP Request

GET <base_url>/api/public/certificates

URL Parameters

Parameter Description
clientId The client id ( query parameter )
curl "<base_url>/api/public/certificates"
  -H "x-api-key: <api_key>"
const request = require('request');
const options = {
  'method': 'GET',
  'url': '<base_url>/api/public/certificates',
  'headers': {
    'x-api-key': '<api_key>'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/certificates")

var request = URLRequest(url: url!)

request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("<api_key>", 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("<base_url>/api/public/certificates")
  .method("GET", null)
  .addHeader("x-api-key", "<api_key>")
  .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 one:

{
    "success": true,
    "data": {
      "_id": "<_id>",
      "state": "<state>",
      "uidToken": "<uid_token>",
      "clientId": "<client_id>",
      "transactionId": "<transaction_id>",
      "isRestricted": "<is_restricted_certificate>",
      "isAudited": "<is_audited_certificate>",
      "createdAt": "2023-08-01T12:00:00.000Z",
      "updatedAt": "2023-08-01T12:00:00.000Z"
    }
}

Get Certificate By UID Token

This endpoint retrieves a certificate by it's uid token.

HTTP Request

GET <base_url>/api/public/certificates/<uid_token>

URL Parameters

Parameter Description
uid_token The product's unique token
curl "<base_url>/api/public/certificates/<uid_token>"
  -H "x-api-key: <api_key>"
const request = require('request');
const options = {
  'method': 'GET',
  'url': '<base_url>/api/public/certificates/<uid_token>',
  'headers': {
    'x-api-key': '<api_key>'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/certificates/<uid_token>")

var request = URLRequest(url: url!)

request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("<api_key>", 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("<base_url>/api/public/certificates/<uid_token>")
  .method("GET", null)
  .addHeader("x-api-key", "<api_key>")
  .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": "<_id>",
      "state": "<state>",
      "uidToken": "<uid_token>",
      "sku": "<product_sku>",
      "clientId": "<client_id>",
      "transactionId": "<transaction_id>",
      "isRestricted": false,
      "isAudited": "<is_audited_certificate>",
      "createdAt": "2023-08-01T12:00:00.000Z",
      "updatedAt": "2023-08-01T12:00:00.000Z"
    }
}

Create Certificate

This endpoint enables the creation of a new certificate within the Saint Laurent Trust-Place system. By sending a POST request to this URL, users can provide necessary information to generate a new certificate.

Ensure that all required fields are provided in the request body to facilitate accurate certificate generation.

HTTP Request

POST <base_url>/api/public/certificates/create

Body Parameters

Parameter Description
uidToken Unique Token ID
isAudited Boolean isAudited ( Default: false )
sku* Product SKU
clientId* App Client ID
transactionId* Transaction ID
curl --request POST '<base_url>/api/public/certificates/create' \
--header 'x-api-key: <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "uidToken": "<uid_token>",
  "isAudited": "<is_audited>",
  "sku": "<product_sku>",
  "clientId": "<client_id>",
  "transactionId": "<transaction_id>",
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': '<base_url>/api/public/certificates/create',
  'headers': {
    'x-api-key': '<api_key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "uidToken": "<uid_token>",
  "isAudited": "<is_audited>",
  "sku": "<product_sku>",
  "clientId": "<client_id>",
  "transactionId": "<transaction_id>",
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/certificates/create")
let parameters = [
  "uidToken": "<uid_token>",
  "isAudited": "<is_audited>",
  "sku": "<product_sku>",
  "clientId": "<client_id>",
  "transactionId": "<transaction_id>",
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("<api_key>", 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("uidToken", "<uid_token>");
  rootJson.put("isAudited", "<is_audited>");
  rootJson.put("sku", "<product_sku>");
  rootJson.put("clientId", "<client_id>");
  rootJson.put("transactionId", "<transaction_id>");
} 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("<base_url>/api/public/certificates/create")
  .addHeader("x-api-key", "<api_key>")
  .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();
    }
  }
});

The above command returns JSON structured like this:

{
    "success": true,
    "data": {
      "_id": "<_id>",
      "state": "<state>",
      "uidToken": "<uid_token>",
      "sku": "<product_sku>",
      "clientId": "<client_id>",
      "transactionId": "<transaction_id>",
      "isRestricted": "<is_restricted_certificate>",
      "isAudited": "<is_audited_certificate>",
      "createdAt": "2023-08-01T12:00:00.000Z",
      "updatedAt": "2023-08-01T12:00:00.000Z"
    }
}

Update Certificate

This endpoint enables the update of a certificate within the Saint Laurent Trust-Place system. By sending a PATCH request to this URL, users can provide necessary information to update a certificate.

Ensure that all required fields are provided in the request body to facilitate accurate certificate update.

Note: This endpoint will only update certificates that are NOT marked as Audited.

HTTP Request

PATCH <base_url>/api/public/certificates/<uid_token>

URL Parameters

Parameter Description
uid_token The product's unique token

Body Parameters

Parameter Description
transactionId* Transaction ID
curl --request PATCH '<base_url>/api/public/certificates/<uid_token>' \
--header 'x-api-key: <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "transactionId": "<transaction_id>",
}'
const request = require('request');
const options = {
  'method': 'PATCH',
  'url': '<base_url>/api/public/certificates/<uid_token>',
  'headers': {
    'x-api-key': '<api_key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "transactionId": "<transaction_id>",
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/certificates/<uid_token>")
let parameters = [
  "transactionId": "<transaction_id>",
] as [String: Any]

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

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("transactionId", "<transaction_id>");
} 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("<base_url>/api/public/certificates/<uid_token>")
  .addHeader("x-api-key", "<api_key>")
  .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();
    }
  }
});

The above command returns JSON structured like this:

{
    "success": true,
    "data": {
      "_id": "<_id>",
      "state": "<state>",
      "uidToken": "<uid_token>",
      "sku": "<product_sku>",
      "clientId": "<client_id>",
      "transactionId": "<transaction_id>",
      "isRestricted": "<is_restricted_certificate>",
      "isAudited": true, // Will be set to true
      "createdAt": "2023-08-01T12:00:00.000Z",
      "updatedAt": "2023-08-01T12:00:00.000Z"
    }
}

Transfer Certificate

This endpoint allows the transfer of a certificate's ownership from one entity to another within the Saint Laurent Trust-Place ecosystem. Ensure that all required fields are provided in the request body.

The certificate's state will shift to In transit waiting to validate the transfer.

HTTP Request

POST <base_url>/api/public/certificates/transfer

Body Parameters

Parameter Description
uidToken* Unique Token ID
senderClientId* Sender Client ID
receiverClientId* Receiver Client ID
curl --request POST '<base_url>/api/public/certificates/transfer' \
--header 'x-api-key: <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "uidToken": "<uid_token>",
  "senderClientId": "<sender_client_id>",
  "receiverClientId": "<receiver_client_id>",
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': '<base_url>/api/public/certificates/transfer',
  'headers': {
    'x-api-key': '<api_key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "uidToken": "<uid_token>",
  "senderClientId": "<sender_client_id>",
  "receiverClientId": "<receiver_client_id>",
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/certificates/transfer")
let parameters = [
  "uidToken": "<uid_token>",
  "senderClientId": "<sender_client_id>",
  "receiverClientId": "<receiver_client_id>",
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("<api_key>", 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("uidToken", "<uid_token>");
  rootJson.put("senderClientId", "<sender_client_id>");
  rootJson.put("receiverClientId", "<receiver_client_id>");
} 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("<base_url>/api/public/certificates/transfer")
  .addHeader("x-api-key", "<api_key>")
  .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();
    }
  }
});

The above command returns JSON structured like this:

{
    "success": true,
    "data": {
      "_id": "<_id>",
      "state": "IN TRANSIT",
      "uidToken": "<uid_token>",
      "sku": "<product_sku>",
      "clientId": "<client_id>",
      "oldClientId": "<old_client_id>",
      "transactionId": "<transaction_id>",
      "isRestricted": "<is_restricted_certificate>",
      "isAudited": "<is_audited_certificate>",
      "createdAt": "2023-08-01T12:00:00.000Z",
      "updatedAt": "2023-08-01T12:00:00.000Z"
    }
}

Transfer Certificate Validated

This endpoint confirm the successful validation of a certificate transfer, After the transfer process is completed and validated, this operation finalizes the update of ownership and status.

HTTP Request

POST <base_url>/api/public/certificates/transfer/validated

Body Parameters

Parameter Description
uidToken* Unique Token ID
curl --request POST '<base_url>/api/public/certificates/transfer/validated' \
--header 'x-api-key: <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "uidToken": "<uid_token>"
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': '<base_url>/api/public/certificates/transfer/validated',
  'headers': {
    'x-api-key': '<api_key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "uidToken": "<uid_token>"
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/certificates/transfer/validated")
let parameters = [
  "uidToken": "<uid_token>"
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("<api_key>", 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("uidToken", "<uid_token>");
} 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("<base_url>/api/public/certificates/transfer/validated")
  .addHeader("x-api-key", "<api_key>")
  .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();
    }
  }
});
{
    "success": true,
    "data": {
      "_id": "<_id>",
      "state": "<state>",
      "uidToken": "<uid_token>",
      "sku": "<product_sku>",
      "clientId": "<client_id>",
      "transactionId": "<transaction_id>",
      "isRestricted": "<is_restricted_certificate>",
      "isAudited": "<is_audited_certificate>",
      "createdAt": "2023-08-01T12:00:00.000Z",
      "updatedAt": "2023-08-01T12:00:00.000Z"
    }
}

Return Certificate

This endpoint returns a certificate, When a certificate needs to be returned, this operation ensure a secure and traceable return transaction.

HTTP Request

POST <base_url>/api/public/certificates/return

Body Parameters

Parameter Description
transactionId Transaction ID
curl --request POST '<base_url>/api/public/certificates/return' \
--header 'x-api-key: <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "transactionId": "<transaction_id>"
}'
const request = require('request');
const options = {
  'method': 'POST',
  'url': '<base_url>/api/public/certificates/return',
  'headers': {
    'x-api-key': '<api_key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "transactionId": "<transaction_id>"
})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/certificates/return")
let parameters = [
  "transactionId": "<transaction_id>"
] as [String: Any]

var request = URLRequest(url: url!)
request.addValue("<api_key>", 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("transactionId", "<transaction_id>");
} 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("<base_url>/api/public/certificates/return")
  .addHeader("x-api-key", "<api_key>")
  .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();
    }
  }
});

Delete Certificate ( Temporary Testing Endpoint )

This endpoint deletes a certificate, this endpoint is only for testing and will only be available on the development environment

HTTP Request

DELETE <base_url>/api/public/certificates/<uid_token>

URL Parameters

Parameter Description
uid_token The product's unique token
curl --request DELETE '<base_url>/api/public/certificates/<uid_token>' \
--header 'x-api-key: <api_key>'
const request = require('request');
const options = {
  'method': 'DELETE',
  'url': '<base_url>/api/public/certificates/<uid_token>',
  'headers': {
    'x-api-key': '<api_key>'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});

Transactions

List All Transactions

This endpoint retrieves all the transactions. this operation grants access to details regarding these transactions, it accepts an optional query param clientId to retrieve client's transactions.

HTTP Request

POST <base_url>/api/public/transactions

URL Parameters

Parameter Description
clientId The client id ( query parameter )
curl --request GET '<base_url>/api/public/transactions' \
--header 'x-api-key: <api_key>'
const request = require('request');
const options = {
  'method': 'GET',
  'url': '<base_url>/api/public/transactions',
  'headers': {
    'x-api-key': '<api_key>'
  },
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/transactions")

var request = URLRequest(url: url!)
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("<api_key>", 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("<base_url>/api/public/transactions")
  .method("GET", null)
  .addHeader("x-api-key", "<api_key>")
  .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": "<_id>",
      "type": "<type>",
      "uidToken": "<uid_token>",
      "senderClientId": "<sender_client_id>",
      "receiverClientId": "<receiver_client_id>",
      "transactionId": "<transaction_id>",
      "createdAt": "2023-08-01T12:00:00.000Z",
      "updatedAt": "2023-08-01T12:00:00.000Z"
    }
  ]
}

Get Transactions By UID Token

curl "<base_url>/api/public/transactions/<uid_token>"
  -H "x-api-key: <api_key>"
const request = require('request');
const options = {
  'method': 'GET',
  'url': '<base_url>/api/public/transactions/<uid_token>',
  'headers': {
    'x-api-key': '<api_key>'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
let url = URL(string: "<base_url>/api/public/transactions/<uid_token>")

var request = URLRequest(url: url!)

request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("<api_key>", 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("<base_url>/api/public/transactions/<uid_token>")
  .method("GET", null)
  .addHeader("x-api-key", "<api_key>")
  .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": "<_id>",
        "type": "<type>",
        "uidToken": "<uid_token>",
        "senderClientId": "<sender_client_id>",
        "receiverClientId": "<receiver_client_id>",
        "transactionId": "<transaction_id>",
        "createdAt": "2023-08-01T12:00:00.000Z",
        "updatedAt": "2023-08-01T12:00:00.000Z"
      }
    ]
}

This endpoint enables the retrieval of detailed information about transactions of a pecific product certificate

HTTP Request

GET <base_url>/api/public/transactions/<uid_token>

URL Parameters

Parameter Description
uid_token The product's unique token