Front-End Optimization API v1

Use FEO features to programmatically create modified versions of your assets that render faster.

Learn more:


Overview

The Front-End Optimization (FEO) API provides a way to use FEO functionality programmatically rather than through FEO’s Configuration Manager.

FEO accelerates web pages by creating modified versions of the HTML and supporting resources that can render more quickly. The techniques FEO uses to accelerate pages are called optimization methods (or just optimizations). Some optimization methods are specific to resource files such as images, JavaScript, and style sheets. Other optimizations adjust the prioritization and queuing of rendering activities.

Who should use this API

This API is intended for developers who want to automate FEO management. To use this API, you should be familiar with your existing FEO configuration and the content it is optimizing, as well as the parent product configuration. You should know how to manage FEO configurations in FEO’s Configuration Manager (accessible from the Configure menu from a Property Manager page specific to a property that has FEO enabled in its configuration), including activation and purging. It is important to have a general understanding of how FEO works, including page analysis, creating transformation bundles, optimizing pages and resources, and delivering origin vs. optimized content.

If you are not familiar with those concepts, please review the Front-End Optimization User Guide before proceeding.

Resources

The Front-End Optimization Portal API is a service for accessing FEO Portal functionality.

API summary

Operation Method Endpoint
Purge a Configuration POST /feo/v1/purge

Purge a configuration

POST /feo/v1/purge

Content-Type: application/json

Request:

{
    "assetName": "My Main Site",
    "network": "S",
    "comments": "Spring catalog updates on main site"
}

Status 200 application/json

Response:

{
    "assetId": 1234567,
    "errorCode": 400
}

Usage

At this time, there is only one resource available: Purge.

Action Operation API Endpoint
Purge FEO Transformation Bundle POST /feo/v1/purge

Purge FEO transformation bundle

How FEO Purge Works: The FEO API will delete all transformation bundles for an assetName. The network checks the status of transformation bundles about every five minutes. If it finds that a transformation bundle has been deleted, the FEO analyzer performs a new analysis and generates a new configuration bundle. If resources have been added or modified, the FEO transformer re-optimizes them.

Usage Scenario: The product catalog on your website updates weekly. You run a purge on the parent product’s configuration (with the CCU API or the CCU REST API) to remove any stale origin content. When the CCU PURGE finishes, you then run an FEO purge to remove the transformation bundles each of your properties (specified by assetName).

Use the Property Manager API (PAPI) to get the list of properties for your contractId and groupId.

NOTE: The propertyName returned by PAPI is used as the assetName value by FEO.

GET /papi/v0/properties?groupId=grp_51529&contractId=ctr_3-LPONXD

{
  "properties": {
    "items": [
      {
        "accountId": "act_Z-8-SA8DFS",
        "contractId": "ctr_3-LPONXD",
        "groupId": "grp_51529",
        "latestVersion": 3,
        "productionVersion": 3,
        "propertyId": "prp_256737",
        "propertyName": "www.site.example.com",
        "stagingVersion": null
      },
      {
        "accountId": "act_Z-8-SA8DFS",
        "contractId": "ctr_3-LPONXD",
        "groupId": "grp_51529",
        "latestVersion": 2,
        "productionVersion": null,
        "propertyId": "prp_581213",
        "propertyName": "jsmith_testing",
        "stagingVersion": null
      },
      {
        "accountId": "act_Z-8-SA8DFS",
        "contractId": "ctr_3-LPONXD",
        "groupId": "grp_51529",
        "latestVersion": 4,
        "productionVersion": 4,
        "propertyId": "prp_52887",
        "propertyName": "www.random.example.com_pm",
        "stagingVersion": null
      }
    ]
  }
}

For each propertyName in the catalog that you wish to purge, use the FEO PURGE API to delete the transformation bundle using the /feo/v1/purge resource:

Request:

POST /feo/v1/purge/
Content-Type: application/json

{
  "assetName": "www.site.example.com",
  "network": "S",
  "comments": "Spring catalog updates on main site"
}

Response:

{
  "assetId": "10346607",
  "errorCode": "400"
}

NOTE: Numeric codes that represent the status of FEO bundle purge requests resemble HTTP error codes, but specify their own system of both success and error responses. See errorCode Values.

You can only have one FEO PURGE request active on a property at a time. Making subsequent requests with the same assetName will return "errorCode": "401" until the initial request is completed.

NOTE: At this time, the FEO API does not provide an indication of when the request has finished.

Request:

POST /feo/v1/purge/
Content-Type: application/json

{
  "assetName": "www.site.example.com",
  "network": "S",
  "comments": "Spring catalog updates on main site"
}

Response:

{
  "assetId": "10346607",
  "errorCode": "401",
  "errorMessage": "Change pending"
}

Last modified: 11/22/2016

Data

This section provides details about the various types of data object the Front-End Optimization API exchanges.

Purge

You specify the property and the environment (staging or production). By default, this purges the transformation bundles associated with whichever FEO configuration version is currently active in that environment; optionally, you may specify a different FEO configuration version. A comment is also required so you can recognize the purpose of a given purge action. Below is an example of the JSON and a table listing the data members for the JSON request.

{
  "assetName": "www.feo-test-shverma.com",
  "network": "P",
  "comments": "my comments"
}
Member Type Required Description
assetName String The Property Name (as configured in Property Manager) for which you wish to issue the FEO Purge request
network Enumeration The environment to which you wish to issue the FEO Purge request, either P for production (default) or S for staging.
comments String A description of the reason for the purge, for tracking purposes

Below is a sample JSON response and a table describing the members of the response JSON.

{
  "assetId": 93912312,
  "errorCode": 407,
  "errorMessage": "No active version"
}
Member Type Required Description
assetId Number A unique integer identifier that is functionally equivalent to the assetName specified in the request
errorCode Number For failed purge requests, an indication of why the request failed
errorMessage String A text description of the error code; returns null on success when errorCode is 400

errorCode Values

This table describes the range of possible numeric status codes for the errorCode member.

NOTE: Numeric codes that represent the status of FEO bundle purge requests resemble HTTP error codes, but specify their own system of both success and error responses listed below.

Code Message
400 Successful operation
401 Change pending
402 Database error
404 Incorrect property name
407 No active version
408 No ARL for asset
409 No beta permission
410 No comment provided
411 No configuration for asset
413 No property access
415 No versions
417 Submit failed
418 Unexpected exception
419 Version cannot be purged

Errors

This section provides details for the API’s set of possible error scenarios, and strategies to address them.

401: change pending

This error code indicates that the version you are attempting to purge already has a pending Activation, Deactivation or Purge Transformations request in progress.

Request

POST /feo/v1/purge/
Content-Type: application/json

{
  "assetName": "www.mysite.com_pm",
  "network": "S",
  "comments": "Purging a property with a purge already in progress"
}

Response

{
  "assetId": "1760254",
  "errorCode": "401",
  "errorMessage": "Change pending"
}

Resolution: Allow the existing request to complete before issuing a purge request.

404: incorrect property name

The property specified in assetName was not found.

Request:

POST /feo/v1/purge/
Content-Type: application/json

{
  "assetName": "www.myiste.com_pm",
  "network": "P",
  "comments": "Purging a property with a typo in the assetName"
}

Response:

{
  "assetId": "1600833",
  "errorCode": "404",
  "errorMessage": "Did not find asset www.myiste.com_pm"
}

Resolution: Ensure that the value of assetName corresponds to a valid property.

407: no active version

This error code indicates that no active FEO configuration version exists for the network you are attempting to purge.

Request:

POST /feo/v1/purge/
Content-Type: application/json

{
  "assetName": "www.mysite.com_pm",
  "network": "P",
  "comments": "Purging a property with no active Production version."
}

Response:

{
  "assetId": "1032590",
  "errorCode": "407",
  "errorMessage": "No active configuration"
}

Resolution: Activate an FEO version within the specified network (Staging or Production) and/or ensure that the network parameter is correct.

410: no comment provided

This error code indicates that the comments field was missing from the request.

Request:

POST /feo/v1/purge/
Content-Type: application/json

{
  "assetName": "www.mysite.com_pm",
  "network": "P"
}

Response:

{
  "assetId": "1634446",
  "errorCode": "410",
  "errorMessage": "No comment provided"
}

Resolution: Make sure to include the comments parameter in the request.

411: no configuration for asset

This error code indicates that no FEO configuration versions exists for the specified property.

Request:

POST /feo/v1/purge/
Content-Type: application/json

{
  "assetName": "www.mysite.com_pm",
  "network": "P",
  "comments": "Purging a property with FEO versions defined."
}

Response:

{
  "assetId": "1910270",
  "errorCode": "411",
  "errorMessage": "Did not find Config for asset 1910270"
}

Resolution: Create and activate an FEO configuration version for the specified property.


Last modified: 10/25/2016