API - Creating a Resource

This API is used specifically to add a resource for a sample to be pre-selected in a file-upload activity for a workflow.

Using our REST API to Create a Resource

The Create Resource request is an HTTP POST call to the following urls:

Required Setup

Workflow Definition must add the below JSON to activity. The value in resourceGroup must match what is being sent in the payload. Value can be anything but we suggest using the name of the workflow.

"preSelectResources": {
  "resourceGroups": [
    "string"
  ]
}

Once resource has been uploaded you can see the file is being picked up in the activity defined.

Create Resource Payload

{
  "resource": {
	"organizationId": integer,
	"requisitionIdentifier": "string",
	"sampleIdentifier": "string",
	"resourceGroupName": "string",
	"fileContent": "string",
	"returnUploadLink": boolean
  }
}

Field name

Required

Description

organizationId yes ID of organization
requisitionIdentifier yes Requisition Identifier of sample
sampleIdentifier yes Sample Identifier for resource
resourceGroupName yes Resource group name defined in workflow definition
fileContent optional base64 content of file (only used if not requesting upload link)
returnUploadLink optional Link to upload file to S3 (only used if not sending fileContent). If uploading file to S3 make sure file name starts with sampleIdentifier_xxxx


Create Resource Response

The Create Resource API call can return the following possible responses:

Response code

Response body

201 “Indicating the resource was successfully created” { message: "Resource #{new_document_name} successfully uploaded." } OR { uploadLink: "https://...." }
401 “Indicating an authentication error”
422 “Validation error, indicating an error with the request contents” Will return the validation errors found.
e.g. "Sample not found" and "resourceGroupName required".
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.