Execute MDL Script
This synchronous endpoint executes the given MDL script on a Vault. Note that some large operations require use of the asynchronous endpoint.
POST
/api/mdl/executeHeaders
Section link for Headers| Name | Description |
|---|---|
Content-Type | application/json or application/xml |
Accept | application/json (default) or application/xml |
Body Parameters
Section link for Body ParametersThe body of the request should contain the MDL script to execute. Enter the body as raw data. The body must start with one of the following values:
CREATERECREATERENAMEALTERDROP
Learn more in the MDL Commands documentation.
Example Body: RECREATE Picklist
Section link for Example Body: RECREATE PicklistIn this example, we update our picklists using the RECREATE command. If a picklist exists with the name color__c, Vault updates it to conform to the definition provided. If not, Vault creates a new picklist with the definition provided.
Request: RECREATE Picklist
Section link for Request: RECREATE Picklistcurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: application/json" \
--data-raw 'RECREATE Picklist color__c (
label('Color'),
active(true),
Picklistentry red__c(
value('Red'),
order(1),
active(true)
),
Picklistentry blue__c(
value('Blue'),
order(2),
active(true)
),
Picklistentry green__c(
value('Green'),
order(3),
active(true)
)
);' \
https://myvault.veevavault.com/api/mdl/executeResponse: RECREATE Picklist
Section link for Response: RECREATE Picklist{
"responseStatus": "SUCCESS",
"script_execution": {
"code": "GEN-S-0",
"message": "OK",
"warnings": 0,
"failures": 0,
"exceptions": 0,
"components_affected": 1,
"execution_time": 0.028
},
"statement_execution": [
{
"vault": "myvault.veevavault.com",
"statement": 1,
"command": "RECREATE",
"component": "Picklist.color__c",
"message": "[SUCCESS] RECREATE Picklist color__c",
"response": "SUCCESS"
}
]
}Request: RECREATE Java SDK Trigger
Section link for Request: RECREATE Java SDK Triggercurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: application/json" \
--data-raw 'RECREATE Recordtrigger my_custom_trigger_name__c (
active (true),
source_code (<VeevaData>
...
</VeevaData>)
);' \
https://myvault.veevavault.com/api/mdl/executeResponse: RECREATE Java SDK Trigger
Section link for Response: RECREATE Java SDK Trigger{
"responseStatus": "SUCCESS",
"script_execution": {
"code": "GEN-S-0",
"message": "OK",
"warnings": 0,
"failures": 0,
"exceptions": 0,
"components_affected": 1,
"execution_time": 0.026
},
"statement_execution": [
{
"vault": "myvault.veevavault.com",
"statement": 1,
"command": "RECREATE",
"component": "Recordtrigger.my_custom_trigger_name__c",
"message": "[SUCCESS] RECREATE Recordtrigger my_custom_trigger_name__c",
"response": "SUCCESS"
}
]
}Response Details
Section link for Response DetailsOn SUCCESS, the response contains details of the execute.