Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading files through the API #4

Open
cergfix opened this issue Aug 18, 2022 · 1 comment
Open

Uploading files through the API #4

cergfix opened this issue Aug 18, 2022 · 1 comment

Comments

@cergfix
Copy link

cergfix commented Aug 18, 2022

Hey!
I'm looking for a way to push/sync/upload batches of files through the API to the Media Library.

Is this supported? Are there any examples on how to do it?

@Eugeny
Copy link
Member

Eugeny commented Sep 7, 2022

Hi, sorry for the delay. We're using flow.js for chunked uploads, and you can follow the same request pattern to upload files as well.

Take a look at the following OpenAPI operations in your API playground:

  • registerUpload - sets up an upload (upload_id is your unique identifier and path is full server-side path)
  • registerUploadMetadata - optionally provides custom fields for a future upload
  • checkChunkUploaded - tells you whether a chunk chunk_number has already been uploaded for upload upload_id (HTTP 200) or not (HTTP 204) - this allows you to resume failed uploads
  • uploadChunk - parameters same as above, stores the chunk, chunk should be sent as a multipart/form-data field "file".
  • finishUpload - combines the received chunks and writes out the file onto storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants