Using ImageService to get an image by its ID
Request
If you know the ID of an image, you can retrieve it from ImageService by sending a GET request to:
http://imageservice.<operator.com>/images/v1/image/imageid/{imageId}
Note that the ImageService uses a different subdomain from other OPF services – imageservice instead of api.
Headers
Content-Type: image/jpeg
Mandatory arguments
imageId– the ID of image
Other arguments
One of the following combinations:
widthandheightwidthandaspectheightandaspect
imageFormat– the required image format. Available values:webp. Default (if not specified): JPEG.dominantDimension– the dimension that should take precedence when calculating dimensions/aspect ratio. Available values:width,height.
Notes:
If an image is letterboxed (that is, ImageService adds padding to convert the image to match the requested aspect ratio), the padding will be:
Transparent if the image is WebP.
Black if the image is JPEG.
If you need transparent padding, request WebP images.
If you provide
width,height, andaspect, onlywidthandaspectare used –heightis ignored.If you specify an aspect ratio,
dominantDimensionis ignored andwidthis used as the dominant dimension.
Example
A GET request like this:
http://imageservice.<operator.com>/images/v1/image/imageid/eaac4ddd-4749-4e2c-8d89-aa226ff98288
... returns the image with the specified ID. ImageService does not resize or letterbox the image, as no dimensions are specified.
Responses
A successful request returns an HTTP 200 status.
If the ImageService had to use letterboxing to convert an image with a different aspect ratio to the one requested, the aspectMatch field in the response will have a value of false.
A bad request returns an HTTP 400 status.
If the image does not exist, the request returns an HTTP 404 status.
See also
For full details of this API, see the ImageService API documentation.