How to upload project documents (zip files) via the HTTP API?
I guess that file documents need to be uploaded via "POST /api/http/uploads" with "storagePrefix: file". I managed to upload the file, get some kind of an id (like this 1NU9ho2sXaxE) and then use it as "blobId" with "POST /api/http/projects/{project}/documents" endpoint, but still getting the error: "File blob with the provided ID does not exist". What is the proper way to get a "blobId"?
Please sign in to leave a comment.
I haven't tried these steps for documents but they worked for me for creating issue's attachments (using "attachment" instead of "file" as "storagePrefix").
I think you need to do two different things. For uploading the file:
1. Call to post /api/http/uploads with storagePrefix=file to get a URL for the next step. You will receive something like "/uploads/1234567890abcdef"
2. Upload the actual file calling `PUT/ uploads/1234567890abcdef/myfilename.pdf' passing the required parameters (PUT to {URL_RETURNED}/{YOUR_FILE_NAME} ). For example with cURL:
After uploading the file probably you would be able to call "POST /api/http/projects/{project}/documents" endpoint with the "blobid" you already have.