Save Naturally - Images
This system is an essential part of transferring images from Save Naturally to GPC. On this page, we'll dive into the requests for sending, updating, and deleting images using the API.
File Naming Requirements
Image file names are case-insensitive and must only include lowercase letters (a–z), numbers (0–9), and hyphens (-).
Any file name that does not follow these requirements will result in a 400 Bad Request response with the error code invalid_file_name.
Error Codes
api_key_missing
The request's Authorization header did not contain an API key.
invalid_api_key
The API key failed to authenticate. Double check that it has not been rotated.
api_key_forbidden
The API key provided does not have permission to perform the requested action.
insecure_connection
A non-HTTPS request was detected. The exposed API key has been revoked and rotated.
no_body
The request body was empty.
bad_request
The event payload contains invalid data types or is missing required fields.
server_error
Something went wrong on our end. The GPC development team has been notified.
invalid_file_name
FIle name does not conform to the File Naming Requirements
Image Object
file_name
string
file_size
number
Size in bytes.
url
string
last_modified
utc timestamp
Example
Add or Update Image
Parameters
No parameters.
Attributes
No attributes.
Returns
A 201 Created response when a new image was created. A 202 Accepted response when an image was updated.
If an error occurs an Error model will be returned. If the request was successful an Image Object will be returned.
Request
PUT /v1/images/{filename}.{ext}
Response
Parameters
No parameters.
Attributes
No attributes.
Returns
Returns the binary contents of the specified image. If an error occurs an Error model will be returned.
Request
GET /v1/images/{filename}.{ext}
Response
Get List of Images
Parameters
No parameters.
Attributes
No attributes.
Returns
An array of Image Objects. If an error occurs an Error model will be returned.
Request
GET /v1/images
Response
Delete Image
Parameters
No parameters.
Attributes
No attributes.
Returns
A 204 No Content response upon success. If an error occurs an Error model will be returned.