Gateway Services represent the upstream services in your system. By associating a Service with an API, this allows developers to generate credentials or API keys for your API.
Before you can associate the API with the Service, you need the Control Plane ID and the ID of the example-service
Service you created in the prerequisites.
First, send a request to the /v2/control-planes
endpoint to get the ID of the quickstart
Control Plane:
curl -X GET "https://us.api.konghq.com/v2/control-planes?filter%5Bname%5D%5Bcontains%5D=quickstart" \
-H "Authorization: Bearer $KONNECT_TOKEN"
Export your Control Plane ID:
export CONTROL_PLANE_ID='YOUR-CONTROL-PLANE-ID'
Next, list Services by using the /v2/control-planes/{controlPlaneId}/core-entities/services
endpoint:
curl -X GET "https://us.api.konghq.com/v2/control-planes/$CONTROL_PLANE_ID/core-entities/services" \
-H "Authorization: Bearer $KONNECT_TOKEN"
Export the ID of the example-service
:
export SERVICE_ID='YOUR-GATEWAY-SERVICE-ID'
Associate the API with a Service using the /v3/apis/{apiId}/implementations
endpoint:
curl -X POST "https://us.api.konghq.com/v3/apis/$API_ID/implementations" \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"service": {
"control_plane_id": "'$CONTROL_PLANE_ID'",
"id": "'$SERVICE_ID'"
}
}'