### Authentication Response Example Source: https://developer.veevavault.com/docs A sample JSON response returned by the Vault API after an authentication request. It includes the session ID, user ID, and a list of available vault IDs. ```json { "responseStatus": "SUCCESS", "sessionId": "C7EFE4B29EF9914B170BAA01F232B462BE5ACB82F6704FDA2162B", "userId": 12021, "vaultIds": [ { "id": 1776, "name": "PromoMats", "url": "https://my2016vault.veevavault.com/api" }, { "id": 1777, "name": "eTMF", "url": "https://my2019vault.veevavault.com/api" }, { "id": 1779, "name": "QualityDocs", "url": "https://qualitydocs-veevapharm.veevavault.com/api" } ], "vaultId": 1776 } ``` -------------------------------- ### Get All Objects Source: https://developer.veevavault.com/docs Retrieves a list of all objects defined within your Veeva Vault. ```APIDOC ## GET /api/{version}/metadata/vobjects ### Description Fetches a list of all objects configured in the Vault, providing their names, labels, and other metadata. ### Method GET ### Endpoint /api/{version}/metadata/vobjects ### Parameters None ### Request Example ```bash curl -X GET -H "Authorization: {SESSION_ID}" \ https://{server}/api/{version}/metadata/vobjects ``` ### Response #### Success Response (200) - **objects** (array) - A list of object metadata. - **url** (string) - The API endpoint for the specific object. - **label** (string) - The display name of the object. - **name** (string) - The internal name of the object. - **label_plural** (string) - The plural display name of the object. - **prefix** (string) - The object's prefix. - **order** (integer) - The display order of the object. - **in_menu** (boolean) - Whether the object appears in the main menu. - **source** (string) - The source of the object definition. - **status** (array) - The status of the object. #### Response Example ```json { "responseStatus": "SUCCESS", "objects": [ { "url": "/api/v17.1/metadata/vobjects/product__v", "label": "Product", "name": "product__v", "label_plural": "Products", "prefix": "00P", "order": 2, "in_menu": true, "source": "standard", "status": [ "active__v" ] } ] } ``` ``` -------------------------------- ### Example JSON Response for Session ID Source: https://developer.veevavault.com/docs This is an example of the JSON data structure that Vault returns when a session ID is requested via postMessage. It contains a message ID and the session data, including the actual session ID. ```json {"message_id":"session_id","data": {"session_id":"9DA3848FF39392020…"}} ``` -------------------------------- ### Get Object Metadata Source: https://developer.veevavault.com/docs Retrieves detailed metadata for a specific object, including its fields. ```APIDOC ## GET /api/{version}/metadata/vobjects/{objectName} ### Description Fetches detailed metadata for a specified object, including all its fields, their types, and configuration. ### Method GET ### Endpoint /api/{version}/metadata/vobjects/{objectName} ### Parameters #### Path Parameters - **objectName** (string) - Required - The name of the object to retrieve metadata for (e.g., `product__v`). ### Request Example ```bash curl -X GET -H "Authorization: {SESSION_ID}" \ https://{server}/api/{version}/metadata/vobjects/product__v ``` ### Response #### Success Response (200) - **url** (string) - The API endpoint for the specific object. - **label** (string) - The display name of the object. - **name** (string) - The internal name of the object. - **label_plural** (string) - The plural display name of the object. - **prefix** (string) - The object's prefix. - **order** (integer) - The display order of the object. - **in_menu** (boolean) - Whether the object appears in the main menu. - **source** (string) - The source of the object definition. - **status** (array) - The status of the object. - **fields** (array) - A list of fields within the object. - **name** (string) - The internal name of the field. - **scope** (string) - The scope of the field (e.g., `DocumentVersion`). - **type** (string) - The data type of the field (e.g., `String`, `ObjectReference`). - **required** (boolean) - Whether the field is mandatory. - **maxLength** (integer) - Maximum length for string fields. - **repeating** (boolean) - Whether the field can have multiple values. - **systemAttribute** (boolean) - Indicates if it's a system-defined attribute. - **editable** (boolean) - Whether the field can be edited. - **label** (string) - The display name of the field. - **section** (string) - The section where the field appears. - **sectionPosition** (integer) - The position of the field within its section. - **hidden** (boolean) - Whether the field is hidden. - **queryable** (boolean) - Whether the field can be queried. - **shared** (boolean) - Whether the field is shared across types. - **helpContent** (string) - Help text for the field. - **definedInType** (string) - The type where the field is defined. - **definedIn** (string) - The parent definition of the field. - **objectType** (string) - The referenced object type for `ObjectReference` fields. - **relationshipType** (string) - The type of relationship for `ObjectReference` fields. - **relationshipName** (string) - The name of the relationship for `ObjectReference` fields. #### Response Example ```json { "url": "/api/v17.1/metadata/vobjects/product__v", "label": "Product", "name": "product__v", "label_plural": "Products", "prefix": "00P", "order": 2, "in_menu": true, "source": "standard", "status": [ "active__v" ], "fields": [ { "name": "name__v", "scope": "DocumentVersion", "type": "String", "required": true, "maxLength": 100, "repeating": false, "systemAttribute": true, "editable": true, "setOnCreateOnly": false, "disabled": false, "label": "Name", "section": "generalProperties", "sectionPosition": 0, "hidden": false, "queryable": true, "shared": false, "helpContent": "Displayed throughout application for the document, including in Library, Reporting, Notifications and Workflows.", "definedInType": "type", "definedIn": "base_document__v" } ] } ``` ``` -------------------------------- ### Document Metadata API - Get Properties Source: https://developer.veevavault.com/docs This endpoint retrieves a list of all fields defined on documents, including their metadata attributes such as name, type, and queryability. ```APIDOC ## GET /api/{version}/metadata/objects/documents/properties ### Description Retrieves a comprehensive list of fields and their metadata defined for documents within Vault. ### Method GET ### Endpoint /api/{version}/metadata/objects/documents/properties ### Parameters #### Headers - **Authorization** (string) - Required - The session ID for authentication. ### Request Example ```curl curl -X GET -H "Authorization: {SESSION_ID}" \ https://{server}/api/{version}/metadata/objects/documents/properties ``` ### Response #### Success Response (200) - **responseStatus** (string) - The status of the response, e.g., "SUCCESS". - **properties** (array) - An array of field metadata objects. - **name** (string) - The name of the field. - **type** (string) - The data type of the field. - **required** (boolean) - Indicates if the field is mandatory. - **maxLength** (integer) - The maximum length for string fields. - **minValue** (number) - The minimum value for numeric fields. - **maxValue** (number) - The maximum value for numeric fields. - **repeating** (boolean) - Indicates if the field can have multiple values. - **systemAttribute** (boolean) - Indicates if the field is controlled by the system. - **editable** (boolean) - Indicates if the field can be modified. - **setOnCreateOnly** (boolean) - Indicates if the field can only be set during creation. - **disabled** (boolean) - Indicates if the field is disabled. - **hidden** (boolean) - Indicates if the field is hidden. - **queryable** (boolean) - Indicates if the field can be used in queries. #### Response Example ```json { "responseStatus": "SUCCESS", "properties": [ { "name": "id", "type": "id", "required": true, "maxLength": 20, "minValue": 0, "maxValue": 9223372036854775807, "repeating": false, "systemAttribute": true, "editable": false, "setOnCreateOnly": true, "disabled": false, "hidden": true, "queryable": true }, { "name": "version_id", "scope": "DocumentVersion", "type": "id", "required": true, "maxLength": 20, "minValue": 0, "maxValue": 9223372036854775807, "repeating": false, "systemAttribute": true, "editable": false, "setOnCreateOnly": true, "disabled": false, "hidden": true, "queryable": true } ] } ``` ``` -------------------------------- ### GET /api/v1/safety-case Source: https://developer.veevavault.com/docs/sample-files/safety-sample-intake-json.json Retrieves the full structured data for a specific safety case, including patient details, adverse events, and medical history. ```APIDOC ## GET /api/v1/safety-case ### Description Retrieves the comprehensive structured data for a safety case, including patient information, products, adverse events, and test results. ### Method GET ### Endpoint /api/v1/safety-case ### Parameters #### Query Parameters - **case_id** (string) - Required - The unique identifier for the safety case. ### Request Example GET /api/v1/safety-case?case_id=HC-4567777 ### Response #### Success Response (200) - **data** (object) - Contains structured objects for detail, patient, case_product, case_adverse_event, case_test_result, and parental_case. #### Response Example { "data": { "patient": { "structured": [ { "mrn_hospital_value__v": "MRN-123", "gender_value__v": "Female" } ] } } } ``` -------------------------------- ### Document Field Metadata Structure Source: https://developer.veevavault.com/docs An example JSON representation of a document field's metadata, specifically the 'id' field. This illustrates how attributes like 'editable', 'required', and 'queryable' define field behavior. ```json { "name": "id", "type": "id", "required": true, "maxLength": 20, "minValue": 0, "maxValue": 9223372036854775807, "repeating": false, "systemAttribute": true, "editable": false, "setOnCreateOnly": true, "disabled": false, "hidden": true, "queryable": true } ``` -------------------------------- ### GET /api/{version}/services/jobs/{job_id} Source: https://developer.veevavault.com/docs Retrieves the status of a specific job. This endpoint is subject to a specific rate limit of one call every 10 seconds. ```APIDOC ## GET /api/{version}/services/jobs/{job_id} ### Description Retrieves the status of a background job. Note that this endpoint is strictly rate-limited to one request every 10 seconds. ### Method GET ### Endpoint /api/{version}/services/jobs/{job_id} ### Parameters #### Path Parameters - **version** (string) - Required - The API version (e.g., v21.1) - **job_id** (string) - Required - The unique identifier of the job ### Response #### Success Response (200) - **status** (string) - The current status of the job #### Error Response (429) - **error** (string) - Returns 'API_LIMIT_EXCEEDED' if called more than once every 10 seconds. ``` -------------------------------- ### File Staging for Inputs Source: https://developer.veevavault.com/docs Learn how to use file staging for bulk creation APIs by referencing files in your input JSON or CSV. ```APIDOC ## File Staging for Inputs ### Description Bulk creation APIs require input files (JSON or CSV) that reference source files on file staging. This section explains how to prepare and reference these files. ### How to Reference Files 1. Use `Create Folder or File` or `Update Folder or File` APIs to manage your file staging directory structure. 2. Upload files using `Create Folder or File` (up to 50MB) or a `Resumable Upload Session` (over 50MB). 3. Add a `file` column to your input and specify the file path relative to the root (e.g., `Feb-2016-Batch/Gludacta_Brochure.pdf`). ### Creating Staged Documents Files uploaded to the `_Inbox` directory (located at `/u{user_id}/Inbox` or `/Inbox`) are automatically created as _Staged_ documents. ``` -------------------------------- ### Create Documents using CSV Input (CLI) Source: https://developer.veevavault.com/docs This snippet shows how to create multiple documents using the Vault Loader Command Line Interface. It takes a CSV file as input and processes the document creation commands. This method is an alternative to using the API directly. ```bash java -jar VaultDataLoader.jar -createdocuments -csv create_documents.csv ``` -------------------------------- ### POST /api/v15.0/objects/documents/batch Source: https://developer.veevavault.com/docs Creates multiple documents in bulk by providing a CSV file with document details and source file locations. This endpoint also copies source files from File Staging to your Vault and sets the data attributes for the documents. ```APIDOC ## POST /api/v15.0/objects/documents/batch ### Description Creates multiple documents in bulk. Requires a CSV input file containing document details such as file name, name, type, lifecycle, and rendition suppression. Source files are expected to be in File Staging. ### Method POST ### Endpoint /api/v15.0/objects/documents/batch ### Parameters #### Request Body - **CSV Input**: A CSV file with the following columns: - `file` (string) - Optional - The name of the source file in File Staging. - `name__v` (string) - Required - The name of the document. - `type__v` (string) - Required - The document type. - `lifecycle__v` (string) - Required - The document lifecycle. - `suppressRendition` (boolean) - Optional - If true, suppresses rendition generation until the document is viewed. ### Request Example Using curl: ```bash curl -X POST -H "Authorization: {SESSION_ID}" \ -H "Content-Type: text/csv" \ -H "Accept: text/csv" \ --data-binary @"C:\Vault\Documents\create_documents.csv" \ https://myvault.veevavault.com/api/v15.0/objects/documents/batch ``` CSV Input Example: ```csv file,name__v,type__v,lifecycle__v,suppressRendition doc1.txt,doc1,type,eTMF Lifecycle,true doc2.txt,doc2,type,eTMF Lifecycle,true doc3.txt,doc3,type,eTMF Lifecycle,true ``` ### Response #### Success Response (200) - **responseStatus** (string) - Indicates the status of the operation (e.g., SUCCESS). - **id** (string) - The system-generated ID for the created document. - **name__v** (string) - The name of the document. - **type__v** (string) - The type of the document. - **lifecycle__v** (string) - The lifecycle of the document. - **errors** (string) - Contains error details if the operation failed for a specific row. - **row_id** (string) - The original row number from the input CSV. #### Response Example ```csv responseStatus,id,name__v,type__v,lifecycle__v,errors,row_id SUCCESS,1634,,,,,1 SUCCESS,1635,,,,,2 SUCCESS,1636,,,,,3 ``` ``` -------------------------------- ### File Staging for Extracts Source: https://developer.veevavault.com/docs Understand how to retrieve files extracted by Vault using the Download Item Content API. ```APIDOC ## File Staging for Extracts ### Description When Vault exports files (e.g., via `Export Documents API`), references to these files are included in the CSV output. This section details how to retrieve these extracted files using the `Download Item Content API`. ### Retrieving Extracted Files 1. Locate the `file` column in the CSV output from your export. This column contains the filename and path relative to file staging's root. 2. Use this path in the `item` parameter of the `Download Item Content API` to retrieve the source files. ### Benefits of Download Item Content API - Does not impact end-user performance. - Supports resumable downloads for large files or interrupted sessions. - Allows scaling downloads with up to 10 concurrent threads. ### File Deletion Extracted files and folders on file staging are automatically deleted every 72 hours by default. This does not apply to user-uploaded files. ``` -------------------------------- ### CSV Input for Document Creation Source: https://developer.veevavault.com/docs This is a sample CSV file format used for bulk document creation. It includes columns for the source file name, document name, document type, lifecycle, and an option to suppress rendition generation. ```csv file,name__v,type__v,lifecycle__v,suppressRendition doc1.txt,doc1,type,eTMF Lifecycle,true doc2.txt,doc2,type,eTMF Lifecycle,true doc3.txt,doc3,type,eTMF Lifecycle,true ``` -------------------------------- ### Create Documents using CSV Input (API) Source: https://developer.veevavault.com/docs This snippet demonstrates how to create multiple documents by sending a CSV file containing document details to the Vault API. It requires a session ID for authentication and specifies the content type as CSV. The response includes success status, generated IDs, and row mapping. ```bash curl -X POST -H "Authorization: {SESSION_ID}" \ -H "Content-Type: text/csv" \ -H "Accept: text/csv" \ --data-binary @"C:\Vault\Documents\create_documents.csv" \ https://myvault.veevavault.com/api/v15.0/objects/documents/batch ``` -------------------------------- ### Vault Loader CLI - Create Documents Source: https://developer.veevavault.com/docs Utilizes the Vault Loader Command Line Interface to create documents in bulk. This method requires a CSV file for input and can be run in asynchronous mode for background processing. ```APIDOC ## Vault Loader CLI - Create Documents ### Description Creates documents in bulk using the Vault Loader Command Line Interface. This is an alternative to the API endpoint for document creation, offering flexibility with asynchronous execution. ### Method Command Line Interface ### Endpoint N/A (Local execution) ### Parameters #### Command Line Arguments - `-createdocuments`: Specifies the action to create documents. - `-csv `: Required. Specifies the path to the CSV input file containing document details. - `-jobresults`: Optional. Used in async mode to download job results after completion. ### Request Example ```bash java -jar VaultDataLoader.jar -createdocuments -csv create_documents.csv ``` ### Async Mode To run in asynchronous mode, you would typically use additional flags provided by the Vault Loader CLI (e.g., `-async`). This returns a job ID for tracking. ### Response Similar to the API response, the CLI provides a CSV output detailing the success or failure of each document creation, including system-generated IDs and error messages. ``` -------------------------------- ### API Response for Document Creation Source: https://developer.veevavault.com/docs This is a sample response from the Vault API after attempting to create documents in bulk. It indicates the success status for each row, the system-generated ID for each document, and maps back to the original input row. ```json responseStatus,id,name__v,type__v,lifecycle__v,errors,row_id SUCCESS,1634,,,,,1 SUCCESS,1635,,,,,2 SUCCESS,1636,,,,,3 ``` -------------------------------- ### POST /api/{version}/auth Source: https://developer.veevavault.com/docs Authenticates a user and returns an authentication token. This endpoint has a dedicated 1-minute burst limit. ```APIDOC ## POST /api/{version}/auth ### Description Authenticates a user to the Vault API. This endpoint is tracked separately from standard API burst limits and has a 1-minute burst window. ### Method POST ### Endpoint /api/{version}/auth ### Parameters #### Path Parameters - **version** (string) - Required - The API version ### Response #### Success Response (200) - **sessionId** (string) - The authentication token for subsequent requests ### Response Headers - **X-VaultAPI-BurstLimit** (integer) - Maximum calls allowed in a 1-minute window - **X-VaultAPI-BurstLimitRemaining** (integer) - Calls remaining in the current 1-minute window - **X-VaultAPI-ResponseDelay** (integer) - Delay in milliseconds if throttled ``` -------------------------------- ### Authenticate to Vault API with vaultDNS override Source: https://developer.veevavault.com/docs Demonstrates how to perform an authentication request using cURL, including the optional vaultDNS body parameter to override the URI parameter. This request returns a session ID and a list of accessible vaults. ```bash curl -X POST https://my2020vault.veevavault.com/api/v24.1/auth \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Accept: application/json" \ -d "username=miyah.miller@veepharm.com&password={password}" \ -d "vaultDNS=my2050vault.veevavault.com" ``` -------------------------------- ### Safety Intake JSON Syntax Source: https://developer.veevavault.com/docs Details the structure of JSON files for the Safety Intake API to maximize data extraction for Inbox Items. ```APIDOC ## Safety Intake JSON Syntax ### Description This section describes the basic structure of a Safety JSON intake file, which is used to import Inbox Items. Proper formatting ensures maximum data extraction. ### JSON Structure - `data`: Contains nested objects with data for a single case (e.g., `case_contact__v`). - `structured`: An array within objects that holds key-value pairs of structured field data for a specific object. ### Sample JSON File A sample JSON intake file containing only structured data is available for download. ``` -------------------------------- ### POST /api/{version}/objects/documents Source: https://developer.veevavault.com/docs Uploads a new document to the Vault using a valid session ID. ```APIDOC ## POST /api/{version}/objects/documents ### Description Creates a new unclassified document in the Vault. ### Method POST ### Endpoint /api/{version}/objects/documents ### Parameters #### Request Body - **file** (file) - Required - The source file to upload. - **name__v** (string) - Required - The name of the document. - **type__v** (string) - Required - The document type (e.g., Unclassified). - **lifecycle__v** (string) - Required - The document lifecycle (e.g., Inbox). ### Request Example curl -X POST -H "Authorization: {SESSION_ID}" -H "Content-Type: multipart/form-data" -F file=@document.txt -F "name__v=myDocument" -F "type__v=Unclassified" -F "lifecycle__v=Inbox" https://{server}/api/{version}/objects/documents ### Response #### Success Response (200) - **responseStatus** (string) - Status of the request. - **id** (integer) - The unique ID of the created document. #### Response Example { "responseStatus": "SUCCESS", "responseMessage": "successfully created document", "id": 776 } ``` -------------------------------- ### POST /api/intake/json Source: https://developer.veevavault.com/docs Endpoint for submitting structured JSON data to the Intake API, supporting standard and custom pass-through fields. ```APIDOC ## POST /api/intake/json ### Description Submits structured JSON data to the Vault Intake API. This endpoint supports standard fields and pass-through fields (custom fields ending in __c) that map to Case or Case-descendant objects. ### Method POST ### Endpoint /api/intake/json ### Parameters #### Request Body - **patient** (object) - Optional - Container for standard Case patient fields. - **details** (object) - Optional - Container for non-patient Case fields and custom fields. - **[field_name]__v** (string/number) - Optional - Standard Vault field. - **[field_name]__c** (string/number) - Optional - Custom pass-through field. ### Request Example { "patient": { "patient_initials__v": "JD" }, "details": { "custom_field__c": "value" } } ### Response #### Success Response (200) - **responseStatus** (string) - Status of the intake process. #### Response Example { "responseStatus": "SUCCESS" } ``` -------------------------------- ### POST /api/{VERSION}/objects/documents/tokens Source: https://developer.veevavault.com/docs Generates a secure, anonymous document access token required for the external document viewer. Requires a valid Vault session and appropriate user permissions. ```APIDOC ## POST /api/{VERSION}/objects/documents/tokens ### Description Generates an anonymous viewing token for a specific document or group of documents. This token is required to authorize the external viewer to display the content. ### Method POST ### Endpoint /api/{VERSION}/objects/documents/tokens ### Parameters #### Path Parameters - **VERSION** (string) - Required - The API version (e.g., v22.1) #### Request Body - **doc_id** (integer) - Required - The ID of the document to access. - **tokenGroup** (string) - Optional - Identifier to group multiple documents together for sequential viewing. ### Request Example { "doc_id": 12345, "tokenGroup": "group_abc" } ### Response #### Success Response (200) - **token** (string) - The generated anonymous viewing token. #### Response Example { "token": "3003-cb6e5c3b-4df9-411c-abc2-6e7ae120ede7" } ``` -------------------------------- ### POST /api/{version}/auth Source: https://developer.veevavault.com/docs Authenticates a user and retrieves a session ID required for subsequent API requests. ```APIDOC ## POST /api/{version}/auth ### Description Authenticates the user using credentials and returns a session ID and list of available Vaults. ### Method POST ### Endpoint /api/{version}/auth ### Parameters #### Request Body - **username** (string) - Required - The user's login username. - **password** (string) - Required - The user's login password. ### Request Example curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'username={username}&password={password}' "https://{server}/api/{version}/auth" ### Response #### Success Response (200) - **responseStatus** (string) - Status of the request. - **sessionId** (string) - The session token for authentication. - **userId** (integer) - The ID of the authenticated user. - **vaultIds** (array) - List of available Vaults. #### Response Example { "responseStatus": "SUCCESS", "sessionId": "3B3C45FD...", "userId": 12021, "vaultIds": [ {"id": 1776, "name": "PromoMats", "url": "https://promo-vee.veevavault.com/api"} ] } ``` -------------------------------- ### Processing Case Product Dosage Information Source: https://developer.veevavault.com/docs/sample-files/safety-sample-intake-json.json This snippet shows how to process the dosage information for a case product. It iterates through the 'case_product_dosage__v' array to extract dose details. ```python def get_product_dosage(data, product_name): products = data.get('data', {}).get('case_product__v', {}).get('structured', []) for product in products: if product.get('product_reported__v') == product_name: dosages = product.get('case_product_dosage__v', []) return dosages return [] # Example usage: # cholecap_dosages = get_product_dosage(loaded_json_data, 'Cholecap') ``` -------------------------------- ### Retrieving Contact Information from JSON Source: https://developer.veevavault.com/docs/sample-files/safety-sample-intake-json.json This snippet retrieves contact information, specifically the reporter's name and qualification, from the JSON data. It assumes a single contact record. ```python def get_reporter_contact(data): contacts = data.get('data', {}).get('case_contact__v', {}).get('structured', []) if contacts: reporter = contacts[0] return { 'name': f"{reporter.get('firstname_value__v')} {reporter.get('lastname_value__v')}", 'qualification': reporter.get('qualification__v') } return None # Example usage: # reporter_details = get_reporter_contact(loaded_json_data) ``` -------------------------------- ### Upload an Unclassified Document Source: https://developer.veevavault.com/docs This request creates a new document in the Vault by providing the session ID in the Authorization header and the file content via multipart/form-data. It requires specifying document type and lifecycle parameters. ```bash curl -X POST -H "Authorization: {SESSION_ID}" -H "Content-Type: multipart/form-data" -F file=@document.txt -F "name__v=myDocument" -F "type__v=Unclassified" -F "lifecycle__v=Inbox" https://{server}/api/{version}/objects/documents ``` -------------------------------- ### Veeva Safety API - Supported Objects Source: https://developer.veevavault.com/docs This section details the standard and nested objects supported by the Veeva Safety API for structuring case data. ```APIDOC ## Veeva Safety API - Supported Objects ### Description This section details the standard and nested objects supported by the Veeva Safety API for structuring case data. Structured data is nested under the `data` object for a single case. ### Objects * `detail` * `structured` * `case_identifier__v` * `narrative` * `patient` * `case_product__v` * `structured` * `case_product_dosage__v` * `case_product_indication__v` * `case_product_substance__v` * `case_assessment__v` * `structured` * `case_assessment_result__v` * `case_adverse_event__v` * `case_contact__v` * `case_cause_of_death__v` * `case_medical_history__v` * `parental_case__v` (Supports `case_medical_history__v`) * `case_drug_history__v` * `parental_case__v` (Supports `case_drug_history__v`) * `structured` * `case_drug_history_substance__v` * `case_test_result__v` * `case_relationship__v` * `case_study_registration__v` * `case_diagnosis__v` * `transmission__v` * `structured` * `destination__v` * `destination_transmission_id__v` * `first_sender__v` * `organization__v` * `origin__v` * `origin_transmission_id__v` * `reason_text_long_text__v` * `recipient_user__v` * `sender_person__v` * `sender_user__v` * `sender_comments__v` * `transmission_profile__v` ``` -------------------------------- ### Retrieve List of Vault Objects Source: https://developer.veevavault.com/docs This request fetches a list of all objects defined within the Vault. It requires a valid session ID in the authorization header. ```bash curl -X GET -H "Authorization: {SESSION_ID}" https://{server}/api/{version}/metadata/vobjects ``` -------------------------------- ### POST /api/{version}/auth - Authentication with Defaulting Source: https://developer.veevavault.com/docs Authenticates a user to a Vault API. If the specified vaultDNS is invalid or inactive, Vault attempts to authenticate the user to their most relevant available Vault based on last login or oldest active membership. ```APIDOC ## POST /api/{version}/auth ### Description Authenticates a user to the Vault API. If the specified `vaultDNS` (either in the URI or request body) is invalid or inactive for the user, Vault will attempt to authenticate the user to their most relevant available Vault. ### Method POST ### Endpoint `https://{vaultDNS}/api/{version}/auth` ### Parameters #### Query Parameters - **vaultDNS** (string) - Optional - Overrides the `{vaultDNS}` in the URI to specify a Vault DNS for session generation. #### Request Body - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. - **vaultDNS** (string) - Optional - Overrides the `{vaultDNS}` in the URI to specify a Vault DNS for session generation. If present, the URI `vaultDNS` is ignored. ### Request Example ```json { "username": "miyah.miller@veepharm.com", "password": "{password}", "vaultDNS": "my2050vault.veevavault.com" } ``` ### Response #### Success Response (200) - **responseStatus** (string) - Indicates the success or failure of the authentication. - **sessionId** (string) - The session ID for the authenticated user. - **userId** (integer) - The ID of the user. - **vaultIds** (array) - A list of Vault IDs the user has access to, including their names and URLs. - **vaultId** (integer) - The ID of the Vault to which the user was authenticated. #### Response Example ```json { "responseStatus": "SUCCESS", "sessionId": "C7EFE4B29EF9914B170BAA01F232B462BE5ACB82F6704FDA2162B", "userId": 12021, "vaultIds": [ { "id": 1776, "name": "PromoMats", "url": "https://my2016vault.veevavault.com/api" }, { "id": 1777, "name": "eTMF", "url": "https://my2019vault.veevavault.com/api" }, { "id": 1779, "name": "QualityDocs", "url": "https://qualitydocs-veevapharm.veevavault.com/api" } ], "vaultId": 1776 } ``` ``` -------------------------------- ### Vault Java SDK Performance Metrics Response Headers Source: https://developer.veevavault.com/docs In v22.1+, Vault API includes metrics in the response header which allow developers to inspect Vault Java SDK performance during API execution. These response headers are returned with any Vault API request which invokes custom Vault Java SDK code. If the request does not invoke custom code, the response will not include these headers. ```APIDOC ## Vault Java SDK Performance Metrics Response Headers ### Description These response headers provide insights into the performance of the Vault Java SDK during API execution. They are included when custom Vault Java SDK code is invoked. ### Response Headers - **`X-VaultAPI-SdkCount`** (integer) - The total number of SDK entry points executed in this request. - **`X-VaultAPI-SdkCpuTime`** (integer) - The total CPU processing time required for this request, in nanoseconds. - **`X-VaultAPI-SdkElapsedTime`** (integer) - The total elapsed time for this request, in milliseconds. - **`X-VaultAPI-SdkGrossMemory`** (integer) - The total gross memory required for this request, in bytes. ``` -------------------------------- ### Retrieve Document Metadata via cURL Source: https://developer.veevavault.com/docs This request retrieves the list of all fields defined on documents, including their metadata attributes like type, requirements, and queryability. It requires a valid session ID for authentication. ```shell curl -X GET -H "Authorization: {SESSION_ID}" https://{server}/api/{version}/metadata/objects/documents/properties ``` -------------------------------- ### Request and Listen for Session ID via Post Message (jQuery) Source: https://developer.veevavault.com/docs This snippet demonstrates how to request a session ID from Vault using postMessage on window load and then listen for the response containing the session ID. It's crucial for integrations where session credentials need to be securely transmitted. The code assumes jQuery is available. ```javascript let sessionId = ''; // 1. Request the session ID from Vault $(window).on('load', function() { var readyMessage = JSON.stringify({'message_id': 'ready', 'data': {}}); window.parent.postMessage(readyMessage, '*'); }); // 2. Listen for a message event from Vault $(window).on('message', function(e) { var message = JSON.parse(e.originalEvent.data); if (message['message_id'] == 'session_id') { sessionId = message['data']['session_id']; } }); // Use the sessionId variable in the integration header or body data ``` -------------------------------- ### Accessing Patient Data in JSON Source: https://developer.veevavault.com/docs/sample-files/safety-sample-intake-json.json This snippet demonstrates how to access and parse patient structured data from a JSON object. It assumes the JSON is loaded into a variable named 'data'. ```python def get_patient_data(data): patient_info = data.get('data', {}).get('patient', {}).get('structured', []) if patient_info: return patient_info[0] # Assuming only one patient record return None # Example usage: # patient_record = get_patient_data(loaded_json_data) ``` -------------------------------- ### Embed Veeva Vault External Document Viewer using JavaScript Source: https://developer.veevavault.com/docs This JavaScript code snippet demonstrates how to embed the Veeva Vault external document viewer into a website. It loads the Vault.js API asynchronously and initializes the viewer within a specified div element. The viewer requires a Vault Document Token and the Vault's DNS to be provided in the URL parameters for accessing documents. ```javascript
``` -------------------------------- ### Retrieve Specific Object Metadata Source: https://developer.veevavault.com/docs This request retrieves the metadata definition for a specific object by its name. It is used to inspect the fields and configuration of a target object. ```bash curl -X GET -H "Authorization: {SESSION_ID}" https://{server}/api/{version}/metadata/vobjects/product__v ``` -------------------------------- ### Transmission API Request Structure Source: https://developer.veevavault.com/docs/sample-files/safety-sample-intake-json.json This snippet details the required and optional fields for a transmission request to Veeva Vault. ```APIDOC ## POST /websites/developer_veevavault/transmission ### Description This endpoint is used to initiate a transmission request within Veeva Vault. It requires specific organization details and allows for optional transmission profile and sender/recipient information. ### Method POST ### Endpoint /websites/developer_veevavault/transmission ### Parameters #### Request Body - **organization__v** (string) - REQUIRED - The customer organization initiating the transmission. - **destination__v** (string) - REQUIRED - The destination organization for the transmission. - **transmission_profile__v** (string) - RECOMMENDED - The transmission profile to be used for the integration. Defaults to 'General API Profile'. - **first_sender__v** (string) - OPTIONAL - The identifier for the first sender. - **destination_transmission_id__v** (string) - OPTIONAL - The transmission ID of the destination. - **origin__v** (string) - OPTIONAL - The origin organization of the transmission. - **origin_transmission_id__v** (string) - OPTIONAL - The transmission ID of the origin. - **reason_text_long_text__v** (string) - OPTIONAL - Additional text describing the reason for the transmission. - **sender_comments__v** (string) - OPTIONAL - Comments from the sender. - **recipient_user__v** (string) - OPTIONAL - The user receiving the transmission. - **sender_user__v** (string) - OPTIONAL - The user sending the transmission. ### Request Example ```json { "organization__v": "YourSponsorOrganization", "destination__v": "AnotherOrganization", "transmission_profile__v": "General API Profile", "first_sender__v": "Sender123", "destination_transmission_id__v": "DestID456", "origin__v": "OriginOrg789", "origin_transmission_id__v": "OriginTID012", "reason_text_long_text__v": "Data synchronization request", "sender_comments__v": "Please review the attached documents.", "recipient_user__v": "recipient@example.com", "sender_user__v": "sender@example.com" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the transmission request. - **message** (string) - A confirmation message for the request. #### Response Example ```json { "status": "Success", "message": "Transmission request initiated successfully." } ``` ``` -------------------------------- ### Extracting Adverse Event Details from JSON Source: https://developer.veevavault.com/docs/sample-files/safety-sample-intake-json.json This code extracts adverse event details, including the reported event and country, from the provided JSON structure. It iterates through the list of adverse events. ```javascript function getAdverseEvents(data) { const events = data.data.case_adverse_event__v.structured; return events.map(event => ({ reported: event.event_reported__v, country: event.event_country__v, onset_date: event.onset_idate__v })); } // Example usage: // const adverseEvents = getAdverseEvents(jsonData); ```