Management of APIs
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
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.
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. This is achieved by setting the spec.internal
configuration parameter as shown in the example below.
|
|
API Category
For a Tyk Classic API, you can specify the category name using the spec.name
field with a #
qualifier. This will categorize the API in the Tyk Dashboard.
Example
|
|
API ID
Creating a new API
If you’re creating a new API using Tyk Operator, you don’t need to specify the ID in the manifest. The API ID will be generated in a deterministic way. You can inspect status.api_id
field to get the generated API ID.
Example
|
|
Run the following command to inspect generated API ID.
% kubectl get apidefinition order --namespace shop -o yaml | grep api_id -B 1
status:
api_id: c2hvcC9vcmRlcg
Updating an existing 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 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