Image Manager API Resources

The Image Manager API allows you to create, list, and modify policies, and organize images.

API Summary

Operation Method Endpoint
Policies
Get a Policy GET /imaging/v0/policies/{id}
Add or Modify a Policy PUT /imaging/v0/policies/{id}
Remove a Policy DELETE /imaging/v0/policies/{id}
List Policies GET /imaging/v0/policies
Get Policy History GET /imaging/v0/policies/history/{id}
Images
List Images to a Limit GET /imaging/v0/images{?limit}
List Images Matching a URL GET /imaging/v0/images{?url}
Get an Image GET /imaging/v0/images/{id}
List a Policy’s Images GET /imaging/v0/images{?policyId}

Get a Policy

Retrieve the policy definition by ID.

GET /imaging/v0/policies/{id}

Example: /imaging/v0/policies/small

Headers:

  • Luna-Token: ${Luna-Token}

Parameter Type Sample Description
Required
id String small Unique policy identifier.

Status 200 application/json

Response:

{
    "id": "watermark",
    "transformations": [
        {
            "transformation": "Composite",
            "image": { "url": "www.customer.com/watermark.png" },
            "xPosition": 0,
            "yPosition": 0,
            "gravity": "SouthWest"
        }
    ]
    "resolutions": {
        "interpolation": "Lanczos",
        "widths": [ 500, 300 ]
    },
    "outputs": {
        "defaults": { "quality": 90 }
    }
}

Add or Modify a Policy

Update the policy definition for a given ID.

If you want to activate a policy on the staging network, add -staging to the hostname used for the request. For example, you would use https://akab-xxxxx-xxxxxxxxxx.imaging-staging.akamaiapis.net/imaging/v0/policies/mobile-policy to activate a policy with an ID of mobile-policy on staging. To activate the same policy on production, you would use the following hostname: https://akab-xxxxx-xxxxxxxxxx.imaging.akamaiapis.net/imaging/v0/policies/mobile-policy.

PUT /imaging/v0/policies/{id}

Example: /imaging/v0/policies/small

Content-Type: application/json

Headers:

  • Luna-Token: ${Luna-Token}

Request:

{
    "resolutions": {
        "widths": [ 240, 120, 60 ]
    }
}

Parameter Type Sample Description
Required
id String small Unique policy identifier.

Status 200 application/json

Response:

{
    "operationPerformed": "UPDATED",
    "description": "Policy {id} updated.",
    "id": "{id}"
}

Remove a Policy

Remove a policy by ID.

DELETE /imaging/v0/policies/{id}

Example: /imaging/v0/policies/small

Headers:

  • Luna-Token: ${Luna-Token}

Parameter Type Sample Description
Required
id String small Unique policy identifier.

Status 200 application/json

Response:

{
    "operationPerformed": "DELETED",
    "description": "Policy {id} deleted.",
    "id": "{id}"
}

List Policies

Retrieve a list of all policy IDs.

GET /imaging/v0/policies

Headers:

  • Luna-Token: ${Luna-Token}

Status 200 application/json

Response:

{
    "totalItems": 2,
    "itemKind": "POLICY",
    "items": [
        { "id": ".auto" },
        { "id": "watermark" }
    ]
}

Get Policy History

Retrieve policy history by policy ID.

The returned object contains a list of log entries with the following members:

Member Type Description
Required
id String Policy ID
dateCreated String Date of log entry
policy String The policy, represented as a JSON string
action Enumeration The action that was logged, either UPSERT or DELETE
user String The user who did the modification

GET /imaging/v0/policies/history/{id}

Example: /imaging/v0/policies/history/testpolicy

Headers:

  • Luna-Token: ${Luna-Token}

Parameter Type Sample Description
Required
id String testpolicy Unique policy identifier.

Status 200 application/json

Response:

 {
    "itemKind": "POLICIESLOG",
    "items": [
        {
            "id": "testpolicy",
            "dateCreated": "2015-06-09 15:41:37+0000",
            "policy": "{\"id\":\"grayscale\",\"transformations\":[{\"transformation\":\"Grayscale\"}],\"resolutions\":{\"widths\":[500]},\"currentVersion\":1}",
            "action": "UPSERT",
            "user": "Akamai_Internal"
        }
    ],
    "totalItems": 1
}

List Images to a Limit

GET /imaging/v0/images{?limit}

Example: /imaging/v0/images?limit=2

Headers:

  • Luna-Token: ${Luna-Token}

Parameter Type Sample Description
Optional
limit String 2 Specifies maximum number images to retrieve.

Status 200 application/json

Response:

{
    "totalItems": 2,
    "itemKind": "IMAGE",
    "items": [
        {
            "id": "/images/image1.png",
            "url": "http://www.customer.com/images/image1.png",
            "policies": {
                ".auto": {
                    "sizes": {
                        "50": {
                          "date": "2016-03-22 13:05:59+0000",
                          "policyVersion": 1,
                          "status": "PASSED"
                        }
                    }
                }
            }
        },
        {
            "id": "/images/image2.png",
            "url": "http://www.customer.com/images/image2.png",
            "policies": {
                "watermark": {
                    "sizes": {
                        "200": {
                          "date": "2016-03-23 13:05:59+0000",
                          "policyVersion": 1,
                          "status": "PASSED"
                        }
                    }
                }
            }
        }
    ]
}

List Images Matching a URL

GET /imaging/v0/images{?url}

Example: /imaging/v0/images?url=http%3A%2F%2Fwww.customer.com%2Fimage2.png

Headers:

  • Luna-Token: ${Luna-Token}

Parameter Type Sample Description
Required
url String http://www.customer.com/image2.png URL to search for.

Status 200 application/json

Response:

{
    "totalItems": 1,
    "itemKind": "IMAGE",
    "items": [
        {
            "id": "/images/image2.png",
            "url": "http://www.customer.com/images/image2.png",
            "policies": {
                "watermark": {
                    "sizes": {
                        "200": {
                          "date": "2016-03-23 13:05:59+0000",
                          "policyVersion": 1,
                          "status": "PASSED"
                        }
                    }
                }
            }
        }
    ]
}

Get an Image

Return detailed information about a specific image.

GET /imaging/v0/images/{id}

Example: /imaging/v0/images/house%2Fimage1.jpg

Headers:

  • Luna-Token: ${Luna-Token}

Parameter Type Sample Description
Required
id String house/image1.jpg Identifies the image for which to retrieve metadata.

Status 200 application/json

Response:

{
    "id": "/house/image1.jpg",
    "url": "http://www.customer.com/house/image1.jpg",
    "policies": {
        ".auto": {
            "sizes": {
                "50": {
                  "date": "2016-03-22 13:05:59+0000",
                  "policyVersion": 1,
                  "status": "PASSED"
                }
            }
        }
    }
}

The object returned contains the following members:

Member Type Description
Required
id String Image ID.
url String Original URL of the image.
orderedImageCollectionIds Array Associated image collection IDs.
tags Array Associated image tags
policies Object Information about the policies that have been run with this image.

The policies section lists the following members for each applied policy:

Member Type Description
Required
date String The date of when the policy was applied.
policyVersion Number The version of the policy.
status Enumeration The current processing status of this image with the associated policy.
errors Array List of errors that happened during processing with the associated policy.

List a Policy’s Images

GET /imaging/v0/images{?policyId}

Example: /imaging/v0/images?policyId=watermark

Headers:

  • Luna-Token: ${Luna-Token}

Parameter Type Sample Description
Required
policyId String watermark Identifies the policy for which to get associated images.

Status 200 application/json

Response:

{
    "totalItems": 1,
    "itemKind": "IMAGE",
    "items": [
        {
            "id": "/images/image2.png",
            "url": "http://www.customer.com/images/image2.png",
            "policies": {
                "watermark": {
                    "sizes": {
                        "200": {
                          "date": "2016-03-23 13:05:59+0000",
                          "policyVersion": 1,
                          "status": "PASSED"
                        }
                    }
                }
            }
        }
    ]
}


Last modified: 12/14/2016