Autoclipping bulk API documentation v1

V1 Endpoint

https://knj39gne6j.execute-api.us-east-1.amazonaws.com/api-v1

Authentication

All requests are authenticated with a token, which is placed in the HTTP header of a request in the Authorization field

Example implementation

https://github.com/autoclipping/bulk-clipping-angular-client

Resources and methods

/batch

GET - Get a list of available batches.

Example Request - Query string parameters

/batch?curr_offset_key=1299164%232018-09-27T08:47:58.334188%23089b35ac-c232-11e8-94e7-2eca645cff97

Example Response - JSON
{
   "next":{
      "curr_offset_key":null
   },
   "previous":{
      "curr_offset_key":"1299164#2018-09-27T08:47:58.334188#089b35ac-c232-11e8-94e7-2eca645cff97"
   },
   "results":[
      {
         "batchId":"1299164#2018-10-11T18:35:43.086372#75d1f888-cd84-11e8-8fa1-0a23843087ba",
         "clientId":"1299164",
         "created":"2018-10-11T18:35:43.086372",
         "batchName":"h\u00f5issaa! a",
         "numberOfImages":"42",
         "numberOfImagesUploading":"1",
         "numberOfImagesProcessing":"0",
         "numberOfImagesDone":"0",
         "numberOfImagesTouchUpQueue":"0",
         "numberOfImagesReadyToDownload":"0",
         "numberOfImagesDownloaded":"41",
      },
      ...
   ]
}
      		

POST - Create a new batch.

Example Request

/batch

Simply make a post request without any additional data or query string parameters.

Example Response - JSON
{
   "name":"test",
   "batchId":"1299164#2018-10-17T22:33:24.411006#a8b5e2c8-d25c-11e8-8116-56c74ac2757a"
}
            

/batch/{batch-id}

GET - Get info about a batch, including a detailed list of images belonging to a given batch.

Example Request

/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a

Example Response - JSON
{
   "batchId":"1299164#2018-10-17T22:33:24.411006#a8b5e2c8-d25c-11e8-8116-56c74ac2757a",
   "clientId":"1299164",
   "created":"2018-10-17T22:33:24.411006",
   "batchName":"test",
   "numberOfImages":"1",
   "numberOfImagesUploading":"1",
   "numberOfImagesProcessing":"0",
   "numberOfImagesDone":"0",
   "numberOfImagesTouchUpQueue":"0",
   "numberOfImagesReadyToDownload":"0",
   "numberOfImagesDownloaded":"0",
   "batchImages":[
      {
         "imageId":"1299164#2018-10-17T22:33:24.411006#a8b5e2c8-d25c-11e8-8116-56c74ac2757a#1299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB",
         "fileName":"CXLT_Coffee.jpg",
         "thumbUrl":"https://acimgstore.s3.amazonaws.com/1299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB_thumb.jpg",
         "previewUrl":"https://acimgstore.s3.amazonaws.com/1299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB_preview.jpg",
         "status":"file_processing"
      },
      ...
   ],
   "zipUploadBucket":"acimgstore",
   "zipUploadKey":"1299164xa8b5e4e4-d25c-11e8-8116-56c74ac2757aORIB.zip"
   "uploadCredentials":{
      "accessKeyId":"ASIARNPLBM6XUSK5SZIH",
      "secretAccessKey":"av8/99Ud2cyGh8QCiaXadCBZPmlCefHA9dfdwJOk",
      "sessionToken":"FQoGZXIvYXdzEGAaDNEOdIxXqDVHnfryCCKkAnaGgg2m0s6AZwU6lQWa2SymRX6lSHHnezwHHzSWdHSM2ApFYnTvQbsunLyHE988OPj5ieXa/LMs/kud/ZJYSitLJ3UJDlT2s9E5eIeIIY5GHSgCLFO1+dy0m53MgrnpUz/IWmLjvcP7IvjP1XfOgXzoTUdFvJC3HrTt1Xd2fWsOCKhtPArMDDTCYBEVZ44YJ29dFESdHKW+LPXtAxJVpAnDmVML/uh+uz6vsDnXKnFT+9kiYS5xc0BOSy0CZpACueM9OgcTClXp9dEL3SfLtzb/HGvb5X4Bd61xM706vhi0AKtWGbGwAwGlgHnP0/J/8lZlmorjwwKvYLXd7MLTzJNcNYWTKeoWAkao/KV5wuVDhvSaIVaJlz8B2dQ/ShllBMY5Asso+/ue3gU=",
      "expiration":1539817855.0
   },
}
            

A note on zip uploads - Once a zip file has been uploaded to S3, it will be extracted by the system on the server side and image files in it that are able to be read will be added to the batch. No further action is needed other than the uploading of the file to the correct bucket and key in AWS S3.

PATCH - Edit the name of a batch

Example Request - JSON

/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a

{
    "batchName": "test a"
}
            
Example Response - JSON
{}
            

/batch/{batch-id}/download

POST - Initiate the creation of a zip file containing images in a batch marked for download.

Example Request - JSON

/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a/download

{
    "format": "png"
}
            
For files that have not been previously downloaded and are added to the zip file - credits will be deducted from the account
Example Response - JSON
{}
            

GET - While the zip file is being created, indicated progress. When the zip file has been created returns a download link.

Example Request

/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a/download

Example Response - JSON
Response when zip file generation is in progress
{
    "zipProgress": "0.49"
}
            
Response when zip file has been generated and uploaded to S3 for download
{
    "zipLink": "https://aczipbucket.s3.amazonaws.com/1299164-67f6e164-d267-11e8-9c8c-c6b064c2f980.zip?AWSAccessKeyId=ASIARNPLBM6X2QSMPPPW&Signature=0ff1wKapWEHrgiA22cKDYSvcUPU%3D&x-amz-security-token=FQoGZXIvYXdzEGEaDKjuNZoLcYcxT7Mz0yLpAaYRXI9e3gxXiQWg82yHBubzBXqeYE9H%2FLbO4tn11RrAchm3YB7xvHmXA8YPggSSBfcBShXXn2AxxXU4M7xgyqU8a%2FmcZGIYwQRXZrnPDxxY%2B8u9xpoOFuEpFVZ1asIP2tHiE92YPY28YupAV9A8KmTVGWC3ljrZy9jtfYM5XHmgAPg%2FeEEc5wNEhJc%2FJxgZAAUPwb%2FZmdw%2FhbfXEtG0LKp8fJ7rG20lXZZKSdg4vvqDd2wd98GXWpmB2HeX3NFTpa4PFO1XSTDRNfqoC4k8S9FKGXfPg6MKaYxE63Pa%2Bkyk8nyN7ZN2xQ8DKOaJn94F&Expires=1539820320"
}
            

/batch/{batch-id}/image

POST - Create a new image in a batch.

Example Request JSON
/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a/image
{
  "fileName":"uploaded_file_name.jpg"
}
            
Example Response - JSON
{
   "imageId":"1299164#2018-10-17T22:33:24.411006#a8b5e2c8-d25c-11e8-8116-56c74ac2757a#1299164xcff87aa0ce78cb099f09f286e75c6c41e635f74846d7f34462a705b57e81072f598a638c68f6f2135c86282914495a0c91b2b5050d74af6a92e91d8101e5bec7x5bc7ce03xORIB",
   "key":"1299164xcff87aa0ce78cb099f09f286e75c6c41e635f74846d7f34462a705b57e81072f598a638c68f6f2135c86282914495a0c91b2b5050d74af6a92e91d8101e5bec7x5bc7ce03xORIB",
   "bucket":"acimgstore",
   "uploadCreds":{
      "accessKeyId":"ASIARNPLBM6X4DLSGR4L",
      "secretAccessKey":"q4M7dSKP+qlOfYhIX3y92eKqZNU+HC3lZ96NSXGv",
      "sessionToken":"FQoGZXIvYXdzEGIaDF63o7f89bhBPe6xESKkAnMSfp0PeSkxEWIYcMWnvUn6iWqtfcGI81H+pJMbTP2MdUBIuZXdDsx1iZSrWwKaLqn6YYMsHtGgnLPXRk4xBO2vE5O/7MdEDMrjZYQcrUpvt0nEjOZM9AK/rQ3dGa1epGOoOgaMF07Pelc7uPJ3a64lw+4HzeVZSYHAjeuIZxFmMzmHKFzXb3OHaEOih28GSHyX6idTJ6MTnEoE81duxlmDS7pApIQ53mYL+3zTUCNATBiI+geKPMAEj/0CMGtli5Es2zxDqXVe70FYWMHLClYFerKCmYAcWfG8N4RO6P6dk/gXDJIyR26C0Og2eS4s6GrwJsjLIWP8h/NbfhM9LeeUjcoXiM1D+/uakvUYeY2Q5OoIanppiOStrQF3q058bch6JvAog5yf3gU=",
      "expiration":1539821959.0
   }
}
            
A note on image uploads - Images that are larger than 4 megapixels must be rescaled to 4 megapixels while retaining their aspect ratio before uploading them to S3. Also, uploads must be converted to JPEG with quality of 95. These limitations on image format are also enforced on the server side, but to increase upload speed and save bandwidth along with S3 storage space, resizing and format conversion should be done on the client side as well. Image processing will start when the image has been uploaded to S3 after receiving this response.

/batch/{batch-id}/image/{image-id}

PATCH - Change image state in a batch (mark for download, touch up and so on).

Example Request - JSON
/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a/image/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a%231299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB
{
    "status": "file_ready_to_download"
}
            
Example Response - JSON
Returns info about the changed image
{
   "imageId":"1299164#2018-10-17T22:33:24.411006#a8b5e2c8-d25c-11e8-8116-56c74ac2757a#1299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB",
   "fileName":"CXLT_Coffee.jpg",
   "thumbUrl":"https://acautomatc.s3.amazonaws.com/1299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB_thumb.jpg",
   "previewUrl":"https://acautomatc.s3.amazonaws.com/1299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB_preview.jpg",
   "status":"file_touch_up_queue"
}
            

DELETE - Delete an image from a batch.

Example Request
/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a/image/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a%231299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB
Example Response - JSON
                {}
            

/batch/{batch-id}/image/{image-id}/download

GET - Get a download link of an individual image in a batch. Image must be marked for download for this operation to be allowed.

Example Request - query string parameters
/batch/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a/image/1299164%232018-10-17T22%3A33%3A24.411006%23a8b5e2c8-d25c-11e8-8116-56c74ac2757a%231299164x1a468570bcfb5e613ba902daf91def73400ccd9552941bdce1fecfd5d69d6f0ec3d5349e53d948a26e9a282eecf4ff44a7777f512bee4605de6761eae5a21518x5bc7bde6xORIB/download?format=png
1 download credit will be deducted from the user's account upon this action, but only if the image has not been downloaded before.
Example Response - JSON
{
   "downloadLink":"https://acautomatc.s3.amazonaws.com/1299164xcff87aa0ce78cb099f09f286e75c6c41e635f74846d7f34462a705b57e81072f598a638c68f6f2135c86282914495a0c91b2b5050d74af6a92e91d8101e5bec7x5bc7ce03xORIB_result.png?AWSAccessKeyId=ASIARNPLBM6XW46BHDE5&Signature=5%2FbJi7f2%2FoE3uqSKjMonCIup9Zg%3D&x-amz-security-token=FQoGZXIvYXdzEF8aDFePY1g0cqj06idzZyLnAaOclid%2B0W3z8y5BPtyJU6dyFxq88j6N93WEBfwQEv7KKHfutBuIQmeDKCQpbusGdmgXdGf6dJ7lbAszGPAo1PTlPPGkJBKCdOzczkFJCA45GqLToKsoVHUm6fe4spMcJku5t0B8FnBvI3A69qVpSo8zNzSij93TKJ4p%2B%2FHqXhasAK7EiK60Ci2fx8OGfpSInyGhMKox2f1NnQVnxNv%2F8tpOhtPpoq%2ByurmLnEdWTyFOumxsQ%2FnrNtDrE%2FP8pvFCcBP9sZ7vFij1R84HBmG%2B88PZSP%2BN75N%2F3p087YyKrhCiBxZkkSYoiSid1p7eBQ%3D%3D&Expires=1539823240"
}
            

/mojo-and-credits

GET - Get image processing mojo and download credits remaining on current user account.