Amazon CloudFront
API Reference (API Version 2013-05-12)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

POST Invalidation

Description

This action creates a new invalidation batch request. For more information about invalidation, go to Invalidating Objects in the Amazon CloudFront Developer Guide.

Important

You can only invalidate objects that are served by a download distribution. You cannot invalidate objects that are served by a streaming distribution.

To create an invalidation batch request, you do a POST on the 2013-05-12/distribution/distribution ID/invalidation resource. The request body must include an XML document with an InvalidationBatch element. The response echoes the InvalidationBatch element and returns other information about the invalidation batch.

Important

Beginning with the 2012-05-05 version of the CloudFront API, we made substantial changes to the format of the XML document that you include in the request body when you create or update a download distribution or a streaming distribution, and when you invalidate objects. With previous versions of the API, we discovered that it was too easy to accidentally delete one or more values for an element that accepts multiple values, for example, CNAMEs and trusted signers. Our changes for the 2012-05-05 release are intended to prevent these accidental deletions and to notify you when there's a mismatch between the number of values you say you're specifying in the Quantity element and the number of values you're actually specifying.

Requests

Syntax

POST /2013-05-12/distribution/distribution ID/invalidation HTTP/1.0
Host: cloudfront.amazonaws.com
Authorization: AWS authentication string
Content-Type: text/xml
Other required headers

<?xml version="1.0" encoding="UTF-8"?>
<InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
   <Paths>
      <Quantity>number of objects to invalidate</Quantity>
      <Items>
         <Path>/path to object to invalidate</Path>
      </Items>
   </Paths>
   <CallerReference>unique identifier for this invalidation batch</CallerReference>
</InvalidationBatch>

Headers

The request must include the headers required in all CloudFront requests. For more information, see Common REST Headers.

Elements

NameDescription

InvalidationBatch

The batch information for the invalidation. For more information, see InvalidationBatch Complex Type.

Type: InvalidationBatch complex type

Default: None

Responses

Syntax

HTTP/1.0 201 Created
Content-Type: text/xml
Location: https://cloudfront.amazonaws.com/2013-05-12/distribution/distribution ID/invalidation/invalidation ID
<Invalidation xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
   <Id>id that CloudFront assigned to the invalidation</Id>
   <Status>InProgress | Completed</Status>
   <CreateTime>date and time of request</CreateTime>
   <InvalidationBatch>
      <Paths>
         <Quantity>number of objects to invalidate</Quantity>
         <Items>
            <Path>/path to object to invalidate</Path>
         </Items>
      </Paths>
      <CallerReference>unique identifier for this invalidation batch</CallerReference>
   </InvalidationBatch>
</Invalidation>

Headers

NameDescription

Location

The fully qualified URI of the distribution and invalidation batch request, including the Invalidation ID.

Type: String

Elements

NameDescription

Invalidation

Information about the invalidation. For more information, see Invalidation Complex Type.

Type: Invalidation datatype

Special Errors

The following table lists the special errors returned in addition to the common errors that all actions return. For more information, see Errors.

ErrorDescriptionHTTP Status Code

TooManyInvalidationsInProgress

You have exceeded the maximum number of allowable InProgress invalidation batch requests, or invalidation objects.

400

Examples

The following example request creates a new invalidation batch request. The request invalidates two image objects and a Flash movie object.

Sample Request

POST /2013-05-12/distribution/distribution ID/invalidation HTTP/1.0
Host: cloudfront.amazonaws.com
Authorization: AWS authentication string
Content-Type: text/xml

<InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
   <Paths>
      <Quantity>3</Quantity>
      <Items>
         <Path>/image1.jpg</Path>
         <Path>/image2.jpg</Path>
         <Path>/videos/movie.flv</Path>
      </Items>
   </Paths>
   <CallerReference>20120301090001</CallerReference>
</InvalidationBatch>

Sample Response

HTTP/1.0 201 Created
Content-Type: text/xml
Location: https://cloudfront.amazonaws.com/2013-05-12/distribution/distribution ID/invalidation/invalidation ID

<Invalidation xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
   <Id>IDFDVBD632BHDS5</Id>
   <Status>InProgress</Status>
   <CreateTime>2009-11-19T19:37:58Z</CreateTime>   
   <InvalidationBatch>
      <Paths>
         <Quantity>3</Quantity>
         <Items>
            <Path>/image1.jpg</Path>
            <Path>/image2.jpg</Path>
            <Path>/videos/movie.flv</Path>
         </Items>
      </Paths>
      <CallerReference>20120301090001</CallerReference>
   </InvalidationBatch>
</Invalidation>