Manage API metadata
Last updated: 4 minutes read.
This documentation provides a comprehensive guide on configuring various aspects of API descriptions and metadata using Tyk Operator.
API Name
Tyk OAS API
API name can be set through x-tyk-api-gateway.info.name
field in Tyk OAS API Definition object.
Tyk Classic API
To set the name of an API in the ApiDefinition
, use the spec.name
string field. This name is displayed on the Tyk Dashboard and should concisely describe what the API represents.
Example:
|
|
API Status
API Active Status
An active API will be loaded to the Gateway, while an inactive API will not, resulting in a 404 response when called.
Tyk OAS API
API active state can be set through x-tyk-api-gateway.info.state.active
field in Tyk OAS API Definition object.
Tyk Classic API
The active status of an API can be set by modifying the spec.active
configuration parameter. When set to true
, this enables the API so that Tyk will listen for and process requests made to the listenPath
.
|
|
API Accessibility
An API can be configured as internal so that external requests are not processed.
Tyk OAS API
API accessibility can be set through x-tyk-api-gateway.info.state.internal
field in Tyk OAS API Definition object.
Tyk Classic API
API accessibility can be set through the spec.internal
configuration parameter as shown in the example below.
|
|
API ID
Creating a new API
If you’re creating a new API using Tyk Operator, you don’t need to specify the ID. The API ID will be generated in a deterministic way.
Tyk OAS API
The generated ID is stored in status.id
field. Run the following command to inspect generated API ID of a Tyk OAS API.
% kubectl get tykoasapidefinition [API_NAME] --namespace [NAMESPACE] -o jsonpath='{.status.id}'
ZGVmYXVsdC9wZXRzdG9yZQ
In this example, the generated API ID is ZGVmYXVsdC9wZXRzdG9yZQ
.
Tyk Classic API
The generated ID is stored in status.api_id
field. Run the following command to inspect generated API ID of a Tyk Classic API.
% kubectl get apidefinition [API_NAME] --namespace [NAMESPACE] -o jsonpath='{.status.api_id}'
ZGVmYXVsdC90ZXN0
In this example, the generated API ID is ZGVmYXVsdC90ZXN0
.
Updating an existing API
Tyk OAS API
If you already have API configurations created in the Tyk Dashboard and want to start using Tyk Operator to manage these APIs, you can include the existing API ID in the manifest under the x-tyk-api-gateway.info.id
field in Tyk OAS API Definition object.
Tyk Classic API
If you already have API configurations created in the Tyk Dashboard and want to start using Tyk Operator to manage these APIs, you can include the existing API ID in the manifest under the spec.api_id
field. This way, when you apply the manifest, Tyk Operator will not create a new API in the Dashboard. Instead, it will update the original API with the Kubernetes spec.
Example
|
|
In this example, the API with ID 12345
will be updated according to the provided spec instead of creating a new API.
API Category
For details on how to configure API category, refer to Manage API category
API Ownership
To configure API ownership, ensure Tyk Operator is also an owner of the API. This can be done using Operator Context. For details, refer to Tyk Operator API Ownership.
API Versioning
For details on how to configure API versions, refer to configuring API versioning in Tyk Operator