Skip to content
×

Uploading tensor data

Allows clients to begin the upload of a dataset that contains images.

Request:

POST /api/public/v1/image/initUpload

file: file attributes: { projectId: number, name: string, description?: string, hasFeatureHeaders?: boolean }

It is assumed that the file is in some CSV-style format, and that the file should contain sample identifiers, that will later be used as keys to map a sample id to an uploaded image. The projectId identifies the project to which the dataset should be attached. The user must have write permissions to this project. The name and optional description are used to name and describe the created dataset. The boolean hasFeatureHeaders specifies whether the first row contains headers rather than data.

Constraints: name must have at least 3 and at most 60 characters and must be unique within the target project. description can be at most 255 characters.

Response:

{payload: { taskId: string },status: "success" } 

The projectId is the same as in the request. The name and optional description fields name and describe the deleted project, respectively.

Example

$ http --multipart --body POST https://jadapi.jadbio.com/api/public/v1/image/initUpload \
       "Authorization: Bearer $(cat ~/.jadtoken)" attributes="{"projectId": 1, "name": "image-dataset", "description": "", "hasFeatureHeaders": true}", file=@file.csv
{
    "payload": { "taskId": "60" },
    "status": "success"
}

Upload Image - Init

Allows clients to begin the upload of a dataset that contains images.

Request:

POST /api/public/v1/image/initUpload

file: file attributes: { projectId: number, name: string, description?: string, hasFeatureHeaders?: boolean }

It is assumed that the file is in some CSV-style format, and that the file should contain sample identifiers, that will later be used as keys to map a sample id to an uploaded image. The projectId identifies the project to which the dataset should be attached. The user must have write permissions to this project. The name and optional description are used to name and describe the created dataset. The boolean hasFeatureHeaders specifies whether the first row contains headers rather than data.

Constraints: name must have at least 3 and at most 60 characters and must be unique within the target project. description can be at most 255 characters.

Response:

{payload: { taskId: string },status: "success" } 

The projectId is the same as in the request. The name and optional description fields name and describe the deleted project, respectively.

Example

$ http --multipart --body POST https://jadapi.jadbio.com/api/public/v1/image/initUpload \
       "Authorization: Bearer $(cat ~/.jadtoken)" attributes="{"projectId": 1, "name": "image-dataset", "description": "", "hasFeatureHeaders": true}", file=@file.csv
{
    "payload": { "taskId": "60" },
    "status": "success"
}

Upload Image - Add sample

Allows clients to add an image to an image dataset.

Request:

POST /api/public/v1/image/:taskId/add

file: file sampleId: string

The taskId identifies the image upload task returned from https://jadapi.jadbio.com/api/public/v1/image/initUpload

Constraints: sampleId should be contained in the dataset that was sent in the image upload init. File can be of the following formats: 'jpeg', 'jpg', 'tif', 'png', 'bmp'.

Response:

{payload: { taskId: string },status: "success" }

Example

$ http --multipart --body POST https://jadapi.jadbio.com/api/public/v1/image/123/add \
       "Authorization: Bearer $(cat ~/.jadtoken)" sampleId='sample1', file=@file.png

Upload Image - Commit

Allows clients commit an image upload when all images have been uploaded.

Request:

GET /api/public/v1/image/:taskId/commit

The taskId identifies the image upload task returned from https://jadapi.jadbio.com/api/public/v1/image/initUpload.

Response:

{payload: { },status: "success" }

Example

$ http --body GET https://jadapi.jadbio.com/api/public/v1/image/123/commit \
       "Authorization: Bearer $(cat ~/.jadtoken)"

Upload Image - Get task status

Returns the execution status of an asynchronous image task running on the server.

Request:

GET /api/public/v1/image/:taskId/status

file: file attributes: { projectId: number, name: string, description?: string, hasFeatureHeaders?: boolean }

The taskId is the identity of the task.

Response:

{
    payload: {
    taskId: string,
    state: string,
    datasetId?: string
    },
    status: "success"
}

The taskId field is the same as in the request URL. The state field will have one of the values pending, running, finished, or failed, reflecting the progress of the task. The datasetId field will be present if the task is finished, and will contain the dataset id attached to the project.

Example: Running

$ http --body https://jadapi.jadbio.com/api/public/v1/image/28/status \
       "Authorization: Bearer $(cat ~/.jadtoken)"
{
    "payload": {
        "state": "running",
        "taskId": "28"
    },
    "status": "success"
}

Example: Finished

$ http --body https://jadapi.jadbio.com/api/public/v1/image/28/status \
       "Authorization: Bearer $(cat ~/.jadtoken)"
{
    "payload": {
        "datasetId": "57",
        "state": "finished",
        "taskId": "28"
    },
    "status": "success"
}



Note of appreciation to JADBio users

We constantly make changes in the software and do our best to update these materials, but you may notice some differences. We welcome your feedback on how to make this more useful for you and requests for future tutorials.