Using the DeltaJSON API
The DeltaJSON REST API allows you to invoke JSON comparison, merge and graft from a wide range of programming languages and systems - in either a synchronous or asynchronous fashion. This section describes how to access the API with your 'Access Token', using the token from your application, details on the endpoints and a collection for Postman.
How to access the API
You will need a DeltaJSON Professional or Trial subscription, to access the API. If you don't have a subscription please check out the 'Getting Started' section. The RESTful API endpoints, one for each operation, can be used from any programming language connecting securely using https.
Get your Token
In order to use the DeltaJSON Service, you need to download an access token from the DeltaJSON application. This access token needs to be passed as part of the header for authorisation to perform any operation.
Refresh your Token
The access token downloaded is valid for 36000 seconds (10 hours) by default. Once this token, expires you can use the existing token to generate a new token.
For detailed information, please refer to How to Refresh your Token
Compare your first files
Quick steps:
Use the following endpoint to do a quick comparison
POST https://saas.deltaxml.com/api/json/v1/compare
Add appropriate authorisation header
Authorization: {{auth-token}}
Accept: application/json
Here is a simple synchronous request example:
{
"a": {
"type": "file",
"path": "/Users/exampleUser/Documents/input1.json"
},
"b": {
"type": "file",
"path": "/Users/exampleUser/Documents/input2.json"
},
"wordByWord": false,
"arrayAlignment": "typeWithValuePriority"
}
Play around with the parameters and generate desired results!
Postman
Postman is a popular tool for working with APIs. Download the latest version of Postman from Get Postman.
The REST API reference documentation and collection for DeltaJSON is hosted on Postman at: DeltaJSON 2.2 Postman collection.
Click on the Run in Postman button on the top-right corner on the DeltaJSON 2.2 reference docs page to use the desktop app (or browser) to run the example operations
If you are using the Safari browser, follow these instructions to setup the Postman collection
You can then set your token variables as collection variables and make use of the SaaS specific requests to refresh your token and check your usage:
The “refresh token” request will automatically set your new ID token and expiry on the collection.