Exposed API

Platform

External API user authentication

Users with “External API user” role are only allowed to access exposed APIs and a token is required for this access. This authentication API provides the access token which will be used to access the exposed API by the user. Username and password of a user who has “External API user” role, should be given in the request.

📘

NOTE:

For all the exposed APIs mentioned in the following sections, the access token generated by this API should be used. The access token will expire in 5 minutes, after which this API must be called again to obtain a new access token.

Field Description
URL <hostname>/api/user/authentication/external/user
Method POST
Request Body
{
    "username": "<username>",
    "password": "<encrypted password>"
}
Headers Content-Type: application/json
Request parameters description username - name of the user created in LDAS with “External API user” role.
password - encrypted password of the user.

In case of successful login, you receive access token and can use it to make authenticated requests. When the access token expires, you can use the refresh token to get a new one without asking the user to log in again.

Response codeReasonMessage
405Invalid method typeInvalid Request
400Invalid credentialsInvalid credentials
400Invalid usernamePermission denied

Lab Instrument Integration on Demand (LIID)

Generate Activities

The following APIs are used to generate activities based on the instrument configuration. User needs to have “External API user” role to use the following APIs.

📘

NOTE:

referenceId – an id which will be sent in the reference document of the API.

To generate activity with file input

To generate activity with file passed in the request for File Watcher mode.

Field Description
URL <hostname>/api/integration/transform/file/{referenceId}
Method POST
Request Body Request Body Example
Headers Content-Type: multipart/form-data
ownerName: <data owner>
Authorization <the bearer token from the authorization>
Request parameters description instrumentFileName – name of the instrument file with its extension.
Example: instrument.csv

instrumentFile – Input data received from the instrument as file.

If return response given as yes in instrument configuration, an "activityReferenceId" will be generated. If it is no in instrument configuration, the "activityReferenceId" will not be generated

Response codeReasonMessage
200SuccessTransformation started successfully
400Invalid RequestInvalid Request
400Invalid file formatInvalid file format
500Error in the serverAn unexpected error occurred. Please contact System Administrator

To get response content for the activity

To get response content for the activity generated if the Return Response field under connection details section in Instrument’s configuration is set to true.

Field Description
URL <hostname>/api/integration/transform/instrument/referenceId/{activityReferenceId}
Method GET
Authorization <the bearer token from the authorization>
Response codeReasonMessage
200SuccessTransformation completed
400Invalid RequestInvalid Request
404Transformation is not foundTransformation not found
500Transformation file is waiting for approvalTransformation file is waiting for approval
500Transformation is still in progressTransformation is still in progress
500Transformation failed on Parsing stageTransformation failed on Parsing stage
500Transformation is rejectedTransformation has been rejected
500Transformation failed on Receive data stageTransformation failed on Data Receiving stage
500Error in the serverAn unexpected error occurred. Please contact System Administrator
500Error while retrieving response contentAn unexpected error occurred while retrieving response content

To generate activity with command and parameters

To generate activity with command and parameters for the instruments with RS232, OPCUA OPCHDA mode.

Field Description
URL <hostname>/api/integration/transform/instrument/{referenceId}
Method POST
Request Body
{
  "name": "<name>",
  "parameter": 
  {
    "<key>": "<value>"
  }
}
Headers Content-Type: application/json
ownerName: <data owner>
Authorization <the bearer token from the authorization>
Request parameters description name – Command to be executed in the instrument to get the input data. This command should be defined in the instrument configuration.

parameter – Parameters required to execute the command. Mandatory parameters defined in the instrument configuration must be included. If a parameter has a configured value and the same value is expected, it can be sent as empty. If a value is provided in the request, it will override the configured value. Additional parameters not defined in the configuration can also be included.

If return response given as yes in instrument configuration, an "activityReferenceId" will be generated. If it is no in instrument configuration, the "activityReferenceId" will not be generated

Response codeReasonMessage
200SuccessTransformation started successfully
400Invalid RequestInvalid Request
500Error in the serverAn unexpected error occurred. Please contact System Administrator

To generate activity with request parameters

To generate activity with request parameters for DB Query and Rest API modes if the instrument's parameterized field configuration is set to true.

Field Description
URL <hostname>/api/integration/transform/endpoint/{referenceId}
Method POST
Request Body
{
  "<Key>": "<Value>"
}
Headers Content-Type: application/json
ownerName: <data owner>
Authorization <the bearer token from the authorization>
Request parameters description If the parameterized field is set to true, the request body or query parameters that need to be passed will be provided in the API reference document.

If return response given as yes in instrument configuration, an "activityReferenceId" will be generated. If it is no in instrument configuration, the "activityReferenceId" will not be generated

Response codeReasonMessage
200SuccessTransformation started successfully
400Invalid RequestInvalid Request
500Error in the serverAn unexpected error occurred. Please contact System Administrator

To generate activity with the instrument configurations

To generate activity with the instrument configurations for DB Query and Rest API mode.

Field Description
URL <hostname>/api/integration/transform/getendpoint/{referenceId}
Method GET
Authorization <the bearer token from the authorization>

If return response given as yes in instrument configuration, an "activityReferenceId" will be generated. If it is no in instrument configuration, the "activityReferenceId" will not be generated

Response codeReasonMessage
200SuccessTransformation started successfully
400Invalid RequestInvalid Request
500Error in the serverAn unexpected error occurred. Please contact System Administrator

Scientific Data Management on Cloud (SDMC)

File Upload from External Source

This API is first submitted with the details of the file to be uploaded – bucketName, file Size, Path to upload and the file name. The details present in the request are validated to check if the file can be uploaded. If the request is valid, a unique ID is generated for the file and is sent in the response along with the maximum chunk size that indicates the message capacity for a single chunk.Based on the maximum chunk size that is returned, the input file needs to be split into n number of chunks. For example, if a file size is 8876 bytes and the API returns 1000 as the maximum chunk size, the file needs to be spliced into 9 chunks (8 chunks with capacity of 1000 bytes and the last one with 876 bytes) and for each chunk invoke the consequent API.

Field Description
URL <hostname>/api/file/external/filedetails
Method POST
Request Body
{
  "fileName": "<filename.extension>",
  "fileSize": <file size>,
  "path": "<path>",
  "bucketName": "<bucket name>"
}
Headers Content-Type: application/json
ownerName: <data owner>
Authorization <the bearer token from the authorization>
Request parameters description fileName – Name of the file to be uploaded (including extension).

fileSize – Size of the file to be uploaded (in bytes: KB, MB, or GB).

path – Folder path where the file must be uploaded. Can be an existing or new path; new folders will be created if needed.

bucketName – Name of the bucket where the folder should be uploaded.
Response code Reason Message Data
200 Success Success { "maxChunkSize": <chunk size>,
"fileId": "<file id>",
"tempUuid": "<temp uuid>" }
400 Invalid Request Invalid request - {missing parameter} is missing {}
400 Empty or Invalid folder path in the request Invalid folder path. Enter a valid folder path {}
500 Error during data persisting Internal server error {}

Upload File

This API can be used for uploading the file or to check the status of the file upload. By setting the variable “isStatusCheck” to false, file upload can be performed. Using the file ID and temp Uuid that was generated in the file details API, this API is hit to upload the file as individual chunks to LDAS. Upon receiving each chunk, the API returns the status if each chunk was received and upon receiving the last chunk, the file upload is marked as completed. By setting the variable “isStatusCheck” to true, the status of the file upload can be observed

Field Description
URL <hostname>/api/file/external/upload/{fileID}
Method POST
Request Body Request Body Example
Headers Content-Type: multipart/form-data
Authorization: <the bearer token from the authorization>
Request parameters description fileId – File identifier generated as a response from the Add File Details API.

fileSource – Source from which the file is uploaded.
Example: If the system is LIMS, then the source should be System-External.

tempUuid – File identifier in the temporary path, generated as a response from the Add File Details API.

isStatusCheck – Indicates whether the API call is for checking the status of the file upload or for uploading the file.
Response Code Reason Message Data
200 If “isStatusCheck” is false and each chunk is received successfully Chunk received successfully
{ "fileId": "<id>", 
"fileStatus": null }
200 If “isStatusCheck” is false and file upload from local is successful File received successfully
{ "fileId": "<id>", 
"fileStatus": null }
200 If “isStatusCheck” is true and upload to S3 is in progress File upload is in progress
{ "fileId": "<id>", 
"fileStatus": "IN PROGRESS" }
200 If “isStatusCheck” is true and upload to S3 failed File upload got failed
{ "fileId": "<id>", 
"fileStatus": "FAILED" }
200 If “isStatusCheck” is true and upload to S3 completed File uploaded successfully
{ "fileId": "<id>", 
"fileStatus": "COMPLETED" }
400 If “isStatusCheck” is true but file not fully uploaded to local/temp path File has not been uploaded
{ "fileId": "<id>", 
"fileStatus": "INCOMPLETE" }
400 If chunk size exceeds the limit Chunk size exceeds the maximum limit
{ "fileId": "<id>", 
"fileStatus": null }
400 Invalid request due to missing parameters Invalid request - {missing parameter} is missing
{ "fileId": "<id>",
 "fileStatus": null }
500 Error during the upload process Internal server error
{ "fileId": "<id>", 
"fileStatus": null }
400 Invalid fileId, tempUuid, or username Invalid Request
{ "fileId": "<id>", 
"fileStatus": null }