Skip to main content

TRANSACTION SEARCH

Transaction Search API

Transaction repository provides a search API for transactions that allows for an id look-up by filters and a further retrieval of the original transaction. To access the search API, use the following URL: https://txr-search.retailsvc.com/.

Transaction search is available through the following POST endpoint: link. The endpoint accepts a JSON body with the search parameters and responds with a JSON that includes only the ids of the found transactions.

Example


async function findTransaction() {

const response = await fetch('https://txr-search.retailsvc.com/api/v1/transactions:search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your-api-key>',
},
body: JSON.stringify({
businessUnitId: '<your-business-unit-id>',
transactionTypes: ['RetailTransaction'],
productName: '<your-product-name>',
}),
});

console.log(await response.json());

// {
// "results": [
// {
// "transactionId": "001;01;23;2021-11-1417:13:10;4"
// },
// ],
// "page": {
// "skip": 0,
// "take": 10,
// "total": 1,
// "hasMore": false
// }
// }

}

Transaction Retrieval

When a transaction is found, the search API returns the id of the transaction. To retrieve the transaction, use the following endpoint: link. The endpoint accepts transaction id as a path parameter and responds with a JSON that includes the original transaction ZIP as well as linked transactions if requested. The fields are base64 encoded.

Example


async function getTransaction(id) {

const response = await fetch(`https://txr-search.retailsvc.com/api/v1/transactions/${id}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your-api-key>',
},
query: {
includeLinkedTransactions: true,
},
});

console.log(await response.json());

// {
// "transactionId": "001;01;23;2021-11-1417:13:10;4",
// "transactionData": "<base64-encoded-zip-of-transaction-data>",
// "linkedTransactions": [
// {
// "transactionId": "001;01;23;2021-11-1417:13:10;5",
// "transactionData": "<base64-encoded-zip-of-transaction-data>"
// }
// ]
// }

// Do something with the transaction data

}