LogoLogo
Go ToJoin the Community
  • Getting Started
    • Introduction
    • How it Works
    • Onboarding
  • Examples
    • Tutorials
      • Hello, World!
      • Image Generation w/ Stable Diffusion
  • CREATE WITH BYTENITE
    • Building Blocks
      • Apps
      • Job Templates
  • SDK
    • ByteNite Dev CLI
  • Launch with ByteNite
    • Data Sources
      • AWS S3
      • Google Cloud Storage
      • Storj
      • HTTP
      • File Upload
      • Temporary Bucket
    • Jobs
  • API Reference
    • Customer API
      • Jobs
        • Create
        • Read
        • Update
        • Manage
        • Other
      • Logs
      • Data Sources
      • Templates
      • Events
    • Authentication API
      • Access Token
      • API Keys
      • Secrets
      • User
    • Developer API
      • Apps
        • Metadata
        • Push
        • Manage
        • Pull
      • Engines
        • Metadata
        • Push
        • Manage
        • Pull
      • Templates
    • Wallet API
      • Balance
      • Transactions
      • Exchange Rate
      • Redeem Coupon
  • GUI
  • Other
    • Glossary
    • Feature Requests
    • Status
Powered by GitBook

© 2025 ByteNite Inc.

On this page

Was this helpful?

Export as PDF
  1. Launch with ByteNite
  2. Data Sources

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.

PreviousHTTPNextTemporary Bucket

Last updated 2 months ago

Was this helpful?