Kong Publisher exposes a public APIs. Here are the base endpoint of Kong Publisher API, on each environment accordingly.
| Environment | Base Endpoint |
|---|---|
develop |
https://dev-kong-publisher.command-api.kw.com/api |
qa |
https://qa-kong-publisher.command-api.kw.com/api |
production |
https://kong-publisher.command-api.kw.com/api |
There are 3 endpoints available :
| Ednpoint | HTTP Method | Description |
|---|---|---|
/upstreams |
POST | Add or update your micro configuration |
/upstreams |
GET | Show your micro configuration |
/builds |
GET | Initiate a build for given x-kong-upstream-base64 name |
All of these endpoints require a special header, x-kong-upstream-base64, contains a base64 encoded of your microservice registered name, and we'll walkthrough them below.
You can add your microservice configuration by passing :
nameof your microservice viax-kong-upstream-base64. Noticed that you must supply a base64 encoded value of your micro. For instance, if your microservice isGoogle Microservice, the passed value must beR29vZ2xlIE1pY3Jvc2VydmljZQ==.configof your microservice viaconfigkey of upload file.
Below is a working example, to add Google Microservice with a valid config.yml located on /PROJECT/kwri/google-microservice/public/config.yml.
curl -v "https://dev-kong-publisher.command-api.kw.com/api/upstreams" -H"x-kong-upstream-base64: R29vZ2xlIE1pY3Jvc2VydmljZQ==" -H"Accept: application/json" -F"config=@/PROJECT/kwri/google-microservice/public/config.yml" -F"upstream_host=http://google-microservice-dev/config.yml"
Once you had created/updated your microservice configuration, you can inspect it afterward. To do that, simply pass the name of your microservice via x-kong-upstream-base64. Noticed that you must supply a base64 encoded value of your micro. For instance, if your microservice is Google Microservice, the passed value must be R29vZ2xlIE1pY3Jvc2VydmljZQ==.
Below is a working example, to show Google Microservice configuration.
curl -v "https://dev-kong-publisher.command-api.kw.com/api/upstreams" -H"x-kong-upstream-base64: R29vZ2xlIE1pY3Jvc2VydmljZQ==" -H"Accept: application/json"
When everything is ready, and you want to build your microservice routes, simply pass the name of your microservice via x-kong-upstream-base64. Noticed that you must supply a base64 encoded value of your micro. For instance, if your microservice is Google Microservice, the passed value must be R29vZ2xlIE1pY3Jvc2VydmljZQ==.
Below is a working example, to initiate Google Microservice build. You should get notification on our Slack, at #eng-feed-status channel.
curl -v "https://dev-kong-publisher.command-api.kw.com/api/builds" -H"x-kong-upstream-base64: R29vZ2xlIE1pY3Jvc2VydmljZQ==" -H"Accept: application/json"