TAG LINE
SMALL TITLE

Update Requests

Last Updated: May 14, 2021

When updating an object you use the update request header with the list of properties to update. Then you need only supply the new values in the body of your request. Please note, this header can only be used with PUT or PATCH requests.

NOTE: As of version 4 of the API an update request filter is no longer required

Update Request

The update request filter is a comma separated array that lists the properties to update. Here is an example:

{
    "filters": [
        "currencyId",
        "name",
        "displayName"
    ]
}

Update Body

The update body contains the new values for the properties.

{
    "displayName": "EuroVision",
    "currencyId": "1",
    "name": "E-1"
}

Putting It All Together

Building on our knowledge of GET requests we note the following differences:

  • Use PATCH or PUT

  • Set request header UpdateRequest to the list of properties to change (no longer required in v4 of APIs)

  • Include the updated properties in the body of the request

The resulting JavaScript XHR code snippet:

xhr.open("PUT","https://35.169.33.81/ResourceServer/api/v1/Account/6");
xhr.setRequestHeader("Accept", "application/json")
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization","Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTUxMiJ9.eyJ1c2VySWQiOiIxNTMiLCJyb2xlSWQiOiIxMjEiLCJpc0ludGVyYWN0aXZlIjoiRmFsc2UiLCJ1bmlxdWVfbmFtZSI6ImFkbWluIiwic3ViIjoiYWRtaW4iLCJhY3RpbmdPd25lcklkIjoiMSIsIm93bmVySWQiOiIxIiwiaXNzIjoiaHR0cDovL2F1dGhvcml6YXRpb25zZXJ2ZXIubG9naXNlbnNlLmNvbSIsImF1ZCI6IjA0NGI4YWQ2MDA2ODQ1YzI5NDQ2YjJmMThlNWI1OTA5IiwiZXhwIjoxNTMzMDQ1NzM3LCJuYmYiOjE1MzI5NTkzMzd9.DMF3VzI65cQf2V1gdd7S4bVMo-PA2JdFLwdwvwCEwNr3lbCjPueOQ9B_qUXJcrM3lMZfMeZ09ZCqS5DLeBnwyg");
xhr.setRequestHeader("UpdateRequest", "{\"filters\":[\"currencyId\",\"name\",\"displayName\"]}");
xhr.send("{\"displayName\": \"EuroVision\", \"currencyId\": \"1\", \"name\": \"E-1\"}");