For the complete documentation index, see llms.txt. This page is also available as Markdown.

File Upload

Uploading input files directly from your computer makes it convenient to process local content for tests.

We require a 4-step process for uploading local files, which involves configuring a data source, retrieving a temporary upload URL, uploading the file, and notifying the server upon completion.

1

Set Local File Data Source Object

dataSourceDescriptor: file

@type:type.googleapis.com/bytenite.data_source.LocalFileDataSource

When setting up a data source, use the following dataSource object to begin the local upload workflow:

POST /customer/jobs/{jobId}/datasource
{
  "dataSource": {
    "dataSourceDescriptor": "file",
    "params": {
      "@type": "type.googleapis.com/bytenite.data_source.LocalFileDataSource"
    }
  }
}
2

Retrieve a Temporary URL

After submitting the data source, fetch the generated temporary URL from the job's API response:

temp_url = job_response.json()['job']['dataSource']['params']['tempUrl']
3

Upload a File

Upload your local file to the temp URL previously fetched using a PUT request:

my_file = '/local/path/to/my/file.obj'

with open(my_file, mode='rb') as f:
    requests.put(temp_url, data=f, headers={'Content-Disposition': 'attachment'})
4

Notify Server of Successful Upload

Let the server know that your upload is ready via the "Upload Completed" endpoint.

response = requests.post(f'http://api.bytenite.com/v1/customer/jobs/uploadcompleted/{job_id}',
                                  json={}, headers={'Authorization': access_token})

This notification ends the workflow, linking the uploaded file to your job.

Last updated

Was this helpful?