Introduction
For Tyk Self Managed or Tyk Cloud, you can set up a Developer Portal to expose a facade of your APIs and then allow third-party developers to register and use your APIs. You can make use of Tyk Operator CRDs to publish the APIs as part of your CI/CD workflow. If you have followed this Getting Started guide to create the httpbin example API, you can publish it to your Tyk Classic Developer Portal in a few steps.Currently Operator only supports publishing Tyk Classic API to the Tyk Classic Portal.
Publish an API with Tyk Operator
1. Creating a security policy
When you publish an API to the Portal, Tyk actually publishes a way for developers to enroll in a policy, not into the API directly. Therefore, you should first set up a security policy for the developers, before proceeding with the publishing. To do that, you can use the following command:httpbin
API that was previously created.
2. Creating an API description
The Tyk Classic Developer Portal enables you to host your API documentation in Swagger/OpenAPI or API Blueprint for developers to use. In the case of Swagger/OpenAPI, you can either paste your Swagger content (JSON or YAML) in the CRD, or via a link to a public Swagger hosted URL, which can then be rendered by using Swagger UI. Create a file calledapidesc.yaml
, then add the following;
3. Apply the changes
4. Creating a PortalAPICatalog resource
Unlike other platforms, Tyk will not auto-publish your APIs to the Portal, instead they are presented as a facade, you choose what APIs and what Policies to expose to the Portal. You can configure what APIs and what Policies to expose to the Portal via Tyk Operator by creating a PortalAPICatalog resource. Create a file calledapi_portal.yaml
, then add the following:
apis
.
5. Apply the changes
doc_type: swagger
documentation
: Base64 encoded swagger doc
doc_type: swagger_custom_url
documentation
: The URL to the swagger documentation, for example “https://httpbin.org/spec.json”
doc_type: graphql