Adding API to Kong failed

#1

I am trying to run an example on my Ubuntu 18.04 desktop. My app has three running containers

docker ps --format '{{.Names}}'
chapter11_go-server_1
chapter11_kong_1
chapter11_db_1

One is Kong,the other db and the third the Go code that health checks GET requests.
I am trying to make POST request to the Kong admin API, which runs on port 8001. But it fails.

{
“name”: “myapi”,
“hosts”: “server1”,
“upstream_url”: “http://chapter11_go-server_1:3000”,
“uris”:["/api/v1"],
“strip_uri”: true,
“preserve_host”: false
}

Output

kong_1 | 172.21.0.1 - - [29/Apr/2019:10:36:58 +0000] “POST /apis HTTP/1.1” 404 23 “-” “PostmanRuntime/7.6.0”
kong_1 | 172.21.0.1 - - [29/Apr/2019:10:47:30 +0000] “POST /apis HTTP/1.1” 404 23 “-” “PostmanRuntime/7.6.0”

How to fix this?
What is upstream_url?

#2

@MilenkoM Hello,

Which version of Kong are you running? You can find out by calling [kong url]:8001/ (the root path of the Admin API), or by executing kong version in a shell opened in the chapter11_kong_1 container.

The /apis endpoint was removed in Kong 1.0.0 (a breaking change for a major release, which was long deprecated, documented, and expected from our users). It is replaced by two new entities, Services and Routes, and their respective Admin API endpoints, /services and /routes. The example you are referring to should probably be updated for Kong 1.0.0 and above.

What is upstream_url?

It used to be a property of the defunct API entity, pointing to said API’s main endpoint. Kong technically being a reverse-proxy, the terms “downstream” and “upstream” are commonly used to refer, respectively, to the client connecting to Kong, and the backend (your API) Kong connects to.

In the online documentation, you can read more about Routes, Services, and read about how Kong’s proxy can be configured.

Best,

#3

My kong version

1.1.0

#4

Great. So, as I said, the API entity was removed since Kong 1.0.