1003: Update account data

1003: Update account data

Validates that the data complies with possible rules and performs the update if it does. Only the data provided in the payload is updated. The calling application must have permission to update accounts.

When a "verified" data field is updated (for example, the mobile number for an SMS-verified account), a new verification will be triggered. The field will not be changed to the updated value until the verification is completed by calling endpoint 2004: Verify account

Endpoint ID:

1003 

Method:

PUT

URL:

/entity/id/{entity-id}/data/{contract-id}

/entity/ext-key/{ext-key}/{ext-type}/data/{contract-id}



entity-id

Rubiq entity ID that uniquely identifies an account to update



ext-key

External key that uniquely identifies an account to update



ext-type

Type of external key



contract-id

Identifies the set of contract fields passed in the request body. If omitted, the default contract for the particular app is used.

Request body:

JSON data with properties corresponding to the fields in the specified contract. Only the fields included in the JSON payload is affected. Any omitted fields are left unchanged.

Example 1 - Update name and email
{ "name": "John Doe", "email": "mailbox@mailserver.com" }
Response: The details of the updated entity
{ "id": 123456, "name": "John Doe", "email": "mailbox@mailserver.com" }

List fields

When a property is configured as a list field, then a new item can be appended to the list by "updating" it with a new value.

Append a new email address to the list
{ "email": "sales@mailserver.com" }
Response: A new value has been appended to the list
{ "id": 123456, "name": "John Doe", "email": ["mailbox@mailserver.com", "sales@mailserver.com"] }

List fields can be cleared (all items deleted) by updating the property with null or an empty list []:

Empty the list
{ "email": null }
Response: The list has been cleared
{ "id": 123456, "name": "John Doe", "email": [] }

Alternatively, the entire list can be replaced by updating it with a JSON array of values:

Replace the list
{ "email": ["my-address@mail.org", "athome@hotmail.com"] }
Response: The list has been replaced with new values
{ "id": 123456, "name": "John Doe", "email": ["my-address@mail.org", "athome@hotmail.com"] }

Status codes:

200

Account was successfully updated

When verification is enabled, the following sub codes may be returned:

200.1

A verification request has been dispatched

200.2

A verification request has not been dispatched, as the recent verification request limit has been reached

200.3

A verification request has not been dispatched, as a previous verification has been sent within the last 2 minutes, or is still being processed.



400

Request is valid but data validation failed

When the email address is configured to be unique, the following sub code may be returned:

400.2

Email address is not unique

When SMS verification is enabled, the following sub codes may be returned:

400.3

Mobile number is not in a valid format

400.4

Mobile number is not unique (the mobile number belongs to an active entity - this includes entities that have not yet been verified)

400.5

Mobile number is not unique (the mobile number belongs to an inactive entity)



404

Account was not found

The following sub codes may be returned:

404.1

User not found

404.2

External user could not be found



412

App has no permission to update accounts