latestOpenAPI 3.0.12026-08-082942150.5 KB

14cab8ac3bca

Input Units

Upload Input Units

You can upload input units to the project, which contributors will work on. Maximum size allowed is 250 MB of data.

How to upload

To know which properties should be used to upload the input units properly, you should use the GET INPUT UNIT SCHEMA endpoint. Please note that, the endpoint will return an object with required fields and their properties format for each input unit on the desired project. However, when uploading you need to create an array with those required fields, respecting their properties.

Configure your Amazon S3 bucket policy to grant cross-account access to Define.ai

You can use AWS S3 to store and submit your input units with the file URLs in S3:// protocol(for example, S3://bucket-name/key-name) rather than http:// or https:// protocol. Configure your S3 bucket policy to give permission to the following IAM role for Define.ai to access your files.

To do this, you must be the S3 bucket owner. Got to bucket >> permission >> bucket policy, and add the following policy

(Note that the place holder ${BucketName} should be replaced by your S3 bucket name)

{
    "Version": "2012-10-17",
     "Statement": [{
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::463637393528:user/prod-devteam-user"
            },
            "Action": [
                "s3:GetObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::${BucketName}/*",
                "arn:aws:s3:::${BucketName}"
            ]
    }]
}
        

How validation works

Two validations phases follow the upload operation. First, a synchronous phase and, if completed successfully, an asynchronous phase. Validation failure will return a list of up to 50 error codes and messages to resolve. Review these errors and upload the unsuccessful input units again.

The project state will change to PROCESSING DATA UPLOAD once there are input units passing all syntax and format evaluations.

Example of how validation and upload of Input Units work

You upload 1 000 input units. 100 validation errors are found. Remember the validation returns the first 50 error messages. Review the errors and correct errors for all 100 input units and reload the set of 100 (not all 1 000). Validation takes place (asynchronous phase), and successful input units are uploaded to the system.

Understand the project state based on asynchronous validation phase

Errors found will change the project state to either UPLOAD ERRORS or INSUFFICIENT DATA, depending on whether there is valid input unit(s). Retrieve the error list by using GET PROJECT ERRORS endpoint.

A single valid input unit will change the project state to PROCESSING DATA UPLOAD. Data can be added until the project state changes to PREPARING PROJECT.

Permission Required: Upload Data

post/v2.0/public/projects/{projectId}/inputUnits

Path parameters

projectIdstring uuid required
Example:00000000-0000-0000-0000-000000000000

Project ID.

Request body

object[] required

Example request

[
  {
    "audioSample": "S3://bucket-name/key-name",
    "sentenceSample": "This is a sentence sample.",
    "details": "This is a sentence details."
  },
  {
    "audioSample": "https://audio-sample.wav",
    "sentenceSample": "This is a sentence sample.",
    "details": "This is a sentence details."
  }
]

Response

Accepted. Job is updated asynchronously.

uploadIdstring uuid

ID for a set of uploaded input units.

Example response

{
  "uploadId": "00000000-0000-0000-0000-000000000000"
}