getLocationPhotos

POST public/getLocationPhotos

Returns the photos for a location, optionally with each photo's thumbnail image.

Request syntax

curl https://apiv2.acumera.net/public/getLocationPhotos \
  --cookie av_session.txt \
  --data-urlencode "location_id=<location_id>" \
  [--data-urlencode "include_thumbs=1"]

Optional parameters are shown in brackets. The username, password, and tfa_token parameters are also accepted, and are required only if the client hasn't already signed in with login. See Getting started with the SC//AcuVigil API.

Request parameters

The request accepts the following parameters in a form-encoded body.

Parameter Type Description Required Default value
location_id Integer The ID of the location. To find location IDs, use getCompanyInfo with include_sites=1. Yes
include_thumbs Integer Set to 1 to include each photo's thumbnail image. No 0

Response syntax

{
    "success": "string",
    "data": {
        "location_photos": [
            {
                "id": "string",
                "filename": "string",
                "thumbnail_filename": "string",
                "description": "string",
                "created": "string",
                "created_by": "string",
                "created_by_name": "string",
                "editable": number,
                "content_length": "string",
                "content_type": "string",
                "image_content": "string"
            }
        ]
    }
}

Response parameters

If the call succeeds, success is "1" and the following data is returned.

Field Description
location_photos The photos. Empty if the location has none.
id The photo's ID. Use it with updateLocationPhoto and deleteLocationPhoto.
filename The photo's stored filename. Use it with getLocationPhoto to get the full-size image.
thumbnail_filename The thumbnail's stored filename.
description The photo's description.
created When the photo was added, as a Unix timestamp.
created_by, created_by_name The user ID and name of the person who added the photo.
editable 1 if you can edit or delete the photo, otherwise 0. This is a number, not a string.
content_length Only with include_thumbs=1: the thumbnail's size in bytes.
content_type Only with include_thumbs=1: the thumbnail's MIME type.
image_content Only with include_thumbs=1: the thumbnail, base64-encoded.

Errors

If the call fails, success is "0", and returnCode and returnMessage describe the problem. The HTTP status is still 200.

Return code Message Cause
NO_LOCATION_SELECTED No location was selected or the location does not exist. location_id is missing or isn't a number.
LOCATION_NOT_FOUND The location was not found. No location has that ID.
AUTH_FAILED_FUNC_NOT_ALLOWED Authorization failed because you are not permitted to access the requested function. Your account doesn't have access to the location.
INVALID_LOGIN We were unable to log you in. Make sure you entered the correct username, password and 2FA code. You haven't signed in, your session has ended, or the credentials sent with the call are wrong.

Examples

Example: List the photos for a location

curl https://apiv2.acumera.net/public/getLocationPhotos \
  --cookie av_session.txt \
  --data-urlencode "location_id=4510"

Response:

{
    "success": "1",
    "data": {
        "location_photos": [
            {
                "id": "19130",
                "filename": "rack_1793398093.png",
                "thumbnail_filename": "rack_1793398093_.png",
                "description": "Network rack",
                "created": "1793398093",
                "created_by": "1001",
                "created_by_name": "Pat Example",
                "editable": 1
            }
        ]
    }
}

Example: Include thumbnails

curl https://apiv2.acumera.net/public/getLocationPhotos \
  --cookie av_session.txt \
  --data-urlencode "location_id=4510" \
  --data-urlencode "include_thumbs=1"

Response (image_content shortened):

{
    "success": "1",
    "data": {
        "location_photos": [
            {
                "id": "19130",
                "filename": "rack_1793398093.png",
                "thumbnail_filename": "rack_1793398093_.png",
                "description": "Network rack",
                "created": "1793398093",
                "created_by": "1001",
                "created_by_name": "Pat Example",
                "editable": 1,
                "content_length": "9775",
                "content_type": "image/png",
                "image_content": "iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAIAAACzY+a1..."
            }
        ]
    }
}

Example: The location has no photos

{
    "success": "1",
    "data": {
        "location_photos": []
    }
}