Create Multiple Document Relationships
Create new relationships on multiple documents.
- The maximum input file size is 1GB.
- The values in the input must be UTF-8 encoded.
- CSVs must follow the standard RFC 4180 format, with some exceptions.
- The maximum batch size is 1000.
You cannot create or delete standard relationship types. Examples of standard relationship types include Based On and Original Source. Learn about document relationships in Vault Help
POST
/api/{version}/objects/documents/relationships/batchHeaders
Section link for Headers| Name | Description |
|---|---|
Content-Type | application/json or text/csv |
Accept | application/json (default) or text/csv |
X-VaultAPI-MigrationMode | When set to true, creates a document relationship in migration mode. You must have the Document Migration permission to use this header. Learn more about Document Migration Mode in Vault Help |
Body Parameters
Section link for Body ParametersCreate a JSON or CSV input file. There are multiple ways to create document relationships. The following standard fields are required to create document relationships.
| Name | Description |
|---|---|
source_doc_id__vrequired | Document id value of the document on which the relationship is being created. |
target_doc_id__vrequired | Document id value of the document which is being associated with the source document as a related document. |
relationship_type__vrequired | The type of relationship the target document will have with the source document. |
Create Source Version-Specific Relationships
Section link for Create Source Version-Specific RelationshipsThe following fields are required when creating a source version-specific relationship.
| Name | Description |
|---|---|
source_major_version__vrequired | The major version number of the source document. |
source_minor_version__vrequired | The minor version number of the source document. |
relationship_type__vrequired | The type of relationship the target document will have with the source document. |
Create Target Version-Specific Relationships
Section link for Create Target Version-Specific RelationshipsThe following fields are required when creating a target version-specific relationship.
| Name | Description |
|---|---|
target_major_version__vrequired | The major version number of the target document to which the source document will be bound. |
target_minor_version__vrequired | The minor version number of the target document to which the source document will be bound. |
relationship_type__vrequired | The type of relationship the target document will have with the source document. |
Query Parameters
Section link for Query Parameters| Name | Description |
|---|---|
idParam | To create relationships based on an unique field, set idParam to a unique field name. You can use any object field which has unique set to true in the object metadata, with the exception of picklists. For example, idParam=external_id__v. You must then set Content-Type to text/csv and include your field name as a column. |
Request
Section link for Requestcurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: text/csv" \
-H "Accept: text/csv" \
--data-raw 'id,source_doc_id__v,source_major_version__v,source_minor_version__v,target_doc_id__v,relationship_type__v
7,17,1,6,42,supporting_documents__c
8,17,0,1,40,supporting_documents__c' \
https://myvault.veevavault.com/api/v26.1/objects/documents/relationships/batchResponse
Section link for Response{
"responseStatus": "SUCCESS",
"data": [
{
"responseStatus": "SUCCESS",
"id": 10
},
{
"responseStatus": "SUCCESS",
"id": 11
},
]
}Response Details
Section link for Response DetailsOn SUCCESS, Vault returns the IDs of the newly created document relationships.