Application Setup
Creating an Application
Now that you have setup the service provider, you need to set up the application which will be sending transaction to EasiTrace.
POST /api/applications
This endpoint allows you to create an application and register any number of callbacks. You need to provide at least the application name and reference, if you don’t you will get a 400 (Bad Request) response. If you provide at least one callback, the callback URL needs to be well formed, otherwise you will also get a 400 (Bad Request).
Model
{
"reference": "string",
"name": "string",
"callbacks": [
{
"reference": "string",
"url": "string"
}
]
}
Model Notes
Name is required Reference is required and must be unique within your service provider If callbacks are provided, the reference is required and the URL must be in a valid format.
Example Request
curl -X POST "https://test-api.easitrace.com/api/applications" -H "accept: application/json" -H "X-API-Key: 5383735463137313430363242069241324435444234444245323825334544424112313642444444453130463638344637364438374432394531413930397865" -H "Content-Type: application/json" -d "{ \"reference\": \"APP1\", \"name\": \"Test Application\", \"callbacks\": [ { \"reference\": \"CB1\", \"url\": \"http://www.example.com\" } ]}"
Example Response
{
"id": "9e93e3b6-c1dc-4327-997b-83ccb9de87bb"
}
Registering Callbacks
If you didn’t register callbacks when creating the application, you can use the register callbacks endpoint to do it after the fact.
POST /api/applications/{applicationId}/callbacks
You must provide a reference and valid URL, otherwise you will get a 400 (Bad Request) response.
Model
{
"reference": "string",
"url": "string"
}
Example Request
curl -X POST "https://test-api.easitrace.com/api/applications/9e93e3b6-c1dc-4327-997b-83ccb9de87bb/callbacks" -H "accept: application/json" -H "X-API-Key: 5383735463137313430363242069241324435444234444245323825334544424112313642444444453130463638344637364438374432394531413930397865" -H "Content-Type: application/json" -d "{ \"reference\": \"CB2\", \"url\": \"http://www.example.com\"}"
Example Response
If posted correctly, you will get a 200 response with no body.
Requesting Access Key
Now that the application has been created, you will need to request an access key for your application so that it can send transactions to EasiTrace.
POST /api/applications/{applicationId}/request-key
Using this endpoint will generate an access key for your application. As mentioned earlier, this access key is stored in their encrypted form and are unable to be decrypted, so you need to store these in a safe place.
Example Request
curl -X POST "https://test-api.easitrace.com/api/applications/9e93e3b6-c1dc-4327-997b-83ccb9de87bb/request-key" -H "accept: application/json" -H "X-API-Key: 5383735463137313430363242069241324435444234444245323825334544424112313642444444453130463638344637364438374432394531413930397865"
Example Response
{
"applicationId": "9e93e3b6-c1dc-4327-997b-83ccb9de87bb",
"key": "35323339393942314131304632431679334135353936393344454530995545434135323232363535373942454332434236344235303933433238323932307419"
}