hosting
PUT /v1/sites/{siteId}/cache
Set a site's server-side cache times.
Authentification
Envoyez une clé API en tant que jeton du porteur. La clé doit posséder l'autorisation sites.view ; une clé qui ne l'a pas est refusée avec le code 403, et non 404.
Cet endpoint ne prend aucun identifiant d'organisation. Votre clé identifie déjà l'organisation à laquelle elle appartient, et la réponse y est limitée.
Essayer
Remplacez tout ce qui se trouve entre crochets par vos propres valeurs, et le espace réservé à la clé par une clé de votre tableau de bord.
curl -X PUT https://api.zinndigital.com/v1/sites/{siteId}/cache \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "css_seconds": <integer>, "image_seconds": <integer>, "javascript_seconds": <integer> }'Connecté ? La console d'API de votre tableau de bord saisit votre véritable ID d'organisation ainsi que votre propre clé, et exécute la requête sur l'API de production afin que vous puissiez voir la réponse réelle. Ouvrir ce point de terminaison dans la console API
Détails
Writes the three cache times a package lets a customer change, and returns the whole cache state so the card re-renders from the server's answer rather than from what it asked for. `PUT` because the body states the desired end state. ⛔⛔ **All three classes are required, every time, and that is the contract rather than an oversight.** The vendor replaces the stored policy with exactly the body it is given, so a request naming two classes **deletes the third** — silently, with a cheerful acknowledgement. Making the fields optional would put that footgun on the wire where every future client would find it. A value outside 0…31536000 seconds is refused `422` before the vendor is called, as is a package type whose cache settings it does not permit. `404` for a site with no vendor hosting package, or one that is not the caller's. Requires `sites.view` **and** `sites.panel_access`.
Paramètres
| Nom | Type | Obligatoire | Qu'est-ce que c'est |
|---|---|---|---|
siteId (path) | Uuid | Oui | Site ID (UUIDv7). |
Corps de la requête
| Nom | Type | Obligatoire | Qu'est-ce que c'est |
|---|---|---|---|
css_seconds | integer | Oui | How long stylesheets should be cached, in seconds. Zero is "do not cache". |
image_seconds | integer | Oui | How long images should be cached, in seconds. |
javascript_seconds | integer | Oui | How long scripts should be cached, in seconds. |
Réponse
| Nom | Type | Obligatoire | Qu'est-ce que c'est |
|---|---|---|---|
permitted | boolean | Oui | Whether the package type exposes cache settings and the report at all. |
purge_permitted | boolean | Oui | Whether a purge is permitted. Separate from `permitted` on purpose: the purge was measured working on a package whose cache settings and report the vendor refuses. |
css_seconds | integer | Oui | How long stylesheets are cached. |
image_seconds | integer | Oui | How long images are cached. |
javascript_seconds | integer | Oui | How long scripts are cached. |
reported | object | Oui | Every asset class the vendor reported, keyed by its own name, including the classes that cannot be written. ⛔ Read-only on a client: writing them deletes them, because the vendo… |
report_available | boolean | Oui | Whether the cacheability report could be read. False renders an explanation rather than an empty table, so "nothing has been seen yet" and "not part of this plan" never look ide… |
report | SiteCacheReportRow[] | Oui | What the platform did with the URLs it has seen. |
Erreurs que cet point de terminaison peut renvoyer
401 · 403 · 404 · 422 · 429 · 503