InMoment Data Operations API
Overview
This API has been designed and built to allow for seamless data transmission between various different services, including but not limited to sample delivery from third party providers.
Getting Started
What you need:
- A user that has been configured to have access to the API
- A project name that your user has been given access too
Base URL: https://api.dataops.mcx.cloud
[GET] Authentication
Example call:
curl -X GET https://api.dataops.mcx.cloud/authenticate \
-H 'Authorization: Basic dGVzdDp0ZXN0'
Example response:
{
"jwt": "<valid JWT>"
}
This API uses basic authentication to retrieve a JWT to be used by subsequent requests. JWT’s expire after 60 seconds.
You will receive a JSON object back from the endpoint.
URL: https://api.dataops.mcx.cloud/authenticate
Headers
| Key | Value | Explanation |
|---|---|---|
| Authroization | Basic <Base64 encoded credentials> | Username and password, base64 encoded |
Response
| Key | Type | Explanation |
|---|---|---|
| jwt | string | The JWT to be used for subsequent requests |
[POST] Sample Upload
Example call:
curl -X POST https://api.dataops.mcx.cloud/sample/upload \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"project": "testing",
"sample": [
{
"key1": "record1",
"key2": "record1"
},
{
"key1": "record2",
"key2": "record2"
}
]
}'
Example response:
{
"identifier": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx"
}
The sample upload endpoint allows you post sample to InMoment for consumption by the relevant processes within the business.
The data you’re posting should be in JSON format including the parameters defined below, the response you receive back will also be in JSON.
URL: https://api.dataops.mcx.cloud/sample/upload
Headers
| Key | Value | Explanation |
|---|---|---|
| Content-Type | application/json | Endpoint is expecting JSON data to be posted |
| Authorization | Bearer <JWT> | JWT returned to you from a call to authenticate endpoint |
Parameters
| Key | Type | Explanation | |
|---|---|---|---|
| project | string | Project name you’re uploading sample for (must match project name your user has been configured for) | Required |
| sample | json | JSON array containing an object per sample record in agreed format | Required |
Response
| Key | Type | Explanation |
|---|---|---|
| identifier | string | Unique identifier for the request |
HTTP Codes
Any 4* codes will return with a message regarding the error, this should be investigated as the error is likely client side. 5* errors should be reported to your contact at InMoment as the issue is internal and is likely to persist.
| Code | Name | Explanation |
|---|---|---|
| 200 | Success | Request was successful |
| 401 | Unauthorized | Unable to authorize based on your credentials or token |
| 403 | Forbidden | User doesn’t have permission to perform the request |
| 405 | Invalid Method | Method not valid for endpoint |
| 500 | Internal Server Error | There was an error internally within the API |
| 503 | Service Unavailable | The service requested is down and unable to process requests |