## API Document

- Supported Content Types
- Certificate Object
- Certificate Object
- Certificate Object
- Certificate Object
- Certificate Object

This page refers to the Admin API for running Kong This page refers to the Admin API for running Kong This page refers to the Admin API for running Kong This page refers to the Admin API for running Kong This page refers to the Admin API for running Kong This page refers to the Admin API for running Kong This page refers to the Admin API for running Kong

Kong comes with an internal RESTful Admin API for administration purposes. Requests to the Admin API can be sent to any node in the cluster, and Kong will keep the configuration consistent across all nodes.

- `8001` is the default port on which the Admin API listens.
- `8444` is the default port for HTTPS traffic to the Admin API.

Arrays and sets can be specified in various ways:

1. Sending same parameter multiple times:

       print(123)

2.     print(123)

       print(123)

       print(123)

3.     print(123)

    {
        "config": {
            "limit": 10,
            "period": "seconds",
            "hosts": [ "example.com", "example.org" ]
        }
    }

## Information Routes

### Retrieve Node Information

Retrieve generic details about a node.

/

Response

    HTTP 200 OK

    {
        "hostname": "",
        "node_id": "6a72192c-a3a1-4c8d-95c6-efabae9fb969",
        "lua_version": "LuaJIT 2.1.0-beta3",
        "plugins": {
            "available_on_server": [
                ...
            ],
            "enabled_in_cluster": [
                ...
            ]
        },
        "configuration" : {
            ...
        },
        "tagline": "Welcome to Kong",
        "version": "0.14.0"
    }

- `node_id`: A UUID representing the running Kong node. This UUID is randomly generated when Kong starts, so the node will have a different `node_id` each time it is restarted.
- `available_on_server`: Names of plugins that are installed on the node.
- `enabled_in_cluster`: Names of plugins that are enabled/configured. That is, the plugins configurations currently in the datastore shared by all Kong nodes.

### Add Service

##### Create Service

/services

Request Body

Attributes | Description
--- | ---
`name` optional | The Service name.
`retries` optional | The number of retries to execute upon failure to proxy. Defaults to `5`.
`protocol` | The protocol used to communicate with the upstream. It can be one of `http` or `https`. Defaults to `"http"`.
`host` | The host of the upstream server.
`port` | The upstream server port. Defaults to `80`.

Response

    HTTP 201 Created

    {
        "id": "9748f662-7711-4a90-8186-dc02f10eb0f5",
        "created_at": 1422386534,
        "updated_at": 1422386534,
        "name": "my-service",
        "retries": 5,
        "protocol": "http",
        "host": "example.com",
        "port": 80,
        "path": "/some_api",
        "connect_timeout": 60000,
        "write_timeout": 60000,
        "read_timeout": 60000,
        "tags": ["user-level", "low-priority"]
    }

### Retrieve Service

/services/{id}

Attributes | Description
--- | ---
`name or id` required | The unique identifier or the name of the Service to retrieve.

Response

    HTTP 200 OK

    {
        "id": "9748f662-7711-4a90-8186-dc02f10eb0f5",
        "created_at": 1422386534,
        "updated_at": 1422386534,
        "name": "my-service",
        "retries": 5,
        "protocol": "http",
        "host": "example.com",
        "port": 80,
        "path": "/some_api",
        "connect_timeout": 60000,
        "write_timeout": 60000,
        "read_timeout": 60000,
        "tags": ["user-level", "low-priority"]
    }

### Update Service

/services/{name or id}

Attributes | Description
--- | ---
`name or id` required | The unique identifier or the name of the Service to update.

Request Body

Attributes | Description
--- | ---
`name` optional | The Service name.
`retries` optional | The number of retries to execute upon failure to proxy. Defaults to `5`.
`protocol` | The protocol used to communicate with the upstream. It can be one of `http` or `https`. Defaults to `"http"`.

Response

    HTTP 200 OK

    {
        "id": "51e77dc2-8f3e-4afa-9d0e-0e3bbbcfd515",
        "created_at": 1422386534,
        "updated_at": 1422386534,
        "name": "my-route",
        "protocols": ["http", "https"],
        "methods": ["GET", "POST"],
        "hosts": ["example.com", "foo.test"],
        "paths": ["/foo", "/bar"],
        "https_redirect_status_code": 426,
        "regex_priority": 0,
        "strip_path": true,
        "preserve_host": false,
        "tags": ["user-level", "low-priority"],
        "service": {"id":"fc73f2af-890d-4f9b-8363-af8945001f7f"}
    }