Exposed API
This section provides a comprehensive guide to the Exposed APIs available in the Lab Data Automation Solution (LDAS) platform. These APIs enable external systems to integrate seamlessly with LDAS for instrument data ingestion, transformation, and file management. Access to these APIs is restricted to users with the “External API user” role. Authentication is required via a token-based mechanism, and each API call must include a valid bearer token.
The APIs covered in this guide support:
- Instrument integration via file, command, DB query, and REST modes.
- Activity generation and response retrieval.
- File upload and chunked transfer from external sources.
This guide is intended for developers and system integrators working with LDAS in regulated environments, including GxP-compliant workflows.
Getting Started: 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 code | Reason | Message |
|---|---|---|
| 405 | Invalid method type | Invalid Request |
| 400 | Invalid credentials | Invalid credentials |
| 400 | Invalid username | Permission denied |
Instrument Integration
Generate Activities
The following APIs are used to generate activities, which are created when a configured instrument runs and produces data.
NOTE:referenceId – an id which will be sent in the reference document of the API.
To generate activity using Instrument File
To generate an activity by uploading the instrument’s output file when the instrument is configured in File Watcher mode.
| Field | Description |
|---|---|
| URL | <hostname>/api/integration/transform/file/{referenceId} |
| Method | POST |
| Request Body |
|
| 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 code | Reason | Message |
|---|---|---|
| 200 | Success | Transformation started successfully |
| 400 | Invalid Request | Invalid Request |
| 400 | Invalid file format | Invalid file format |
| 500 | Error in the server | An 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 code | Reason | Message |
|---|---|---|
| 200 | Success | Transformation completed |
| 400 | Invalid Request | Invalid Request |
| 404 | Transformation is not found | Transformation not found |
| 500 | Transformation file is waiting for approval | Transformation file is waiting for approval |
| 500 | Transformation is still in progress | Transformation is still in progress |
| 500 | Transformation failed on Parsing stage | Transformation failed on Parsing stage |
| 500 | Transformation is rejected | Transformation has been rejected |
| 500 | Transformation failed on Receive data stage | Transformation failed on Data Receiving stage |
| 500 | Error in the server | An unexpected error occurred. Please contact System Administrator |
| 500 | Error while retrieving response content | An 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 code | Reason | Message |
|---|---|---|
| 200 | Success | Transformation started successfully |
| 200 | Success when real-time response is enabled in the instrument configuration | Data has been successfully fetched |
| 400 | Invalid Request | Invalid Request |
| 404 | File Directory path is empty in remote agent server endpoint | The file directory for the configured Remote Agent Server endpoint is empty |
| 500 | Error in the server | An 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 code | Reason | Message |
|---|---|---|
| 200 | Success | Transformation started successfully |
| 200 | Success when real-time response is enabled in the instrument configuration | Data has been successfully fetched |
| 400 | Invalid Request | Invalid Request |
| 500 | Error in the server | An 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 code | Reason | Message |
|---|---|---|
| 200 | Success | Transformation started successfully |
| 200 | Success when real-time response is enabled in the instrument configuration | Data has been successfully fetched |
| 400 | Invalid Request | Invalid Request |
| 500 | Error in the server | An unexpected error occurred. Please contact System Administrator |
Archival
NOTE:To use the below APIs the users must either have “Archival Super User” or “Archival User” role to the folder to which the file upload is being targeted at along with “External API user” role.
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 |
| 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>", } |
| 400 | Exceeded File size | File size exceeds the maximum limit | {} |
| 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 |
|
| Headers | Content-Type: multipart/form-data |
| Authorization | <the bearer token from the authorization> |
| Request parameters description |
fileId – File identifier which is generated as a response in Add file details API. fileName – Name of the file to be uploaded (Name should be given along with file extension). totalFileSize – Size of the file to be uploaded (File size KB, MB or GB should be given in 'bytes'). path – The folder path in which file has to be uploaded (Folder path can be an already existing path in archival or non-existing one). In case of non-existing folder path, folders will be created accordingly. bucketName – Name of the bucket in which the folder has to be uploaded. fileSource – Source from which the file is uploaded. Example: If the system is LIMS, then the source should be System-External. |
| Response Code | isStatusCheck | Reason | Message | Data |
|---|---|---|---|---|
| 200 | false | Successful reception of each chunk | Chunk received successfully | { "fileId": "<id>", "fileStatus": null } |
| 200 | false | Successful file upload | File received successfully | { "fileId": "<id>", "fileStatus": null } |
| 200 | true | File upload is in progress | File upload is in progress | { "fileId": "<id>", "fileStatus": "IN PROGRESS" } |
| 200 | true | File upload to S3 is in Failed state | File upload got failed | { "fileId": "<id>", "fileStatus": "FAILED" } |
| 200 | true | Successful file upload | File uploaded successfully | { "fileId": "<id>", "fileStatus": "COMPLETED" } |
| 400 | true | Entire file has not been uploaded to Local/ Temp Path | File has not been uploaded | { "fileId": "<id>", "fileStatus": "INCOMPLETE" } |
| 400 | - | If chunk size exceeds the limit (Max chunk size: 10 MB) | 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 } |
Updated 28 days ago
