- Legion API
- Fragments
- Get fragment upload URL
Get fragment upload URL
const url = 'https://us-gov.legion.picogrid.com/v2/fragments/upload-url';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"terminal_id":"example","stream_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://us-gov.legion.picogrid.com/v2/fragments/upload-url \ --header 'Content-Type: application/json' \ --data '{ "terminal_id": "example", "stream_id": "example" }'Creates a file in our object storage server, and generates a presigned URL to upload an arbitrary file to this server.
The URL is valid for 5 minutes, after which you will need to request a new URL.
You upload the file by sending a PUT request to the url, with the object you want to upload in the body of the request. The file must be maximum 5GB in size.
If you have a usecase that needs more than 5GB objects, or need multipart uploads for reasons such as upload speed, please contact our support team at support@picogrid.com.
Request Bodyrequired
Section titled “Request Bodyrequired”Specify the terminal and stream this fragment belongs to
object
The terminal this fragment belongs to
The stream this fragment belongs to
Examplegenerated
{ "terminal_id": "example", "stream_id": "example"}Responses
Section titled “Responses”Presigned upload URL successfully generated
object
You will need to pass this file_id to the POST /fragments endpoint when creating the fragment after uploading this file
The presigned url which is valid for 5 minutes and you can upload to by making a PUT request with a file provided in the body of the request that is no larger than 5 GB. As mentioned in the endpoint description please contact support@picogrid.com if you have a usecase where you need multipart uploads for speed of upload or need to upload files larger than 5GB.
Examplegenerated
{ "file_id": "example", "upload_url": "https://example.com"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Bad Request Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Authentication Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Unauthorized Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Resource Not Found Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Timeout Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Bad Gateway Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Version 2 · commit 0771262
