Create a PUT request
To upload a file using a PUT request, pass the following URI:You cannot pass registration parameters in a PUT request. For more information, see Specify the structure of a batch.
Content-type header field explicitly, and put the file to upload in the body of the PUT request.
The server also supports hash coding. Encode the MD5 hash value of the file in Base64 using UTF-16LE, and then pass it in the standard Content-MD5 header.
The server computes its own hash value for the file and compares it against the header. If the two values do not match, the server deletes the file.
Two server responses are possible:
- HTTP 201 (Created) – The file was uploaded to the server successfully.
- HTTP 400 (Bad request) – A required parameter is missing, or the hash function value does not match the value specified in the header. No file was uploaded.
Create a POST request
Use a PUT request when you can. If PUT is not an option, upload the file with a POST request instead. Pass theprojectName and batchType parameters in the URL, as in a PUT request, or as text fields in the request body.
Pass multiple images in one request
You can pass multiple images in one POST request. Set the value of theContent-type field to multipart/form-data and specify the separator value in the boundary parameter. The names of the files included in a request must not be the same.
The following example passes two files in a single request:
