PATCHing documents

Use the following to PATCH documents:

  • PATCH /common/v1/documents/{documentId}

Logically speaking, a PATCH call can modify only the metadata of a document, only the content of a document, or both.

PATCHing only metadata

If you want to PATCH only the metadata of a document, your call must specify the new metadata, but it can omit information about the content.

You can submit the call as a FormData object. For example, the following call updates the metadata for document xc:127.

Command
PATCH /common/v1/documents/xc:127

Request body

METADATA:
{
    "data": {
        "attributes": {
            "status": {
                "code": "final"
            }
        }
    }
}

(No contents included with the call)

You can also submit a metadata-only PATCH using a request body that is formatted as JSON (as opposed to FormData). For more information, see Sending document metadata only using JSON.

PATCHing only content

If you want to PATCH only the content of a document, your call must specify the new content. It must also specify a metadata key/value, but the value must consist of a body with no specified attributes.

PATCHes to content are destructive, not additive. If you specify content, the new content replaces the previous content entirely.

For example, the following call updates the entire content for document xc:127 (without changing any of the metadata).

Command
PATCH /common/v1/documents/xc:127

Request body

METADATA:
{
    "data": {
        "attributes": {
            }
        }
    }
}

<contents of "Property Assessment Report.pdf" file>

PATCHing both metadata and content

If you want to PATCH both the metadata and the content of a document, your call must specify the new metadata and the new content.

PATCHes to content are destructive, not additive. If you specify content, the new content replaces the previous content entirely.

For example, the following call updates the metadata and the entire content for document xc:127.

Command

PATCH /common/v1/documents/xc:127

Request body

METADATA:
{
    "data": {
        "attributes": {
            "status": {
                "code": "final"
            }
        }
    }
}

<contents of "Property Assessment Report.pdf" file>

When PATCHing documents, note the following:

  • You cannot PATCH documents that have a status of final.
  • If a document has a non-null value for pendingDocUID, you cannot specify dms or docUID.