Skip to main content
Skip table of contents

Two Way Merge Request

To invoke a Two Way Merge you POST a request in the structured JSON format or using multipart/form-dataTo understand how the two way merge process works, refer to the Two Way Merge Guide.

End point
CODE
POST /api/json/v1/merge

JSON Request

Request
JS
{
  "a": {
    "type": "http",
    "uri": "https://bitbucket.org/deltaxml/json-compare/raw/af425f2ce7c102433299f1c61a60d46f02d88ee3/Sample%20JSON/Server_Status_Testing/f1.json"
  },
  "b": {
    "type": "http",
    "uri": "https://bitbucket.org/deltaxml/json-compare/raw/af425f2ce7c102433299f1c61a60d46f02d88ee3/Sample%20JSON/Server_Status_Testing/f2.json"
  },
  "wordByWord": "false",
  "arraylignment": "typeWithValuePriority",
  "mergePriority": "a",
  "dxConfig": [
    {
        "ignoreChanges": "delete",
        "key": "created"
    }
  ]
}

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

The response below indicates the merge result describing the changes between the inputs specified in the request. 

Response
XML
HTTP/1.1 200 Created
{
    "a": 1
}

The example above shows how comparison inputs could be specified using a HTTP URL. The request can contain different types of objects according to the types of data being processed. This is described in more detail in  the I/O types page

Form Input

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

For example:

Request
TEXT
POST /api/json/v2/two-way-merge HTTP/1.1
Content-Type: multipart/form-data; boundary=boundary-id
Content-Length: number_of_bytes_in_entire_request_body

--boundary-id
Content-Disposition: a; filename="a.json"
Content-Size: 98344
Content-Type: application/json

... JSON  ...
--boundary-id
Content-Disposition: b; filename="b.json"
Content-Size: 92224
Content-Type: application/json

... JSON  ...
--boundary-id

Content-Disposition: form-data; name="wordByWord"
true
--boundary-id
Content-Disposition: form-data; name="arrayAlignment"
typeWithValuePriority
--boundary-id
Content-Disposition: form-data; name="mergePriority"
a
--boundary-id
Content-Disposition: form-data; name="dxConfig"
{
 "dxConfig": [
  {
   "ignoreChanges": "delete",
   "key": "created"
  }
 ]
}
--boundary-id

Two Way Merge Model

When specifying a two way merge, these are the various available objects:

Object

Description

a

(required)

Input A JSON file

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

b

(required)

Input B JSON file

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

For more details about parameters, refer Two Way Merge Parameters.

Parameter

Type

Default

Description

wordByWord

boolean

false

Strings can be compared by whole string equality, or more granular word by word level.

arrayAlignment

string

orderless

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

Available Options:

  • positionPriority

  • typeWithValuePriority

  • orderless

mergePriority

string

a

The input given priority when resolving modifications.

Available Options:

  • a

  • b

dxConfig

string


A parameter with a value containing an array of configuration instructions

For example,

TEXT
{
 "dxConfig": [
  {
   "ignoreChanges": "delete",
   "key": "created"
  }
 ]
}


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.