Skip to content

Redaction API

This API can be used to change the current and historic values of fields.

Redactions must be enabled for the layer. On a site or layer without them, the endpoints return 404 with {"detail": "Service not enabled."} or, when creating, 400 with a redactions_enabled error asking you to contact support. The same endpoints are available under /tables/{id}/redactions/.

GET/layers/{id}/redactions/Displays list of redactions

Displays a detailed list of redactions for the layer.

Response 200

Headers

Content-Type: application/json

Body

[
{
"id": 789,
"url": "https://{domain}/services/api/v1.x/layers/123/redactions/789/",
"primary_key": {
"ID": 9876
},
"start_version": "https://{domain}/services/api/v1.x/layers/123/versions/456/",
"end_version": "https://{domain}/services/api/v1.x/layers/123/versions/457/",
"message": "Changed description for ID 9876",
"created_by": {
"id": 1,
"first_name": "Billy",
"last_name": "Jean"
},
"created_at": "2014-02-03T04:00:00Z",
"applied_at": "2014-02-03T05:00:00Z",
"applied_version": "https://{domain}/services/api/v1.x/layers/123/versions/457/",
"completed_version": "https://{domain}/services/api/v1.x/layers/123/versions/458/",
"error": "Possible error messages",
"status": "NEW"
}
]
POST/layers/{id}/redactions/Creates new redaction for layer

Creates a new redaction for layer {id}.

Note that start_version <= affected versions <= end_version.

  • primary_key: The primary key(s) for the item being redacted. This should identify a single feature.
  • start_version: The URL of the first layer version to perform the redaction on.
  • end_version: (Optional) The URL of the last layer version to perform the redaction on.
  • new_values: The new values for the row. This can be any subset of fields and only specified fields will be redacted.
  • message: A message to be stored with the redaction.

Request

Headers

Content-Type: application/json

Body

{
"primary_key": {
"ID": 9876
},
"start_version": "https://{domain}/services/api/v1.x/layers/123/versions/456/",
"end_version": "https://{domain}/services/api/v1.x/layers/123/versions/457/",
"new_values": {
"description": "This will be the new description"
},
"message": "Changed description for ID 9876"
}

Response 202

Headers

Content-Type: application/json
Location: "https://{domain}/services/api/v1.x/layers/123/redactions/789/"

Body

{
"id": 789,
"url": "https://{domain}/services/api/v1.x/layers/123/redactions/789/",
"primary_key": {
"ID": 9876
},
"start_version": "https://{domain}/services/api/v1.x/layers/123/versions/456/",
"end_version": "https://{domain}/services/api/v1.x/layers/123/versions/457/",
"new_values": {
"description": "This will be the new description"
},
"message": "Changed description for ID 9876",
"created_by": {
"id": 1,
"first_name": "Billy",
"last_name": "Jean"
},
"created_at": "2014-02-03T04:00:00Z",
"applied_at": "2014-02-03T05:00:00Z",
"applied_version": "https://{domain}/services/api/v1.x/layers/123/versions/457/",
"completed_version": "https://{domain}/services/api/v1.x/layers/123/versions/458/",
"error": "Possible error messages",
"status": "NEW"
}

Response 400

Headers

Content-Type: application/json

Body

{
"start_version": [
"This field is required."
]
}

Any other field with a problem is listed the same way, with a message describing the problem.

GET/layers/{id}/redactions/{redaction}/Gets information about specific redaction

Response 200

Headers

Content-Type: application/json

Body

{
"id": 789,
"url": "https://{domain}/services/api/v1.x/layers/123/redactions/789/",
"primary_key": {
"ID": 9876
},
"start_version": "https://{domain}/services/api/v1.x/layers/123/versions/456/",
"end_version": "https://{domain}/services/api/v1.x/layers/123/versions/457/",
"message": "Changed description for ID 9876",
"created_by": {
"id": 1,
"first_name": "Billy",
"last_name": "Jean"
},
"created_at": "2014-02-03T04:00:00Z",
"applied_at": "2014-02-03T05:00:00Z",
"applied_version": "https://{domain}/services/api/v1.x/layers/123/versions/457/",
"completed_version": "https://{domain}/services/api/v1.x/layers/123/versions/458/",
"error": "Possible error messages",
"status": "NEW"
}