Clear a site's package caches
Clears the package caches named in which, or all four when it is left out, and answers the bytes each freed. Global packages and projects are untouched.
POST/ api/ corestack/ sites/ {site}/ node-runtime/ caches/ clear
Path parameters
siteintegerRequired
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Body
whicharray of strings
The caches to clear, each once. Left out, all four are cleared.
npmcorepackpnpmyarnReturns
200 The bytes each cache freed. A cache that was not cleared reads 0.
Fields of the 200 answer
clearedobjectRequired
Fields
corepack_bytesintegerRequired
npm_bytesintegerRequired
pnpm_bytesintegerRequired
yarn_bytesintegerRequired
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | busy | Another operation is running on the site. Wait for it to finish. |
409 | not_running | The site, environment or deployment is not running. Read the message: where it can be started or will recover, start it or wait, then try again. |
422 | invalid_arguments | The arguments do not match the tool's input schema, or the Control Panel refused a field. Fix the fields named in the answer and call again. |
429 | rate_limited | Wait for the seconds in Retry-After. |
502 | node_check_failed | The package check answered something the control panel cannot read. |
503 | connect_failed | The cluster could not be reached. |
503 | temporarily_unavailable | The Control Panel could not answer just now. Nothing was started; try again shortly. |
503 | switched_off | Corefinity has switched this action off for the moment. Try again later. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/caches/clear \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/caches/clear', (object) []);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/caches/clear', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.post(
"https://manage.corefinity.com/api/corestack/sites/1042/node-runtime/caches/clear",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={},
)
data = res.json() if res.content else None{
"cleared": {
"corepack_bytes": 0,
"npm_bytes": 301989888,
"pnpm_bytes": 0,
"yarn_bytes": 14680064
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "busy",
"message": "Another command is running on this site. Try again in a moment.",
"reason": "busy"
}{
"code": "invalid_arguments",
"errors": {
"which": [
"One or more of npm, corepack, pnpm, yarn, each once."
]
},
"field": "which",
"message": "Caches are named from npm, corepack, pnpm, yarn, each once.",
"reason": "invalid_arguments"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}{
"code": "node_check_failed",
"message": "The package check answered something the control panel cannot read.",
"reason": "node_check_failed"
}{
"code": "connect_failed",
"message": "The cluster could not be reached",
"reason": "connect_failed"
}Try it
Try it is off for this endpointIt deletes data that cannot be brought back. Copy the request and run it yourself when you are sure.
Was this helpful?