EndpointCache

Resource URI

/services/{serviceId}/endpoints/{endpointId}/cache

Items in curly braces represent variables.

Description

The Cache resource allows for the configuration of cache-related properties for the Endpoint.

Resource Schema

Property Characteristics
clientSurrogateControlEnabled Type boolean
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description The client surrogate control overrides the global TTL value, and sets TTL values on an object by object basis.
contentCacheKeyHeaders Type array
Sub-type enum
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description enum literals: accept, accept-charset, accept-encoding, accept-language. The HTTP cache-control headers can be included in the responses for fine-tuned and granular caching. The cache-control header in the responses overrides the global TTL value, and sets TTL values on an object by object basis.

fetch [GET]

Retrieves the identified Cache for the Endpoint Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.
fields false string Comma-separated list of property paths to include in response. Each property path is a dot-separated list of object property names. fields=<property\[.property...\]>\[,...\]\[&fields=...\]
filter false string Colon-separated name/value pair specifying the name of property whose value must contain the given value (as a substring). Results may also be filtered by nested collections' properties by specifying a dot-separated property path. filter=<property\[.property...\]>:<value>\[&filter=...\]
sort false string Comma-separated list of properties to sort by. Only root-level properties are supported. Each property name may be optionally followed by :asc or :desc to specify sort direction (defaults to asc). sort=<property\[:(asc\|desc)\]>\[,...\]\[&sort=...\]
limit false int Number of objects to return in the result. Defaults to 100.
offset false int 0-based index of first object in the list to return. Defaults to 0.
indent false boolean When set to true, responses are indented for better readability.

Returns

Success

Cache for the Service If fields request parameter is not included, only those fields with "Fetch Rule" equal to "Implicit" will be returned. Otherwise, the fields contained in the URL parameter will be included in the response.

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "clientSurrogateControlEnabled": true,
        "contentCacheKeyHeaders": "accept-encoding"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "clientSurrogateControlEnabled": false,
        "contentCacheKeyHeaders": "accept-charset"
    }
]

create [POST]

Assigns Cache to an Endpoint Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.
cache true object Endpoint Cache object

Returns

Success

Cache for the Service If fields request parameter is not included, only those fields with "Fetch Rule" equal to "Implicit" will be returned. Otherwise, the fields contained in the URL parameter will be included in the response.

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"clientSurrogateControlEnabled":true,"contentCacheKeyHeaders":"accept"}

Response

[
    {
        "clientSurrogateControlEnabled": false,
        "contentCacheKeyHeaders": "accept-language.TheHTTPcache-controlheaderscanbeincludedintheresponsesforfine-tunedandgranularcaching.Thecache-controlheaderintheresponsesoverridestheglobalTTLvalue"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"clientSurrogateControlEnabled":false,"contentCacheKeyHeaders":"accept-charset"}

Response

[
    {
        "clientSurrogateControlEnabled": false,
        "contentCacheKeyHeaders": "accept"
    }
]

update [PUT]

Updates the Cache assigned to the identified Endpoint Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.
cache true object Endpoint Cache object

Returns

Success

Cache for the Service If fields request parameter is not included, only those fields with "Fetch Rule" equal to "Implicit" will be returned. Otherwise, the fields contained in the URL parameter will be included in the response.

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"clientSurrogateControlEnabled":true,"contentCacheKeyHeaders":"accept-language.TheHTTPcache-controlheaderscanbeincludedintheresponsesforfine-tunedandgranularcaching.Thecache-controlheaderintheresponsesoverridestheglobalTTLvalue"}

Response

[
    {
        "clientSurrogateControlEnabled": false,
        "contentCacheKeyHeaders": "accept-language.TheHTTPcache-controlheaderscanbeincludedintheresponsesforfine-tunedandgranularcaching.Thecache-controlheaderintheresponsesoverridestheglobalTTLvalue"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"clientSurrogateControlEnabled":false,"contentCacheKeyHeaders":"accept-language.TheHTTPcache-controlheaderscanbeincludedintheresponsesforfine-tunedandgranularcaching.Thecache-controlheaderintheresponsesoverridestheglobalTTLvalue"}

Response

[
    {
        "clientSurrogateControlEnabled": true,
        "contentCacheKeyHeaders": "accept-language.TheHTTPcache-controlheaderscanbeincludedintheresponsesforfine-tunedandgranularcaching.Thecache-controlheaderintheresponsesoverridestheglobalTTLvalue"
    }
]

delete [DELETE]

Deletes the Cache assigned to the identified Endpoint Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.

Returns

Success

Empty response

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request DELETE

Response

[
    ""
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/cache' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request DELETE

Response

[
    ""
]

Docs Navigation