/codes

Use this endpoint to update the editable properties of a set of existing Codes. For example, you could use this to change the names of Codes, to change several Codes’ parents, or to add or remove the Entities the Codes support.

When constructing your request, note that all editable properties must be specified otherwise it is assumed they should be removed or set to null. For example, if the supportedEntities property is set to null or [] (an empty array) in JSON specifying a Code, all supported Entities are removed from that Code.

Request

Accepts a standard Codes array with each Code object formatted as per PUT /codes/{codeId}. The requirements and limitations of the endpoint are as described there.

The following example modifies the Code created in the POST /codes/batch example by:

  • Changing the name for the first Code
  • Adding searchable-only Entity support for Organizations for the second Code
  • Modifying the description for both Codes
PUT /codes

{
  "codes": [
    {
      "parentCodeID": "1019966",
      "codeId": 1020112,
      "name": "Unions",
      "description": "The tag for describing Labor",
      "supportedEntities": [
        {
          "name": "Contacts",
          "isSearchable": true,
          "isApplicable": true
        },
        {
          "name": "ActivistCodes",
          "isSearchable": true,
          "isApplicable": true
        }
      ],
      "codeType": "Tag"
    },
    {
      "codeId": 1020113,
      "name": "Volunteers",
      "description": "The tab for describing all of our Volunteers",
      "supportedEntities": [
        {
          "name": "Organizations",
          "isSearchable": true,
          "isApplicable": false
        }
      ],
      "codeType": "Tag"
    }
  ]
}

Response

If successful, the endpoint responds with HTTP Status Code 200 OK and an array of results, one for each code updated or attempted, in the same order they were given in the request. Each object will contain the ID of the Code, if successfully updated, and any warning or error messages for that Code.

PropertyTypeDescription
codeIdintThe ID of the Code.
messagestringAny messages or warnings produced during the update of the Code.

Example:

[
    {
        "codeId": 1020112,
        "message": "Forbidden"
    },
    {
        "codeId": 1020113,
        "message": "Completed"
    }
]

If only some Codes are updated, the response will be HTTP Status Code 207 Multi-Status and the same array of results, which can be inspected for per-Code details.

If no Codes are updated, the response will be HTTP Status Code 404 Not Found.

Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!