Skip to main content

API Collections

Group APIs into collections.


Introduction

An API collection refers to a group or set of APIs that are organized and grouped together for a specific purpose. It's a convenient way to manage and document multiple APIs within a project, platform, organization, or organizational unit.

note

An API can be part of multiple collections.

Collections leverage labels and selectors to group APIs together. Later, you can reuse collections and apply rate limit, or access directly to these collections.

Overall, an API collection serves as a comprehensive resource for developers, offering a consolidated view of available APIs and facilitating their integration into software applications.

When creating a collection, you are also adding a prefix to the APIs.

info

In the Developer Portal, collections will appear in a subdirectory with the name of the collection.


Managing Collections Using CRDs

Collections Properties

FieldDescriptionRequired
pathPrefixPathPrefix used by the collection, for example /crm.
The PathPrefix will append the URL of the API Gateway.
This would make the API collection accessible under api.example.com/crm.
Only absolute paths are accepted for this setting.
The path must start with a slash / and can have a maximum length of 255 characters.
No
apis.nameSelect APIs based on names.
You can combine it with apiSelector.matchLabels and apiSelector.matchExpressions.
See Labels and Selectors. You can select up to 100 APIs.
No
apis.namespaceName of the Kubernetes Namespace used by the API(s) defined in apis.name. This is required for apis.name.
Limited to 63 characters.
No
apiSelector.matchLabelsSelect APIs based on label matching: Equality-Based Requirements.No
apiSelector.matchExpressionsSelect APIs based on advanced labels expressions: Set-Based Requirements.No

Examples

Using API Names to create a collection
apiVersion: hub.traefik.io/v1alpha1
kind: APICollection
metadata:
name: crm-all
labels:
module: crm
spec:
pathPrefix: "/crm" # The PathPrefix will append the URL of the API Gateway
apis:
- name: customer-api # Select APIs based on their name
namespace: apps # Name of the Kubernetes Namespace used by the API(s)
- name: ticket-api
namespace: apps