Downloading Photos from CloudCard
An External Downloader for CloudCard is any application that polls the API for photos ready to be downloaded, and saves them to another system. There are several options available for performing this integration.
Without any customization, Approved photos can be downloaded by clicking the "Download Photos" button. This will package up all currently approved photos into a zip file, it will download to your computer, and the photos will be moved to the Downloaded queue.
This process can be automated with the following logic:
CloudCard user approves photos.
CloudCard user views approved photos and clicks a "Download" button.
The approved photos are then marked as "Ready for Download".
This requires the organization to have the external download strategy. Consult your CloudCard representative if you don't know what that means.
We can also modify the text of the "Download" button. For example, you could make that button say "Send photos to Card Printer".
Your external downloader polls the server at a suitable interval, using the Photo List request with a status ofÂ
READY_FOR_DOWNLOAD
.We have recently developed Status Queues as an alternative to polling. Your code would subscribe to an SQS queue connected to the
READY_FOR_DOWNLOAD
status (or any other appropriate status)Â and download photos when messages were received from the queue.Â
If the list contains photos, download each photo's bytes from theÂ
photo.links.bytes
value in the JSON output. (This link corresponds to the Get Binary Photo Data request).Once you have the bytes in your application, you can either write them to the file system, save them to a database, or send them to another API endpoint – whatever suits your application.
In order to prevent your application from processing the same photo multiple times, you will want to mark it as downloaded. To do this, send an Update Photo request with a status ofÂ
DOWNLOADED
.Â
This logic has already been implemented in the open source CloudCard Photo Downloader which we maintain and support. You are welcome to set it up yourself, or even simply reference the code.
Another customization option is to download approved photos without having to click the Download Photos button. You can do this by querying the Photo List API with a status of APPROVED
in addition to READY_FOR_DOWNLOAD
(or configuring the CloudCard Photo Downloader to check both statuses).Â