The JourneyApps API (V1) → 11. Retrieving Photos/Signatures
Retrieving Photo and Signature Images
This section describes how to retrieve photo / signature images from the JourneyApps API.
Retrieving an object over the API with attributes that are photos or signatures (attachments) will return a display_attachments
field that contains a hash for each such photo/signature attribute. This hash will contain the Relative URL for a thumbnail, fullscreen and original version of the photo/signature image, relative to the Base URL for the environment (i.e. Testing/Staging/Production)
Region | Environment | Attachment Base URL: |
---|---|---|
United States | Testing | https://run-testing-us.journeyapps.com |
Staging | https://run-staging-us.journeyapps.com |
|
Production | https://run-us.journeyapps.com |
|
European Union | Testing | https://run-testing-eu.journeyapps.com |
Staging | https://run-staging-eu.journeyapps.com |
|
Production | https://run-eu.journeyapps.com |
|
Australia | Testing | https://run-testing-au.journeyapps.com |
Staging | https://run-staging-au.journeyapps.com |
|
Production | https://run-au.journeyapps.com |
|
South Africa | Testing | https://run-testing.journeyapps.com |
Staging | https://run-staging.journeyapps.com |
|
Production | https://run.journeyapps.com |
Example
Getting the Object
Let's say you retrieve a single object from the API, for example using curl:
In the response, there is a display_attachments
field that contains a hash for the attribute called photo
, with Relative URLs provided for a thumbnail version, fullscreen version and original version of the image:
Retrieving the image
Combining the Base URL and the Relative URL for the version of the photo/signature image you need (in this example we use the 'original' version) will give you the full URL for that image. For example, below we retrieve the full URL using curl:
Opening the full URL in the browser will display the photo/signature image. You can also use the URL programmatically to download the image and process it in your integration code.
Note: 'sha' Parameter is Required
The ?sha=
parameter seen at the end of the URLs is a hash-based message authentication code (HMAC) and is mandatory. If the ‘sha’ parameter is invalid or not present, the HTTP request to retrieve an attachment will fail with HTTP status code 400 with an error message in the response body, for example: “The SHA parameter you gave (880684c770e1874e) is incorrect”.
Updating the image
See the documentation for Updating an Object and the attachments section of Attribute Representation.