Mobify DevCenter

DocumentationAPI & SDK ReferenceHow-To GuidesMobify University

Mobify Cloud API

The Mobify Cloud API allows you to interact with caches and targets in Mobify Cloud via a RESTful interface. For more information about Mobify Cloud, see the architecture overview.

Cache control endpoints

Cache invalidation

Invalidate cached objects in both CDN and the Application Cache for target with slug :target_slug for the project with slug :project-slug.

POST Method

https://cloud.mobify.com/api/projects/:project_slug/target/:target_slug/invalidation/

Parameters

FieldTypeDescription
pattern String

Required. The URL path pattern that you want to invalidate, you can include one wildcard (*) in the pattern and it will be replaced by each single item in items array to invalidate individual cache object. Query parameters should not be included in pattern. Pattern should include a leading / and an ending /. Example: /path/to/products/*/

namespace String

Optional. This is the namespace of the application cache, if this value is not provided, the cache invalidation operation will use the current deploy id as the default namespace.

items Array

Required. This is an array of strings. It will be used to replace wildcard path element in the pattern. The maximum number of items is 50000. Example: ['product_1', 'product_2']]

Request example

{
"pattern": "/path/to/products/*/",
"items": ['product_1', 'product_2']],
"namespace": "demo"
}

Success response

HTTP/1.0 200 OK
{
"slug": "testing-eu",
"count": 1,
"result": "Cache invalidation request queued"
}

Error 4xx

NameDescription
MissingDeploy

The target has not been deployed.

ExceedLimit

Number of items exceed limit.

MissingDeploy error response

HTTP/1.1 400 BadRequest
{
"detail": "Target example has not been deployed.
Please make sure the target is deployed before attempting to
invalidate cache."
}

ExceedLimit error response

HTTP/1.1 400 BadRequest
{
"detail": "Unable to promise efficient ejection of 50001 objects
per request. Please send multiple requests with 50000 or
fewer."
}