Class MetaDataRequest
Coverage for all endpoints containing:
- "/metadata/"
- "/configuration/"
- "/mdl/"
MetaData endpoints include all components and object specific components that reside in the Object section of the API documentation. The response formats vary for each meta-data components properties (there are over 35 metadata components). Common/Shared properties are included in the response. Additional properties are parsed in developers reading of JSON/POJO properties.
-
Field Summary
Fields inherited from class com.veeva.vault.vapil.api.request.VaultRequest
HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_REFERENCE_ID, HTTP_HEADER_VAULT_CLIENT_ID, referenceId, requestClientId, vaultClient
-
Method Summary
Modifier and TypeMethodDescriptioncancelRawObjectDeployment
(String objectName) Cancel Raw Object DeploymentExecute MDL ScriptExecute MDL Script AsynchronouslyRetrieve All Component MetadataRetrieve Asynchronous MDL Script ResultsretrieveComponentRecordMdl
(String componentType, String recordName) Retrieve Component Record MDLretrieveComponentRecords
(String component) Retrieve Component Record CollectionretrieveComponentRecordXmlJson
(String componentType, String recordName) Retrieve Component Record XML/JSONretrieveComponentTypeMetadata
(String component) Retrieve Component Type MetadataretrieveContentFile
(String componentType, String recordName) Retrieve Content FileRetrieve Object CollectionretrieveObjectFieldMetaData
(String objectName, String fieldName) Retrieve Object Field MetadataretrieveObjectMetadata
(String objectName) Retrieve Object MetadataretrievePageLayoutMetadata
(String objectName, String layoutName) Retrieve Page Layout MetadataretrievePageLayouts
(String objectName) Retrieve Page LayoutsSet the Header Accept to return CSVsetBinaryFile
(String filename, byte[] binaryContent) Specify source data in an input filesetInputPath
(String inputPath) Specify source data in an input filesetLocalized
(Boolean localized) Set to true to retrieve localized (translated) strings for the label, label_plural, and help_content object fields.setRequestString
(String requestString) Specify source data in an input string, such as a JSON requestUpload Content FileMethods inherited from class com.veeva.vault.vapil.api.request.VaultRequest
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setHeaderClientId, setHeaderReferenceId, setVaultClient
-
Method Details
-
executeMDLScript
Execute MDL ScriptThis endpoint executes the given MDL script on a vault.
- Returns:
- MdlExecuteResponse
- Vault API Endpoint:
POST /api/mdl/execute
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#execute-mdl-script
- Example Request:
MdlExecuteResponse response = vaultClient.newRequest(MetaDataRequest.class) .setRequestString(alterScript) .executeMDLScript();
- Example Response:
System.out.println("Response Status: " + response.getResponseStatus()); System.out.println("Script Execution Code: " + response.getScriptExecution().getCode()); System.out.println("Script Execution Message: " + response.getScriptExecution().getMessage()); System.out.println("Script Execution Components Affected: " + response.getScriptExecution().getWarnings()); System.out.println("Script Execution Execution Time: " + response.getScriptExecution().getExecutionTime()); List<MdlExecuteResponse.StatementExecution> statementExecutions = response.getStatementExecution(); for (MdlExecuteResponse.StatementExecution statementExecution : statementExecutions) { System.out.println("---------Statement Execution---------"); System.out.println("Vault: " + statementExecution.getVault()); System.out.println("Statement: " + statementExecution.getStatement()); System.out.println("Command: " + statementExecution.getCommand()); System.out.println("Component: " + statementExecution.getComponent()); System.out.println("Message: " + statementExecution.getMessage()); }
-
executeMDLScriptAsynchronously
Execute MDL Script AsynchronouslyThis asynchronous endpoint executes the given MDL script on a vault.
While you can execute any MDL script asynchronously, this endpoint is required if you’re operating on 10,000+ high volume object records and executing one of the following operations:
Enabling lifecycles Enabling object types Adding or removing a field Updating the max length of a text field Adding or removing an Index Changing the fields that compose an Index
- Returns:
- MdlExecuteAsyncResponse
- Vault API Endpoint:
POST /api/mdl/execute_asyc
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#execute-mdl-script-asynchronously
- Example Request:
MdlExecuteAsyncResponse resp = vaultClient.newRequest(MetaDataRequest.class) .setRequestString(mdl) .executeMDLScriptAsynchronously();
- Example Response:
System.out.println(resp.getResponseStatus());
-
retrieveAsynchronousMDLScriptResults
Retrieve Asynchronous MDL Script ResultsAfter submitting a request to deploy an MDL script asynchronously, you can query Vault to determine the results of the request.
- Parameters:
jobId
- id of the job executing the MDL script- Returns:
- MdlExecuteResponse
- Vault API Endpoint:
GET /api/mdl/execute_async/{job_id}/results
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-asynchronous-mdl-script-results
- Example Request:
MdlExecuteResponse response = vaultClient.newRequest(MetaDataRequest.class) .retrieveAsynchronousMDLScriptResults(jobId);
- Example Response:
System.out.println("Response Status: " + response.getResponseStatus()); System.out.println("Script Execution Code: " + response.getScriptExecution().getCode()); System.out.println("Script Execution Message: " + response.getScriptExecution().getMessage()); System.out.println("Script Execution Components Affected: " + response.getScriptExecution().getWarnings()); System.out.println("Script Execution Execution Time: " + response.getScriptExecution().getExecutionTime()); List<MdlExecuteResponse.StatementExecution> statementExecutions = response.getStatementExecution(); for (MdlExecuteResponse.StatementExecution statementExecution : statementExecutions) { System.out.println("---------Statement Execution---------"); System.out.println("Vault: " + statementExecution.getVault()); System.out.println("Statement: " + statementExecution.getStatement()); System.out.println("Command: " + statementExecution.getCommand()); System.out.println("Component: " + statementExecution.getComponent()); System.out.println("Message: " + statementExecution.getMessage()); }
-
cancelRawObjectDeployment
Cancel Raw Object DeploymentCancel a deployment of configuration changes to a high volume object. To use this endpoint, your object's configuration_state must be IN_DEPLOYMENT.
- Parameters:
objectName
- of the object being converted to a raw object- Returns:
- VaultResponse
- Vault API Endpoint:
GET /api/metadata/vobjects/{object_name}/actions/canceldeployment
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#cancel-raw-object-deployment
- Example Request:
MdlResponse resp = vaultClient.newRequest(MetaDataRequest.class) .cancelRawObjectDeployment(objectName);
- Example Response:
System.out.println(resp.getResponseStatus());
-
retrieveAllComponentMetadata
Retrieve All Component MetadataRetrieve metadata of all component types in your Vault.
- Returns:
- MetaDataComponentTypeBulkResponse
- Vault API Endpoint:
GET /api/{version}/metadata/components
- Example Request:
MetaDataComponentTypeBulkResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrieveAllComponentMetadata();
- Example Response:
for (ComponentType c : resp.getData()) System.out.println(c.getName() + " s" + c.getLabel());
-
retrieveComponentTypeMetadata
Retrieve Component Type MetadataRetrieve metadata of a specific component type.
- If component parameter is empty, the response will return the metadata of all the components in the Vault.
- Parameters:
component
- to retrieve- Returns:
- MetaDataComponentTypeResponse
- Vault API Endpoint:
GET /api/{version}/metadata/components/{component_type}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-component-type-metadata
- Example Request:
MetaDataComponentTypeResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrieveComponentTypeMetadata(componentName);
- Example Response:
MetaDataComponent comp = resp.getData(); System.out.println("\nName = " + comp.getName()); System.out.println("Class = " + comp.getClassName()); System.out.println("Abbreviation = " + comp.getAbbreviation()); System.out.println("Active = " + comp.getActive()); System.out.println("\nAdditional Properties"); System.out.println("------------------------"); for (String s : comp.getProperties().keySet()) System.out.println(s + " = " + comp.getProperties().get(s)); System.out.println("\nAttributes"); System.out.println("------------------------"); for (Attribute attr : comp.getAttributes()) { System.out.println(attr.getName() + " " + attr.getType()); for (String s : attr.getProperties().keySet()) System.out.println(s + " = " + attr.getProperties().get(s)); } System.out.println("\nSubcomponents"); System.out.println("------------------------"); for (SubComponentType subcomp : comp.getSubComponents()) { System.out.println("\n" + subcomp.getName()); System.out.println(" "); for (Attribute attr : subcomp.getAttributes()) { System.out.println(attr.getName() + " " + attr.getType()); for (String s : attr.getProperties().keySet()) System.out.println(s + " = " + attr.getProperties().get(s)); } }
-
retrieveObjectMetadata
Retrieve Object MetadataRetrieve all metadata configured on a standard or custom Vault Object. Localized strings can be included via the "setLocalized" method in the builder.
- Parameters:
objectName
- Object name to retrieve- Returns:
- MetaDataObjectResponse for single object
- Vault API Endpoint:
GET /api/{version}/metadata/vobjects/{object_name}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-object-metadata
- Example Request:
MetaDataObjectResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrieveObjectMetadata(objectName);
- Example Response:
VaultObject objectMetaData = resp.getObject(); System.out.println("Name = " + objectMetaData.getName()); System.out.println("Help = " + objectMetaData.getHelpContent()); System.out.println("Label = " + objectMetaData.getLabel()); System.out.println("URL Field = " + objectMetaData.getUrls().getField()); System.out.println("URL Record = " + objectMetaData.getUrls().getRecord()); System.out.println("URL List = " + objectMetaData.getUrls().getList()); System.out.println("UserRoleSetupObject = " + objectMetaData.getUserRoleSetupObject()); if (objectMetaData.getAvailableLifecycles() != null) { for (String s : objectMetaData.getAvailableLifecycles()) System.out.println("Lifecycle = " + s); } if (objectMetaData.getRelationships() != null) { for (Object.Relationship relationship : objectMetaData.getRelationships()) System.out.println("Relationship = " + relationship.getRelationshipName() + " " + relationship.getField() + " " + relationship.getObjectReference().getName()); } if (objectMetaData.getUserRoleSetupObject() != null) { System.out.println("UserRoleSetupObject URL " + objectMetaData.getUserRoleSetupObject().getUrl()); System.out.println("UserRoleSetupObject Name " + objectMetaData.getUserRoleSetupObject().getName()); System.out.println("UserRoleSetupObject Label " + objectMetaData.getUserRoleSetupObject().getLabel()); }
-
retrieveObjectFieldMetaData
Retrieve Object Field MetadataLocalized strings can be included via the "setLocalized" method in the builder
- Parameters:
objectName
- Object name to retrievefieldName
- Field name to retrieve- Returns:
- MetaDataObjectFieldResponse
- Vault API Endpoint:
GET /api/{version}/metadata/vobjects/{object_name}/fields/{object_field_name}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-object-field-metadata
- Example Request:
MetaDataObjectFieldResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrieveObjectFieldMetaData(objectName, fieldName);
- Example Response:
VaultObjectField fieldMetaData = resp.getField(); System.out.println("Name = " + fieldMetaData.getName()); System.out.println("Label = " + fieldMetaData.getLabel()); System.out.println("Required = " + fieldMetaData.getRequired()); System.out.println("Help = " + fieldMetaData.getHelpContent()); System.out.println("Relationship Name = " + fieldMetaData.getLookupRelationshipName()); if (fieldMetaData.getObjectReference() != null) { System.out.println("Object referencer URL " + fieldMetaData.getObjectReference().getUrl()); System.out.println("Object referencer Name " + fieldMetaData.getObjectReference().getName()); System.out.println("Object referencer Label " + fieldMetaData.getObjectReference().getLabel()); }
-
retrieveObjectCollection
Retrieve Object CollectionLocalized strings can be included via the "setLocalized" method in the builder
- Returns:
- MetaDataObjectBulkResponse for all objects
- Vault API Endpoint:
GET /api/{version}/metadata/vobjects
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-object-collection
- Example Request:
MetaDataObjectBulkResponse resp = vaultClient.newRequest(MetaDataRequest.class).retrieveObjectCollection();
- Example Response:
for (Object c : resp.getObjects()) { System.out.println(c.getName() + " " + c.getLabel() + " " + c.getUrl()); }
-
retrieveComponentRecords
Retrieve Component Record CollectionRetrieve all records for a specific component type.
- Parameters:
component
- to retrieve- Returns:
- MetaDataComponentTypeBulkResponse
- Vault API Endpoint:
GET /api/{version}/configuration/{component_type}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#component-record-collection
- Example Request:
MetaDataComponentTypeBulkResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrieveComponentRecords(componentType);
- Example Response:
if (resp.isSuccessful()) { for (ComponentType componentType : resp.getData()) { System.out.println(component.getName()); } }
-
retrieveComponentRecordXmlJson
public MetaDataComponentRecordResponse retrieveComponentRecordXmlJson(String componentType, String recordName) Retrieve Component Record XML/JSON- Parameters:
componentType
- The component type name (Picklist, Docfield, Doctype, etc.)recordName
- The name of the record to retrieve metadata- Returns:
- MetaDataComponentRecordResponse
- Vault API Endpoint:
GET /api/{version}/configuration/{component_type}.{record_name}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-component-record-xml-json
- Example Request:
MetaDataComponentRecordResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrieveComponentRecordXmlJson(componentType, recordName);
- Example Response:
if (resp.isSuccessful()) { System.out.println(resp.getData().getName()); }
-
retrieveComponentRecordMdl
Retrieve Component Record MDL- Parameters:
componentType
- The component type name (Picklist, Docfield, Doctype, etc.)recordName
- The name of the record to retrieve metadata- Returns:
- MdlResponse
- Vault API Endpoint:
GET /api/mdl/components/{component_type}.{record_name}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-component-record-mdl
- Example Request:
MdlResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrieveComponentRecordMdl("Picklist","test__c");
- Example Response:
if (resp.isSuccessful()) { System.out.println(new String(resp.getBinaryContent())); }
-
uploadContentFile
Upload Content FileThis 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.
- Returns:
- ComponentContentResponse
- Vault API Endpoint:
POST /api/mdl/files
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#upload-content-file
-
retrieveContentFile
Retrieve Content File- Parameters:
componentType
- vault component typerecordName
- api name of component- Returns:
- ComponentContentResponse
- Vault API Endpoint:
GET /api/mdl/components/{component_type}.{record_name}/files
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-content-file
-
retrievePageLayouts
Retrieve Page LayoutsGiven an object, retrieve all page layouts associated with that object.
- Parameters:
objectName
- Vault object name- Returns:
- MetaDataObjectPageLayoutResponse
- Vault API Endpoint:
GET /api/{version}/metadata/vobjects/{object_name}/page_layouts
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-page-layouts
- Example Request:
MetaDataObjectPageLayoutResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrievePageLayouts("user__sys");
- Example Response:
if (resp.isSuccessful()) { System.out.println(resp.getData().get(0).getName()); }
-
retrievePageLayoutMetadata
public MetaDataObjectPageLayoutResponse retrievePageLayoutMetadata(String objectName, String layoutName) Retrieve Page Layout MetadataGiven a page layout name, retrieve the metadata for that specific page layout.
- Parameters:
objectName
- Vault object namelayoutName
- Vault page layout name- Returns:
- MetaDataObjectPageLayoutResponse
- Vault API Endpoint:
GET /api/{version}/metadata/vobjects/{object_name}/page_layouts/{layout_name}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.2/#retrieve-page-layout-metadata
- Example Request:
MetaDataObjectPageLayoutResponse resp = vaultClient.newRequest(MetaDataRequest.class) .retrievePageLayoutMetadata("user__sys", "user_detail_page_layout__c");
- Example Response:
System.out.println(resp.getResponseStatus());
-
setAcceptJSON
Set the Header Accept to return CSV- Returns:
- The Request
-
setBinaryFile
Specify source data in an input file- Parameters:
filename
- file name (no path)binaryContent
- byte array of the file content- Returns:
- The Request
-
setLocalized
Set to true to retrieve localized (translated) strings for the label, label_plural, and help_content object fields.- Parameters:
localized
- True for localized strings- Returns:
- The request
-
setInputPath
Specify source data in an input file- Parameters:
inputPath
- Absolute path to the file for the request- Returns:
- The Request
-
setRequestString
Specify source data in an input string, such as a JSON request- Parameters:
requestString
- The source request as a string- Returns:
- The Request
-