For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Script View

The API Script panel in dqMan allows users to create, edit, and execute API requests in a script format. It provides a structured way to define API calls, making it easier to automate and test interactions with the Veeva Vault API.

Key Features of the API Script Panel

  1. Script-Based API Requests

    • Users can manually write or generate API scripts to interact with Veeva Vault.

    • Scripts follow a structured format, typically including the HTTP method, headers, and API URL.

  2. Script Structure

    • HTTP Method: GET (to retrieve data)

    • Headers:

      • "Authorization: {{sessionId}}" → Uses a session variable for authentication.

      • "Accept: application/json" → Specifies that the response should be in JSON format.

    • API Endpoint:

      • The script calls https://{{vaultDNS}}/api/{{version}}/delegation/vaults to retrieve delegated access information.

    • Redirect results to file: If the API call result is a file, the full path to the file can be specified in the API script as the last line using >PATH

    • GET // Download Daily API Usage
      --header "Authorization:{{sessionId}}"
      --header "Accept:application/json"
      --data-urlencode date=2025-02-12
      https://{{vaultDNS}}/api/{{version}}/logs/api_usage
      >C:\Users\admin\path
  3. Generating API Scripts

    • Users can right-click an API request from the API Collection and select "Generate Script" to automatically create an API script based on the selected request.

  4. Executing API Scripts

    • Users can run the script using the Run Script button in the toolbar.

    • The results of the API request will be displayed in the Response Panel.

  5. Flexibility & Customization

    • Users can modify scripts to include parameters, variables, and different request types (GET, POST, PUT, DELETE).

    • This makes it easier to automate repetitive API testing tasks.

Examples of API Script in dqMan

Here’s an example of a POST request to create a new document in Veeva Vault using an API script in dqMan:

Explanation of the Script

  1. POST → Specifies the HTTP method to create a new document.

  2. Headers:

    • "Authorization: {{sessionId}}" → Uses a session token for authentication.

    • "Content-Type: application/json" → Defines that the request body is in JSON format.

  3. --data Section:

    • This JSON payload contains document details:

      • "name__v": The document name (e.g., "Test Document").

      • "type__v": The document type (e.g., "general__c").

      • "lifecycle__v": The document’s lifecycle state (e.g., "Draft").

  4. API Endpoint:

    • The request is sent to https://{{vaultDNS}}/api/{{version}}/objects/documents, where {{vaultDNS}} and {{version}} are placeholders for the Vault domain and API version.

Running the Script

  • Click "Run Script" in dqMan to execute the request.

  • The response will confirm whether the document was successfully created.

Updating a Document (PUT Request)

This script updates an existing document’s name and lifecycle in Veeva Vault.

Explanation:

  • PUT → Used for updating an existing document.

  • Headers:

    • "Authorization: {{sessionId}}" → Uses a session token for authentication.

    • "Content-Type: application/json" → Defines the request body format.

  • --data Section:

    • Updates the document’s name and changes its lifecycle to "In Review".

  • API Endpoint:

    • https://{{vaultDNS}}/api/{{version}}/objects/documents/0000000000004ED

    • Replace 0000000000004ED with the actual document ID.

Deleting a Document (DELETE Request)

This script deletes an existing document from Veeva Vault.

Explanation:

  • DELETE → Used to remove a document from the Vault.

  • Headers:

    • "Authorization: {{sessionId}}" → Ensures authentication.

  • API Endpoint:

    • https://{{vaultDNS}}/api/{{version}}/objects/documents/0000000000004ED

    • Replace 0000000000004ED with the actual document ID.

Retrieving Document Details (GET Request)

This script fetches details of a specific document from Veeva Vault.

Explanation:

  • GET → Used to retrieve document details.

  • Headers:

    • "Authorization: {{sessionId}}" → Ensures authentication.

    • "Accept: application/json" → Requests the response in JSON format.

  • API Endpoint:

    • https://{{vaultDNS}}/api/{{version}}/objects/documents/0000000000004ED

    • Replace 0000000000004ED with the actual document ID.

Retrieving a List of Documents (GET Request)

This script retrieves a list of all documents stored in the Vault.

Explanation:

  • GET → Used to retrieve multiple documents.

  • Headers:

    • "Authorization: {{sessionId}}" → Ensures authentication.

    • "Accept: application/json" → Requests the response in JSON format.

  • API Endpoint:

    • https://{{vaultDNS}}/api/{{version}}/objects/documents

    • Retrieves a list of documents.

Was this helpful?