2017-04-04 16:33:22 +00:00
|
|
|
---
|
|
|
|
layout: api
|
|
|
|
page_title: Coordinate - HTTP API
|
2020-04-13 18:40:26 +00:00
|
|
|
sidebar_title: Coordinates
|
2017-04-04 16:33:22 +00:00
|
|
|
description: |-
|
|
|
|
The /coordinate endpoints query for the network coordinates for nodes in the
|
|
|
|
local datacenter as well as Consul servers in the local datacenter and remote
|
|
|
|
datacenters.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Coordinate HTTP Endpoint
|
|
|
|
|
|
|
|
The `/coordinate` endpoints query for the network coordinates for nodes in the
|
|
|
|
local datacenter as well as Consul servers in the local datacenter and remote
|
|
|
|
datacenters.
|
|
|
|
|
2020-04-09 23:46:54 +00:00
|
|
|
Please see the [Network Coordinates](/docs/internals/coordinates) internals
|
2017-04-04 16:33:22 +00:00
|
|
|
guide for more information on how these coordinates are computed, and for
|
|
|
|
details on how to perform calculations with them.
|
|
|
|
|
|
|
|
## Read WAN Coordinates
|
|
|
|
|
|
|
|
This endpoint returns the WAN network coordinates for all Consul servers,
|
|
|
|
organized by datacenters. It serves data out of the server's local Serf data, so
|
|
|
|
its results may vary as requests are handled by different servers in the
|
|
|
|
cluster.
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------------- | ------------------ |
|
|
|
|
| `GET` | `/coordinate/datacenters` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-04-09 23:46:54 +00:00
|
|
|
[blocking queries](/api/features/blocking),
|
|
|
|
[consistency modes](/api/features/consistency),
|
|
|
|
[agent caching](/api/features/caching), and
|
2020-04-09 23:20:00 +00:00
|
|
|
[required ACLs](/api#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------ |
|
|
|
|
| `NO` | `none` | `none` | `none` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/coordinate/datacenters
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Datacenter": "dc1",
|
|
|
|
"AreaID": "WAN",
|
|
|
|
"Coordinates": [
|
|
|
|
{
|
|
|
|
"Node": "agent-one",
|
|
|
|
"Coord": {
|
|
|
|
"Adjustment": 0,
|
|
|
|
"Error": 1.5,
|
|
|
|
"Height": 0,
|
|
|
|
"Vec": [0, 0, 0, 0, 0, 0, 0, 0]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
In **Consul Enterprise**, this will include coordinates for user-added network
|
|
|
|
areas as well, as indicated by the `AreaID`. Coordinates are only compatible
|
|
|
|
within the same area.
|
|
|
|
|
2017-10-26 12:24:42 +00:00
|
|
|
## Read LAN Coordinates for all nodes
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
This endpoint returns the LAN network coordinates for all nodes in a given
|
|
|
|
datacenter.
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------- | ------------------ |
|
|
|
|
| `GET` | `/coordinate/nodes` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-04-09 23:46:54 +00:00
|
|
|
[blocking queries](/api/features/blocking),
|
|
|
|
[consistency modes](/api/features/consistency),
|
|
|
|
[agent caching](/api/features/caching), and
|
2020-04-09 23:20:00 +00:00
|
|
|
[required ACLs](/api#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------ |
|
|
|
|
| `YES` | `all` | `none` | `node:read` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query. This will default to
|
|
|
|
the datacenter of the agent being queried. This is specified as part of the
|
|
|
|
URL as a query parameter.
|
2020-04-23 22:13:18 +00:00
|
|
|
- `segment` `(string: "")` <EnterpriseAlert inline /> - Specifies the segment to list members for.
|
2017-10-31 22:08:14 +00:00
|
|
|
If left blank, this will query for the default segment when connecting to a server and
|
|
|
|
the agent's own segment when connecting to a client (clients can only be part of one
|
|
|
|
network segment). When querying a server, setting this to the special string `_all`
|
|
|
|
will show members in all segments.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/coordinate/nodes
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Node": "agent-one",
|
2017-08-14 14:36:07 +00:00
|
|
|
"Segment": "",
|
2017-04-04 16:33:22 +00:00
|
|
|
"Coord": {
|
|
|
|
"Adjustment": 0,
|
|
|
|
"Error": 1.5,
|
|
|
|
"Height": 0,
|
|
|
|
"Vec": [0, 0, 0, 0, 0, 0, 0, 0]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
2017-08-14 14:36:07 +00:00
|
|
|
|
|
|
|
In **Consul Enterprise**, this may include multiple coordinates for the same node,
|
|
|
|
each marked with a different `Segment`. Coordinates are only compatible within the same
|
|
|
|
segment.
|
2017-10-26 12:24:42 +00:00
|
|
|
|
|
|
|
## Read LAN Coordinates for a node
|
|
|
|
|
2017-10-31 22:08:14 +00:00
|
|
|
This endpoint returns the LAN network coordinates for the given node.
|
2017-10-26 12:24:42 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------------ | ------------------ |
|
|
|
|
| `GET` | `/coordinate/node/:node` | `application/json` |
|
2017-10-26 12:24:42 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-04-09 23:46:54 +00:00
|
|
|
[blocking queries](/api/features/blocking),
|
|
|
|
[consistency modes](/api/features/consistency),
|
|
|
|
[agent caching](/api/features/caching), and
|
2020-04-09 23:20:00 +00:00
|
|
|
[required ACLs](/api#authentication).
|
2017-10-26 12:24:42 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------ |
|
|
|
|
| `YES` | `all` | `none` | `node:read` |
|
2017-10-26 12:24:42 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query. This will default to
|
|
|
|
the datacenter of the agent being queried. This is specified as part of the
|
|
|
|
URL as a query parameter.
|
2020-04-23 22:13:18 +00:00
|
|
|
- `segment` `(string: "")` <EnterpriseAlert inline /> - Specifies the segment to list members for.
|
2017-10-31 22:08:14 +00:00
|
|
|
If left blank, this will query for the default segment when connecting to a server and
|
|
|
|
the agent's own segment when connecting to a client (clients can only be part of one
|
|
|
|
network segment). When querying a server, setting this to the special string `_all`
|
|
|
|
will show members in all segments.
|
2017-10-26 12:24:42 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-10-26 12:24:42 +00:00
|
|
|
$ curl \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/coordinate/node/agent-one
|
2017-10-26 12:24:42 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Node": "agent-one",
|
|
|
|
"Segment": "",
|
|
|
|
"Coord": {
|
|
|
|
"Adjustment": 0,
|
|
|
|
"Error": 1.5,
|
|
|
|
"Height": 0,
|
|
|
|
"Vec": [0, 0, 0, 0, 0, 0, 0, 0]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
In **Consul Enterprise**, this may include multiple coordinates for the same node,
|
|
|
|
each marked with a different `Segment`. Coordinates are only compatible within the same
|
|
|
|
segment.
|
2017-10-27 03:17:46 +00:00
|
|
|
|
|
|
|
## Update LAN Coordinates for a node
|
|
|
|
|
|
|
|
This endpoint updates the LAN network coordinates for a node in a given
|
|
|
|
datacenter.
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | -------------------- | ------------------ |
|
|
|
|
| `PUT` | `/coordinate/update` | `application/json` |
|
2017-10-27 03:17:46 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-04-09 23:46:54 +00:00
|
|
|
[blocking queries](/api/features/blocking),
|
|
|
|
[consistency modes](/api/features/consistency),
|
|
|
|
[agent caching](/api/features/caching), and
|
2020-04-09 23:20:00 +00:00
|
|
|
[required ACLs](/api#authentication).
|
2017-10-27 03:17:46 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------ |
|
|
|
|
| `NO` | `none` | `none` | `node:write` |
|
2017-10-27 03:17:46 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query. This will default to
|
|
|
|
the datacenter of the agent being queried. This is specified as part of the
|
|
|
|
URL as a query parameter.
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```text
|
|
|
|
{
|
|
|
|
"Node": "agent-one",
|
|
|
|
"Segment": "",
|
|
|
|
"Coord": {
|
|
|
|
"Adjustment": 0,
|
|
|
|
"Error": 1.5,
|
|
|
|
"Height": 0,
|
|
|
|
"Vec": [0, 0, 0, 0, 0, 0, 0, 0]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-10-27 03:17:46 +00:00
|
|
|
$ curl \
|
|
|
|
--request PUT \
|
|
|
|
--data @payload.json \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/coordinate/update
|
2017-10-27 03:17:46 +00:00
|
|
|
```
|