Editing a Slate
Editing a slate is accomplished by sending JSON patch documents to the API.
Info
For more information on what JSON patch is, and how it works, see: http://jsonpatch.com
When you edit the slate, you'll need detailed information about the slate, such as field identifiers (UUIDs), etc. You can get the full slate first, then perform updates on it. Get-Slate endpoint details are here
Request
PATCH /v2.0/resources/slate/{slate-uuid}
Authorization
Required. Allowed authorization schemes:
| Authorization Scheme | Supported |
|---|---|
| JWT | |
| API Key |
Headers
| Header | Required | Notes |
|---|---|---|
Content-Type: application/json |
required |
Query Parameters
| Query Parameter | Required | Notes |
|---|---|---|
account-uuid |
required only when using JWT authentication. When using API Key, do not include this query parameter | |
include-resource-in-response=true |
optional | If specified, the full slate (updated) will be returned in the result |
Body
The root JSON data structure must be an array. Contained within it must be 0 or more JSON patch documents.
[
{
"op": "<operation>",
"path": "<path-to-perform-patch-operation>",
"value": "<patch-value-to-apply>"
},
{ ... },
{ ... }
]
JSON Patch
When sending modifications to a slate, each modification is sent as a ‘patch’ to the original data structure. The three attributes, op, path, and value must be provided.
op
Operation can be either add, replace, or remove
path
Typically you will be modifying field values on a slate. To target a field’s value as the path of a patch operation, use the following syntax for path:
/fields/{field-uuid}/value
This is applicable to most fields where the value is directly represented by the attribute value in the slate field data structure. Some fields, however, have slightly different attributes. For example, a Location/GPS field has three attributes: lat, lng, and address. Here is an example of updating the address for a location field:
/fields/{field-uuid}/address
This same concept can be applied to changing other features of a field, such as options or settings (what we often refer to as configuration of the slate, or ‘designing’ the slate).
value
The value provided must be the exact same format that you would expect that value if you were read it from the slate. For example, for Text fields, provide a text value. For Boolean fields, provide a boolean true or false value, instead of text:
[
{
"op": "replace",
"path": "/fields/{field-uuid-of-text-field}/value",
"value": "my new value"
},
{
"op": "replace",
"path": "/fields/{field-uuid-of-boolean-field}/value",
"value": false
}
]
Removing a field from a slate
To remove a field from a slate, send a remove patch request like so:
[
{
"op": "remove",
"path": "/fields/{field-uuid-to-remove}",
"value": null
}
]
Response
| Response | Status Code | More Information |
|---|---|---|
| Success | 200 |
Successful response body details below |
| Validation Failed | 422 |
more info |
| Internal Server Error | 500 |
more info |
Headers
| Header | Frequency | Notes |
|---|---|---|
Authorization |
sometimes | if using JWT authorization scheme |
Body
{
"data": {
...slate details
},
"correlationUUID": "<correlation-uuid>"
}