• Pages
  • /
  • Dealers
  • /
  • Data Depot
  • /
  • Version 4
  • /
  • API
  • /
  • Services
  • /
  • Images

Images

The Images endpoint allows you to retrieve information about images and their relationships to other entities.

Our images are now cataloged and tracked in our database and tied to other entities in a more relational fashion. In previous versions of our API, we simply stored a one-field reference to the filename. But now we store tons of additional data on images in their own database. The information that can be retrieved are things like the alt tags, image MIME type, width, height, size, and static references to the images CDN location on the web.

Example requests

Collection

https://api.wps-inc.com/images

Entity

https://api.wps-inc.com/images/96

...or send multiple ids separated by a comma(,)

https://api.wps-inc.com/images/96,52207,49944,18220,51112,48572

Associated Blocks

https://api.wps-inc.com/images/49944/blocks

Associated Brands

https://api.wps-inc.com/images/96/brands

Associated Items

https://api.wps-inc.com/images/18220/items

Associated Posts

https://api.wps-inc.com/images/51112/posts

Associated Products

https://api.wps-inc.com/images/48572/products

Associated Tags

https://api.wps-inc.com/images/1/tags

Associated Taxonomyterms

https://api.wps-inc.com/images/49957/taxonomyterms

Forming a full image URL

I've located the image I want to use, now what?

To create a full URI reference to a particular image on our CDN, you may combine the domain, path, and filename response elements. The last important piece of the full URI reference is the image style.

Image Styles

Starting in V4 of the API, every image we upload into our system gets created in four different derivatives:

  • 200_max
  • 500_max
  • 1000_max
  • full

Those derivatives are simply varying dimensions of the same image.

For example, if the API response looks like this:

{
    "id": 79468,
    "domain": "cdn.wpsstatic.com/",
    "path": "images/",
    "filename": "6dde-59cd72ea6f409.jpg",
    "alt": null,
    "mime": "image/jpeg",
    "width": 2706,
    "height": 2575,
    "size": 2708162,
    "signature": "8d3d02758b7b091f5a6acf7b7706ebdf92b92fc3f1c86380b7ada642f6812de9",
    "created_at": "2017-09-28 22:08:53",
    "updated_at": "2017-09-28 22:08:53"
}
                            

You would combine the four parts (domain, path, {style}, filename) to create a URI like so... http://cdn.wpsstatic.com/images/500_max/6dde-59cd72ea6f409.jpg

Since in the image URI we specified the 500_max style, the size of image we received is a proportionally resized 500px by 476px image with it's original ratio preserved.

Lastly, if you do not want to restrict the maximum size of the image at all and you want the fullsize image (the original size we uploaded the image at) you would simply use the full image style. Fair warning though, the full image style has absolutely no maximum sizing restrictions so images could potentially be up to 5000px or more!