Get gallery images

Overview

Get the business's gallery images.

Use this to display them.

You'll need the account's company_id and the gallery type.

Returns the images: only active ones, newest first. With type=partners you get every image, inside data. With type=campaign you get one page of images (per_page, page), not wrapped, with links and meta.

Prerequisites

Base URL

EnvironmentURL
Productionhttps://production-api.shoutaboutus.com
Developmenthttps://development-api.shoutaboutus.com

Endpoint

GET /api/v1/account/images/get

Authentication

Partner or Account token

  • company_id must be inside your own account tree. A Partner token can use any account under the partner; an Account token only its own account.
  • An account outside your tree, or one that doesn't exist, is rejected with 422.

Rate limit

This endpoint has no rate limit.

Request parameters

ParameterInTypeRequiredDescription
company_idqueryintegerYesThe account. Must exist and be inside your account tree.
typequerystringYesWhich gallery: partners or campaign.
per_pagequeryintegerNotype=campaign only. Images per page, 10–100 (values below 10 are raised to 10; above 100 returns 422). Default 10.
pagequeryintegerNotype=campaign only. Page number. Default 1.

Request body

None.

Request payload

None.

Response body

There are two shapes.

  • type=partners: the payload is inside data: data.status and data.data (the images).
  • type=campaign: not wrapped. data is the page of images, next to links and meta.

Each image has the same fields.

FieldTypeDescription
data.statusstringtype=partners. success.
data.dataarray of objectstype=partners. The images (fields below). An empty array [] when there are none.
data[]array of objectstype=campaign. The images on this page, with the same fields as data.data[].
data.data[].idintegerThe image's id. Use it as image_id in Delete a gallery image.
data.data[].namestring or nullThe uploaded file's name (characters other than letters, digits, _, . and - become _).
data.data[].typestringpartners or campaign.
data.data[].statusstringactive.
data.data[].pathstring or nullThe image's URL.
linksobjecttype=campaign. first, last, prev and next page URLs.
metaobjecttype=campaign. Pagination: current_page, from, last_page, links, path, per_page, to, total.

Response payload

{
  "data": {
    "status": "success",
    "data": [
      {
        "id": 12,
        "name": "partner_logo.png",
        "type": "partners",
        "status": "active",
        "path": "https://d2ny6zb7otrnhl.cloudfront.net/account/images/partners/FJFBuzyn5khSrvAaJPN9IgKUsWfGQjXC9fw6SBhV.png"
      }
    ]
  }
}

Examples

Success payload

type=partners: see Response payload.

With type=campaign, a page of images:

{
  "data": [
    {
      "id": 8,
      "name": "campaign_banner.png",
      "type": "campaign",
      "status": "active",
      "path": "https://d2ny6zb7otrnhl.cloudfront.net/account/images/campaign/Xy7Pq2Lm9Nb4Vc1Zt8Rs3Kd6Wf0Gh5Ja.png"
    }
  ],
  "links": {
    "first": "https://production-api.shoutaboutus.com/api/v1/account/images/get?page=1",
    "last": "https://production-api.shoutaboutus.com/api/v1/account/images/get?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "« Previous",
        "page": null,
        "active": false
      },
      {
        "url": "https://production-api.shoutaboutus.com/api/v1/account/images/get?page=1",
        "label": "1",
        "page": 1,
        "active": true
      },
      {
        "url": null,
        "label": "Next »",
        "page": null,
        "active": false
      }
    ],
    "path": "https://production-api.shoutaboutus.com/api/v1/account/images/get",
    "per_page": 10,
    "to": 1,
    "total": 1
  }
}

Error payload

422 type is missing

{
  "message": "The type field is required.",
  "errors": {
    "type": [
      "The type field is required."
    ]
  }
}

422 company_id is missing

{
  "message": "The company id field is required.",
  "errors": {
    "company_id": [
      "The company id field is required."
    ]
  }
}

422 Account outside your tree

{
  "message": "The selected company id does not belong to your company hierarchy.",
  "errors": {
    "company_id": [
      "The selected company id does not belong to your company hierarchy."
    ]
  }
}

422 per_page is above 100

{
  "message": "The per page field must not be greater than 100.",
  "errors": {
    "per_page": [
      "The per page field must not be greater than 100."
    ]
  }
}
StatusMeaning
200The active images.
401The token is missing, expired or invalid.
422company_id or type is missing or not allowed, company_id is outside your tree, or per_page is above 100.
500Unexpected server error.

Example request

curl --request GET \
  --url "https://production-api.shoutaboutus.com/api/v1/account/images/get?company_id=5994&type=partners" \
  --header 'Authorization: Bearer <bearer-token>' \
  --header 'Accept: application/json'

Did this page help you?