A method for uploading an image to Resighting. This method is used for all image uploads (i.e. both for user avatars and Sighting evidence) and returns a blobtracker Id, which is then passed in the subsequent call to (currently only) the CreateSighting method to specify the image to be used. After approximately ten minutes the uploaded image is deleted if it has not been consumed by another API method.
There is no fixed url for the upload, you must first call the method UploadUrl to get a unique url to use for your upload. The issued url is also only valid for ten minutes, after which time the method will respond with a 303 redirect to a page that responds with a 500 server error. There is no way specifically to detect whether a 500 response is due to a url expiry, but usually for a server error API methods will respond with a 500 response and include an Error object as the response body, but in the case of url expiry the response body is an HTML page.
Image file types supported are jpeg, png, webp, gif, bmp, tiff and ico.
Url: See method UploadUrl
HTTP Method: POST
|access_token||String(32)||Yes||A valid access token.|
|sandbox||Boolean||No||Whether the method should run in sandbox mode - no writes will be made to the datastore.|
|any||Binary(10MB)||Yes||The image to be uploaded. Note that the parameter name is not important.|
Returns an Upload object and HTTP status 200, or an Error object and HTTP status 4xx or 5xx. If the sandbox parameter was set then the returned object will contain dummy data and a boolean attribute named sandbox, which will have the value True. See the section on sandboxing for more details.
Note the use of the --location curl option so that curl follows redirects. This is required in the case that the upload url has expired as the response is a redirect to another page that responds with a 500 server error.
curl https://resighting-api.appspot.com/_ah/upload/AMmfu6bcHPG-VQu90zGMCleIhbkKceGdFVTKr07hV0NKEqB1L-qqfu1n9_S8JrXDqmzYXU9VbYWQ_Q-CzNMGcrjkBJb53An7NKbQ10BvYQTfvffNIuDSn4D_1GWXSJw5seJ-skgzHD45/ALBNUaYAAAAAT5g_MpvLVWDUZ28AbzW_PhX6NZ-RQcnC/ --location --form email@example.com --form access_token=ACCESS_TOKEN