Upload Content File
This endpoint allows you to upload a content file to be referenced by a component.
Once uploaded, Vault stores the file in a generic files staging area where they will remain until referenced by a component. Once referenced, Vault cannot access the named file from the staging area.
POST
/api/mdl/filesHeaders
Section link for Headers| Name | Description |
|---|---|
Content-Type | multipart/form-data (default) or application/x-www-form-urlencoded |
Accept | application/json (default) or application/xml |
Request
Section link for Requestcurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: multipart/form-data" \
-F 'file=@C:\Quote.pdf'
https://myvault.veevavault.com/api/mdl/filesResponse
Section link for Response{
"responseStatus": "SUCCESS",
"data": {
"name__v": "4be398c32fc2ccf48adaf6ebe53782a1",
"format__v": "application/pdf",
"size__v": 4716,
"sha1_checksum__v": "4be398c32fc2ccf48adaf6ebe53782a1"
}
}Example Body: Reference Named File
Section link for Example Body: Reference Named FileRECREATE Formattedoutput my_formatted_output__c (
label(‘My Formatted Output’),
active(true),
root_object('Object.product__v'),
root_object_type('Objecttype.product__v.base__v'),
output_type('native'),
template('4be398c32fc2ccf48adaf6ebe53782a1')
);Response Details
Section link for Response DetailsOn SUCCESS, the response includes the following:
| Name | Description |
|---|---|
name__v | The name of the file which can be used in MDL for referencing the component. |
format__v | The format of the file. |
size__v | The file size of the file. |
sha1_checksum__v | The SHA-1 checksum value generated for the file. Use the checksum to ensure the file was transmitted correctly. |
Reference Named File
Section link for Reference Named FileAfter uploading a content file, you can reference the file by name using the file or template attributes in your MDL statement. This example uses the template attribute.
To change a component file, you must first upload it and update the component to reference the new file.