Compare Request

 Table of Contents

To invoke a comparison you POST a request in the structured JSON format or using multipart/form-dataTo understand how the compare process works, refer to Compare Guide.

End point
POST /api/json/v1/compare

Compare Request using JSON

Here is a simple synchronous example:

{
  "a": {
    "type": "file",
    "path": "/Users/exampleUser/Documents/f1.json"
  },
  "b": {
    "type": "file",
    "path": "/Users/exampleUser/Documents/f2.json"
  },
  "wordByWord": false,
  "arrayAlignment": "typeWithValuePriority"
}

The example above shows how comparison inputs could be specified using a file path. The  ajson and bjson elements in the request can contain different types of children according to the types of data being processed. This is described in more detail in the I/O types page

The request allows the parameters to be changed from their default values.

Form Input

In addition to requests in structured JSON format, multipart/form-data can also be used.

For example:

Request
POST /api/json/v2/compare HTTP/1.1
Host: 0.0.0.0:8080
Authorization: {{auth-token}}
Content-Type: multipart/form-data; boundary=unique-boundary-id
Accept: application/json

--unique-boundary-id
Content-Disposition: form-data; name="a"

https://bitbucket.org/deltaxml/deltajson/raw/da5b76132552312c7df6f8c6efd5d9f9cc1aad95/Sample%20JSON/Simple_Data_Example/A.json
--unique-boundary-id
Content-Disposition: form-data; name="b"

https://bitbucket.org/deltaxml/deltajson/raw/da5b76132552312c7df6f8c6efd5d9f9cc1aad95/Sample%20JSON/Simple_Data_Example/B.json
--unique-boundary-id
Content-Disposition: form-data; name="wordByWord"

true
--unique-boundary-id
Content-Disposition: form-data; name="arrayAlignment"

positionPriority
--unique-boundary-id

Comparison Model

When specifying a comparison, these are the various available objects and parameters:

ObjectDescription

a

(required object)

Input A to the comparison.

See this page for the various I/O types available. 

b

(required object)

Input B to the comparison.

See this page for the various I/O types available. 

For more details about parameters, see the links to the individual pages given below.

ParameterTypeDefaultDescription
arrayAlignmentstringorderless

Merging of arrays is controlled by how items in the arrays match together.

Available Options:

  • positionPriority
  • typeWithValuePriority
  • orderless
wordByWordbooleanfalseStrings can be compared by whole string equality, or more granular word by word level.
dxConfigstring

A parameter with a value containing an array of configuration instructions.

For example, Ignore Changes by deletion, allows changes to be ignored by key.

{ "dxConfig" : 
  [ 
    { "ignoreChanges" : "delete",
      "key" : "key-name" 
    } 
  ] 
}
#content .code