(checks)
- createCheck - Creates a new Check
- getAllChecks - Retrieve a list of all checks
- getCheck - Get a single check
- updateCheck - Update a check
- rerequestCheck - Rerequest a check
Creates a new check. This endpoint must be called with an OAuth2 or it will produce a 400 error.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.checks.createCheck({
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
requestBody: {
name: "Performance Check",
path: "/",
blocking: true,
detailsUrl: "http://example.com",
externalId: "1234abc",
rerequestable: true,
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { checksCreateCheck } from "@vercel/sdk/funcs/checksCreateCheck.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await checksCreateCheck(vercel, {
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
requestBody: {
name: "Performance Check",
path: "/",
blocking: true,
detailsUrl: "http://example.com",
externalId: "1234abc",
rerequestable: true,
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.CreateCheckRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.CreateCheckResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
models.VercelBadRequestError | 400 | application/json |
models.VercelForbiddenError | 401 | application/json |
models.VercelNotFoundError | 404 | application/json |
models.SDKError | 4XX, 5XX | */* |
List all of the checks created for a deployment.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.checks.getAllChecks({
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { checksGetAllChecks } from "@vercel/sdk/funcs/checksGetAllChecks.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await checksGetAllChecks(vercel, {
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.GetAllChecksRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.GetAllChecksResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
models.VercelBadRequestError | 400 | application/json |
models.VercelForbiddenError | 401 | application/json |
models.VercelNotFoundError | 404 | application/json |
models.SDKError | 4XX, 5XX | */* |
Return a detailed response for a single check.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.checks.getCheck({
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
checkId: "check_2qn7PZrx89yxY34vEZPD31Y9XVj6",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { checksGetCheck } from "@vercel/sdk/funcs/checksGetCheck.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await checksGetCheck(vercel, {
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
checkId: "check_2qn7PZrx89yxY34vEZPD31Y9XVj6",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.GetCheckRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.GetCheckResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
models.VercelBadRequestError | 400 | application/json |
models.VercelForbiddenError | 401 | application/json |
models.VercelNotFoundError | 404 | application/json |
models.SDKError | 4XX, 5XX | */* |
Update an existing check. This endpoint must be called with an OAuth2 or it will produce a 400 error.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.checks.updateCheck({
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
checkId: "check_2qn7PZrx89yxY34vEZPD31Y9XVj6",
requestBody: {
name: "Performance Check",
path: "/",
detailsUrl: "https://example.com/check/run/1234abc",
output: {
metrics: {
fcp: {
value: 1200,
previousValue: 900,
source: "web-vitals",
},
lcp: {
value: 1200,
previousValue: 1000,
source: "web-vitals",
},
cls: {
value: 4,
previousValue: 2,
source: "web-vitals",
},
tbt: {
value: 3000,
previousValue: 3500,
source: "web-vitals",
},
virtualExperienceScore: {
value: 30,
previousValue: 35,
source: "web-vitals",
},
},
},
externalId: "1234abc",
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { checksUpdateCheck } from "@vercel/sdk/funcs/checksUpdateCheck.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await checksUpdateCheck(vercel, {
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
checkId: "check_2qn7PZrx89yxY34vEZPD31Y9XVj6",
requestBody: {
name: "Performance Check",
path: "/",
detailsUrl: "https://example.com/check/run/1234abc",
output: {
metrics: {
fcp: {
value: 1200,
previousValue: 900,
source: "web-vitals",
},
lcp: {
value: 1200,
previousValue: 1000,
source: "web-vitals",
},
cls: {
value: 4,
previousValue: 2,
source: "web-vitals",
},
tbt: {
value: 3000,
previousValue: 3500,
source: "web-vitals",
},
virtualExperienceScore: {
value: 30,
previousValue: 35,
source: "web-vitals",
},
},
},
externalId: "1234abc",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.UpdateCheckRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.UpdateCheckResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
models.VercelBadRequestError | 400 | application/json |
models.VercelForbiddenError | 401 | application/json |
models.VercelNotFoundError | 404 | application/json |
models.SDKError | 4XX, 5XX | */* |
Rerequest a selected check that has failed.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.checks.rerequestCheck({
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
checkId: "check_2qn7PZrx89yxY34vEZPD31Y9XVj6",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { checksRerequestCheck } from "@vercel/sdk/funcs/checksRerequestCheck.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await checksRerequestCheck(vercel, {
deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
checkId: "check_2qn7PZrx89yxY34vEZPD31Y9XVj6",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.RerequestCheckRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.RerequestCheckResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
models.VercelBadRequestError | 400 | application/json |
models.VercelForbiddenError | 401 | application/json |
models.VercelNotFoundError | 404 | application/json |
models.SDKError | 4XX, 5XX | */* |