Generic Request
Request URL
PUT /requests
Description
Submit a new generic request. There are two required properties. The rest of the request body depends on the type. The API looks for a handler for this type. If found, the request is processed by the handler. Otherwise the request is sent to the back-office for processing.
Schema
Property table for requests
Property | Description | Required | Schema |
---|---|---|---|
typeId | The entity type | Yes | { "type": "string" } |
intTag | Unique tag to identify this request and avoid duplicates, typically a string of digits | Yes | { "type": "string" } |
Request Body
{
"typeId": "SomeTypeId",
"intTag": "123402",
"name": "newCard",
"payload": {
"typeId": "1000",
"type": "standard debit",
"designCode": "design1",
"image": "images/card1.png",
"isLoungeKey": true,
"isNFC": true,
"tweaks": {
"cssId": "plasticStyle1_nfc"
}
}
}
Snippet Examples
javascript
const axios = require('axios');
const data = {
"typeId": "SomeTypeId",
"intTag": "123402",
"name": "newCard",
"payload": {
"typeId": "1000",
"type": "standard debit",
"designCode": "design1",
"image": "images/card1.png",
"isLoungeKey": true,
"isNFC": true,
"tweaks": {
"cssId": "plasticStyle1_nfc"
}
}
};
const config = {
method: 'PUT',
url: '${AMPLIFI_BASE_URL}/requests',
headers: {
'Content-Type': "application/json",
'token': "A long random string token received from /token request"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "AMPLIFI_BASE_URL/requests" --data "{ \"typeId\":\"SomeTypeId\", \"intTag\":\"123402\", \"name\":\"newCard\", \"payload\":{ \"typeId\":\"1000\", \"type\":\"standard debit\", \"designCode\":\"design1\", \"image\":\"images/card1.png\", \"isLoungeKey\":true, \"isNFC\":true, \"tweaks\":{ \"cssId\":\"plasticStyle1_nfc\" } }}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request"
Successful Response Examples
200 REQUESTS SUCCESSFUL RESPONSE GENERIC REQUEST
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
REQUEST BODY
{
"typeId": "SomeTypeId",
"intTag": "123402",
"name": "newCard",
"payload": {
"typeId": "1000",
"type": "standard debit",
"designCode": "design1",
"image": "images/card1.png",
"isLoungeKey": true,
"isNFC": true,
"tweaks": {
"cssId": "plasticStyle1_nfc"
}
}
}
RESPONSE BODY
200 REQUESTS SUCCESSFUL RESPONSE DUPLICATE GENERIC REQUEST
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
REQUEST BODY
{
"typeId": "SomeTypeId",
"intTag": "123402",
"name": "newCard",
"payload": {
"typeId": "1000",
"type": "standard debit",
"designCode": "design1",
"image": "images/card1.png",
"isLoungeKey": true,
"isNFC": true,
"tweaks": {
"cssId": "plasticStyle1_nfc"
}
}
}
RESPONSE BODY