PATCH /identifiers/{identifier}

Associate meta-data with a consumer’s identifier using a JSON Patch document.

The request Content-Type header must be set to application/json-patch+json.

Path parameters:

Name

Type

Description

identifier

string, required

a consumer identifier

Body parameters:

The body must contain a correctly formatted JSON Patch document.

Modifiable identifier fields:

The patch document can modify only the Identifier Properties Object within the Identifier Object.

Example requests:

This request will set customer’s name, e-mail address, phone number, and will opt them out from receiving e-mail receipts.

PATCH /identifiers/990000000001 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
Content-Length: 399
Content-Type: application/json-patch+json

[
  {
    "op": "add",
    "path": "/properties/email",
    "value": "john.smith@example.com"
  },
  {
    "op": "add",
    "path": "/properties/phone",
    "value": "+440000000000",
  },
  {
    "op": "add",
    "path": "/properties/name",
    "value": {
      "first": "John",
      "last": "Smith"
    }
  },
  {
    "op": "add",
    "path": "/properties/opt-out",
    "value": ["receipts"]
  }
]

This request will remove the phone number.

PATCH /identifiers/990000000001 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
Content-Length: 47
Content-Type: application/json-patch+json

[{"op": "remove", "path": "/properties/phone"}]

This request will opt the customer back into receiving e-mail receipts. It is assumed here that the receipts tag is stored in the opt-out array at index 0.

PATCH /identifiers/990000000001 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
Content-Length: 51
Content-Type: application/json-patch+json

[{"op": "remove", "path": "/properties/opt-out/0"}]

A similar effect can be achieved by removing the entire opt-out property. However, this can potentially remove all existing opt-out tags, not just receipts.

PATCH /identifiers/990000000001 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
Content-Length: 49
Content-Type: application/json-patch+json

[{"op": "remove", "path": "/properties/opt-out"}]

As a general rule, in order to create a valid patch document, the identifier should be retrieved first. There are various libraries which can simplify patch creation.

Example response:

HTTP/1.1 204 No Content

Deprecated update method

There is another, deprecated method to update an identifier. It should no longer be used and is only available to support legacy integrations.

Body parameters:

Name

Type

Description

properties

mapping, optional

properties

Body parameters (properties):

Name

Type

Description

opt-out

array of strings, optional

set one or more e-mail opt-out tags

opt-out+=

array of strings, optional

add one or more e-mail opt-out tags

opt-out-=

array of strings, optional

remove one or more e-mail opt-out tags

Example request:

This request will set customer’s name, e-mail address, and will opt them out from receiving e-mail receipts.

PATCH /identifiers/990000000001 HTTP/1.1
Host: api.ereceipts.co.uk
Content-Length: 172
Content-Type: application/json

{
  "properties": {
    "email": "john.smith@example.com",
    "name": {
      "first": "John",
      "last": "Smith"
    },
    "opt-out+=": [
      "receipts"
    ]
  }
}

Example response:

HTTP/1.1 204 No Content