(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";
async function run() {
const sdk = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.apis.deleteApi({
apiID: "<value>",
versionID: "<value>",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteApiRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.DeleteApiResponse>
Error Object | 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";
async function run() {
const sdk = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.apis.generateOpenApiSpec({
apiID: "<value>",
versionID: "<value>",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GenerateOpenApiSpecRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GenerateOpenApiSpecResponse>
Error Object | 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";
async function run() {
const sdk = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.apis.generatePostmanCollection({
apiID: "<value>",
versionID: "<value>",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GeneratePostmanCollectionRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GeneratePostmanCollectionResponse>
Error Object | 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";
async function run() {
const sdk = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.apis.getAllApiVersions({
apiID: "<value>",
metadata: {
"key": [
"<value>",
],
},
op: {
and: false,
},
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetAllApiVersionsRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetAllApiVersionsResponse>
Error Object | 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";
async function run() {
const sdk = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.apis.getApis({
metadata: {
"key": [
"<value>",
],
},
op: {
and: false,
},
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetApisRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetApisResponse>
Error Object | 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";
async function run() {
const sdk = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.apis.upsertApi({
api: {
apiId: "<value>",
description: "Synchronised 5th generation knowledge user",
metaData: {
"key": [
"<value>",
],
},
versionId: "<value>",
},
apiID: "<value>",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpsertApiRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.UpsertApiResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |