REST APIs for managing Api entities
- get_all - Get a list of Apis for a given workspace
- get_all_versions - Get all Api versions for a particular ApiEndpoint.
- upsert - Upsert an Api
- delete - Delete an Api.
- generate_open_api - Generate an OpenAPI specification for a particular Api.
- generate_postman - Generate a Postman collection for a particular Api.
Get a list of all Apis and their versions for a given workspace. Supports filtering the APIs based on metadata attributes.
require 'speakeasy_client_sdk_ruby'
s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
::OpenApiSDK::Shared::Security.new(
api_key: "<YOUR_API_KEY_HERE>",
)
)
res = s.apis.get_all(op=::OpenApiSDK::Operations::Op.new(
and_: false,
), metadata={
"key": [
"<value>",
],
})
if ! res.apis.nil?
# handle response
end
Parameter | Type | Required | Description |
---|---|---|---|
op |
T.nilable(::OpenApiSDK::Operations::Op) | ➖ | Configuration for filter operations |
metadata |
T::Hash[Symbol, T::Array<::String>] | ➖ | Metadata to filter Apis on |
T.nilable(::OpenApiSDK::Operations::GetApisResponse)
Get all Api versions for a particular ApiEndpoint. Supports filtering the versions based on metadata attributes.
require 'speakeasy_client_sdk_ruby'
s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
::OpenApiSDK::Shared::Security.new(
api_key: "<YOUR_API_KEY_HERE>",
)
)
res = s.apis.get_all_versions(api_id="<id>", op=::OpenApiSDK::Operations::QueryParamOp.new(
and_: false,
), metadata={
"key": [
"<value>",
],
})
if ! res.apis.nil?
# handle response
end
Parameter | Type | Required | Description |
---|---|---|---|
api_id |
::String | ✔️ | The ID of the Api to retrieve. |
op |
T.nilable(::OpenApiSDK::Operations::QueryParamOp) | ➖ | Configuration for filter operations |
metadata |
T::Hash[Symbol, T::Array<::String>] | ➖ | Metadata to filter Apis on |
T.nilable(::OpenApiSDK::Operations::GetAllApiVersionsResponse)
Upsert an Api. If the Api does not exist, it will be created. If the Api exists, it will be updated.
require 'speakeasy_client_sdk_ruby'
s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
::OpenApiSDK::Shared::Security.new(
api_key: "<YOUR_API_KEY_HERE>",
)
)
res = s.apis.upsert(api_id="<id>", api=::OpenApiSDK::Shared::ApiInput.new(
api_id: "<id>",
description: "curiously painfully proliferate awful bump without fly",
version_id: "<id>",
))
if ! res.api.nil?
# handle response
end
Parameter | Type | Required | Description |
---|---|---|---|
api_id |
::String | ✔️ | The ID of the Api to upsert. |
api |
::OpenApiSDK::Shared::ApiInput | ✔️ | A JSON representation of the Api to upsert |
T.nilable(::OpenApiSDK::Operations::UpsertApiResponse)
Delete a particular version of an Api. The will also delete all associated ApiEndpoints, Metadata, Schemas & Request Logs (if using a Postgres datastore).
require 'speakeasy_client_sdk_ruby'
s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
::OpenApiSDK::Shared::Security.new(
api_key: "<YOUR_API_KEY_HERE>",
)
)
res = s.apis.delete(api_id="<id>", version_id="<id>")
if res.status_code == 200
# handle response
end
Parameter | Type | Required | Description |
---|---|---|---|
api_id |
::String | ✔️ | The ID of the Api to delete. |
version_id |
::String | ✔️ | The version ID of the Api to delete. |
T.nilable(::OpenApiSDK::Operations::DeleteApiResponse)
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.
require 'speakeasy_client_sdk_ruby'
s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
::OpenApiSDK::Shared::Security.new(
api_key: "<YOUR_API_KEY_HERE>",
)
)
res = s.apis.generate_open_api(api_id="<id>", version_id="<id>")
if ! res.generate_open_api_spec_diff.nil?
# handle response
end
Parameter | Type | Required | Description |
---|---|---|---|
api_id |
::String | ✔️ | The ID of the Api to generate an OpenAPI specification for. |
version_id |
::String | ✔️ | The version ID of the Api to generate an OpenAPI specification for. |
T.nilable(::OpenApiSDK::Operations::GenerateOpenApiSpecResponse)
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.
require 'speakeasy_client_sdk_ruby'
s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
::OpenApiSDK::Shared::Security.new(
api_key: "<YOUR_API_KEY_HERE>",
)
)
res = s.apis.generate_postman(api_id="<id>", version_id="<id>")
if ! res.postman_collection.nil?
# handle response
end
Parameter | Type | Required | Description |
---|---|---|---|
api_id |
::String | ✔️ | The ID of the Api to generate a Postman collection for. |
version_id |
::String | ✔️ | The version ID of the Api to generate a Postman collection for. |
T.nilable(::OpenApiSDK::Operations::GeneratePostmanCollectionResponse)