Important changes in image URL paths

Clients manipulating or replacing URLs are strongly recomended to read more.

Image sizes

Description:

The image-size resource is a configuration service that allows you manipulate images URLs to get image in alternative physical sizes.

It provides data necessary to do string replacement on the original image URL to get a new URL to a different image size.

Responsive web and Apps need images in a variety of sizes to provide a good user experience and reduce network load. By using this simple configuration service you can choose from images ranging from 80px to 1598 px

Location:

The image-size workspace in the Service Document contains a link to the image-size resource:

<workspace>
  <atom:title>image-size</atom:title>
  <atom:link href="https://cache.api.finn.no/iad/image/size" rel="description" type="application/json"/>
</workspace>

Sample:

An example of a typical output:

{
  "pattern": "/dynamic/default/",
  "availableSizes": [
    {
      "width": 80,
      "replacement": "/dynamic/80w/"
    },
    {
      "width": 228,
      "replacement": "/dynamic/228w/"
    },
    {
      "width": 320,
      "replacement": "/dynamic/320w/"
    },
    {
      "width": 400,
      "replacement": "/dynamic/400w/"
    },
    {
      "width": 480,
      "replacement": "/dynamic/480w/"
    },
    {
      "width": 640,
      "replacement": "/dynamic/640w/"
    },
    {
      "width": 960,
      "replacement": "/dynamic/960w/"
    },
    {
      "width": 1280,
      "replacement": "/dynamic/1280w/"
    },
    {
      "width": 1600,
      "replacement": "/dynamic/1600w/"
    }
  ]
}

Methods:

GET
HEAD

Parameters:

No query parameters available.

Implementation:

The preferred way to use the API is:

  1. Get the image-size workspace from the Service Document
  2. Get the image-size resource from the link in the workspace
  3. Get the pattern value from the resource
  4. Get the most appropriate image-size from the list of availableSizes: Let's say you want images that are at least 300 px wide. Iterate over the width-values and pick your best match for replacement (here: /dynamic/320w/)
  5. Replace the pattern with the replacement in the original image URL

Point 1-4 only executed during application start-up.

© 1996 - 2022 FINN.no AS