(apis)
REST APIs for managing Api entities
- deleteApi - Delete an Api.
- generateOpenApiSpec - Generate an OpenAPI specification for a particular Api.
- generatePostmanCollection - Generate a Postman collection for a particular Api.
- getAllApiVersions - Get all Api versions for a particular ApiEndpoint.
- getApis - Get a list of Apis for a given workspace
- upsertApi - Upsert an Api
Delete a particular version of an Api. The will also delete all associated ApiEndpoints, Metadata, Schemas & Request Logs (if using a Postgres datastore).
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.apis.deleteApi({
apiID: "<id>",
versionID: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apisDeleteApi } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apisDeleteApi.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await apisDeleteApi(speakeasy, {
apiID: "<id>",
versionID: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteApiRequest | ✔️ | 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<shared.ErrorT>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
This endpoint will generate any missing operations in any registered OpenAPI document if the operation does not already exist in the document. Returns the original document and the newly generated document allowing a diff to be performed to see what has changed.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.apis.generateOpenApiSpec({
apiID: "<id>",
versionID: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apisGenerateOpenApiSpec } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apisGenerateOpenApiSpec.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await apisGenerateOpenApiSpec(speakeasy, {
apiID: "<id>",
versionID: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GenerateOpenApiSpecRequest | ✔️ | 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<operations.GenerateOpenApiSpecResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Generates a postman collection containing all endpoints for a particular API. Includes variables produced for any path/query/header parameters included in the OpenAPI document.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.apis.generatePostmanCollection({
apiID: "<id>",
versionID: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apisGeneratePostmanCollection } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apisGeneratePostmanCollection.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await apisGeneratePostmanCollection(speakeasy, {
apiID: "<id>",
versionID: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GeneratePostmanCollectionRequest | ✔️ | 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<operations.GeneratePostmanCollectionResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Get all Api versions for a particular ApiEndpoint. Supports filtering the versions based on metadata attributes.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.apis.getAllApiVersions({
apiID: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apisGetAllApiVersions } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apisGetAllApiVersions.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await apisGetAllApiVersions(speakeasy, {
apiID: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetAllApiVersionsRequest | ✔️ | 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<operations.GetAllApiVersionsResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Get a list of all Apis and their versions for a given workspace. Supports filtering the APIs based on metadata attributes.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.apis.getApis({});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apisGetApis } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apisGetApis.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await apisGetApis(speakeasy, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetApisRequest | ✔️ | 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<operations.GetApisResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Upsert an Api. If the Api does not exist, it will be created. If the Api exists, it will be updated.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.apis.upsertApi({
apiID: "<id>",
api: {
apiId: "<id>",
description: "consequently brr happily yowza however gosh investigate joyfully direct",
versionId: "<id>",
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apisUpsertApi } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apisUpsertApi.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await apisUpsertApi(speakeasy, {
apiID: "<id>",
api: {
apiId: "<id>",
description: "consequently brr happily yowza however gosh investigate joyfully direct",
versionId: "<id>",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpsertApiRequest | ✔️ | 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<operations.UpsertApiResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |