Upload API

UploadCare uses a special API for uploading files (and only for that). You don’t need a secret key for that API, which means you can use it in places where you can’t hide the source code of your application (e.g., in client JavaScript).

Uploading from external URL

Base URL: http://upload.uploadcare.com/from_url/

Required parameters (GET or POST):

  • pub_key - your public key
  • source_url - the source URL

Returns a JSON dict:

{"token": "7a4ac8f9-4cf5-49b0-96a5-4c010d911a76"}

The token is used for checking status of the downloading:

Status check

Base URL: http://upload.uploadcare.com/from_url/status/

Required parameters (GET or POST):
  • token - the token of downloading file

Returns a JSON dict, one of the following:

{'error': 'Token is required'}
      # in case of errors

{'status': 'unknown'}
      # that means that the file is not ready yet, check again in a second

{"status": "progress", "total": 3301715, "done": 278528}
      # file is being downloaded

{"status": "success", "total": 3301715, "done": 3301715, "file_id": "33a17c23-7d25-40a5-b954-18b1aa993167", "original_filename": "tmp1xohzW.zip"}
      # file is ready

Example:

$ curl http://upload.uploadcare.com/from_url/ -d 'pub_key=d07d12ae31b52d365ed3570dd651201f737d673c130c15185d53057e3b903ess&source_url=http://thedoghousediaries.com/comics/uncategorized/2011-05-16-2839d14.png'
{"token": "7a4ac8f9-4cf5-49b0-96a5-4c010d911a76"}

$ curl http://upload.uploadcare.com/from_url/status/ -d 'token=7a4ac8f9-4cf5-49b0-96a5-4c010d911a76'
{"status": "success", "total": 47349, "done": 47349, "file_id": "bf2a7066-cafc-40c3-a82a-948543f7ef10", "original_filename": "tmpM4EAOM.png"}

Project Versions

Table Of Contents

Previous topic

REST API

Next topic

Resizing Images

This Page