Loading...
Was this page helpful?
This documentation provides a reference to the sdk.admin.upload
set of methods used to send requests to Medusa's Admin API routes.
This method creates a new upload. It sends a request to the Upload Files API route.
1sdk.admin.upload.create(2 {3 files: [4 // file uploaded as a binary string5 {6 name: "test.txt",7 content: "test", // Should be the binary string of the file8 },9 // file uploaded as a File object10 new File(["test"], "test.txt", { type: "text/plain" })11 ],12 }13)14.then(({ files }) => {15 console.log(files)16})
body
BaseUploadFilePromise
Promise<AdminFileListResponse>This method retrieves a file's details by its ID. It sends a request to the Get File API route.
id
stringPromise
Promise<AdminFileResponse>This method deletes a file by its ID from the configured File Module Provider. It sends a request to the Delete File API route.
id
stringPromise
Promise<AdminFileDeleteResponse>This method creates a presigned URL for a file upload. It sends a request to the
/admin/uploads/presigned-urls
API route.
Promise
Promise<AdminUploadPreSignedUrlResponse>