Call Rampiva APIs from a Rampiva Workflow

The material in this document is for informational purposes only. The products it describes are subject to change without prior notice, due to the manufacturer’s continuous development program. Rampiva makes no representations or warranties with respect to this document or with respect to the products described herein. Rampiva shall not be liable for any damages, losses, costs or expenses, direct, indirect or incidental, consequential or special, arising out of, or related to the use of this material or the products described herein.

Introduction

This article describes how to design a Rampiva Workflow that will connect to Rampiva Automate using the API and perform various actions such as submitting a new Job using the required settings and parameters and changing the priority of a Job.

When creating a workflow that performs other tasks using the API, it can be useful to first manually perform the tasks in the Rampiva Automate web interface and to monitor the endpoints called and the responses received in the browser network tab. Additionally, the Rampiva API documentation is available at http://localhost/openapi, where localhost is the server where Automate is installed.

Prerequisites 


Instructions

A. Creating a Workflow that Submits a Job

1

Add a Configuration operation with the following parameters used to define the location of the Rampiva API and the authentication API key:

  • {service_location}

  • {api_bearer_token_protected}

2

Add a Configuration operation with the following parameters used to define the settings with which the Job will be submitted:

  • {submission_resource_pool_name}

  • {submission_execution_profile_name}

  • {submission_client_name}

  • {submission_matter_name}

  • {submission_library_name}

  • {submission_workflow_name}

  • {submission_job_name}

This Workflow will connect to the Rampiva Automate platform and search for the objects by name and retrieve the IDs, which are required for the Job submission. If you already know the IDs of the objects, you can skip to step 7.

3

Add a Call API operation to test the API access by getting the current user settings, with the following options:

  • Verb: GET

  • URL: {service_location}/scheduler/userSettings

  • Authentication type: Bearer Token

  • Token: {api_bearer_token_protected}

  • Headers:

    • Accept: application/json

4

Add a Call API operation to retrieve the Resource Pools available, by copying the previous Call API operation and changing the following options:

  • URL: {service_location}/scheduler/resources/resourcePools

The Resource Pools details will be returned in the {call_api_response_body} parameter. This will be parsed in the next step.

5

Add a Script operation to parse the output of the response of the previous operation, and store the Resource Pool id in a parameter, with the following Python script:

def getRampivaObject(objectType,name,parameterName): responseBody = parameters.getJsonObject("{call_api_response_body}") print("Testing "+str(len(responseBody))+" "+objectType+"(s)") for item in responseBody: if (item["name"] == name): print(objectType+" "+name+" has ID "+item["id"]) parameters.put(parameterName,item["id"]) return raise Exception("Cannot find "+objectType+" with name "+name) getRampivaObject("Resource Pool",submission_resource_pool_name,"{submission_resource_pool_id}")

 

6

For each of Clients, Matters, Libraries and Workflows, add a Call API and a Script operation to retrieve the IDs, similar to steps 4 and 5.

 

7

Add a Call API operation to submit the Job, with the following options:

  • Verb: POST

  • URL: {service_location}/scheduler/jobs

  • Authentication type: Bearer Token

  • Token: {api_bearer_token_protected}

  • Headers:

    • Accept: application/json

  • Body type: Raw

  • Format: JSON

  • Body:

    { "name": "{submission_job_name}", "executionProfileId": "{submission_execution_profile_id}", "resourcePoolId": "{submission_resource_pool_id}", "libraryWorkflowId": "{submission_workflow_id}", "matterId": "{submission_matter_id}", "priority": "MEDIUM", "sessionParameters": [ { "name": "{nuix_case_location}", "value": "Case API" }, { "name": "{source_data_location}", "value": "Various Files" }, { "name": "{docid_prefix}", "value": "API_" } ] }

 

8

Add a Script operation to print the result of the submission, with the following Python script:

responseBody = parameters.getJsonObject("{call_api_response_body}") print("Job "+submission_job_name+" submitted with ID "+responseBody["id"])
9

Sample full Workflow.

 

 

10

Test the Workflow.

 

11

If receiving an error with the message IOException: Certificate fingerprint, copy the certificate fingerprint and set it in all Call API operations.

 

12

If receiving an error with the message HTTP/401 Unauthorized, verify that the Bearer Token was filled in correctly and that the user has the permissions to perform the action.

 

13

If receiving an error with the message HTTP/404 Not Found, verify that the service location was filled in correctly.

 

B. Change the Priority of a Job

1

Add a Configuration operation with the following parameters used to define the location of the Rampiva API and the authentication API key:

  • {service_location}

  • {api_bearer_token_protected}

 

2

Add a Configuration operation with the following parameters used to define the ID of the Job whose priority will be changed:

  • {submission_job_id}

 

3

Add a Call API operation to submit the Job, with the following options:

  • Verb: PUT

  • URL: {service_location}/scheduler/jobs/{submission_job_id}/settings

  • Authentication type: Bearer Token

  • Token: {api_bearer_token_protected}

  • Headers:

    • Accept: application/json

  • Body type: Raw

  • Format: JSON

  • Body:

4

Sample full Workflow.

 

 

5

Test the Workflow.

 

6

If receiving an error with the message IOException: Certificate fingerprint, copy the certificate fingerprint and set it in all Call API operations.

 

7

If receiving an error with the message HTTP/401 Unauthorized, verify that the Bearer Token was filled in correctly and that the user has the permissions to perform the action.

 

8

If receiving an error with the message HTTP/404 Not Found, verify that the service location was filled in correctly and that the Job ID is valud.