Link HTTP API
1.18.0+: The Link API is available in Consul versions 1.18.0 and newer.
Note: This endpoint does not use the /v1/
prefix.
The /api/hcp/v2/link/global
endpoint allows you to link your Consul cluster to HCP Consul Central.
Establish or update link to HCP Consul Central
This endpoint creates or updates a Link, which establishes a connection with HCP Consul Central.
Method | Path | Produces |
---|---|---|
PUT | /api/hcp/v2/link/global | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
NO | stale , consistent | none | operator:write , acl:write |
Link API vs. configuration-based linking
The Link API described here is an alternative method to accomplish the same thing as configuration-based linking. You should generally only choose one method or the other for linking your cluster, not both. If you do use both methods, they interract in the following ways:
- When Consul is started, values set in the
cloud
configuration will take precedence over what was previously set by the API or CLI. - Clusters can only be unlinked from HCP Consul Central by the API or CLI, regardless of if they were established via configuration, API, or CLI.
JSON Request Body Schema
data
(object: <required>)
resourceId
(string: <required>)
- The ID of the HCP Consul Central cluster to link to. Has the format of:organization/<orgID>/project/<projectID>/hashicorp.consul.global-network-manager.cluster/<clusterName>
clientId
(string: <required>)
- The ID used to authenticate to HCP, which is returned as part of the HCP Consul Central cluster creation. It can also be obtained by fetching the HCP Consul Central cluster secrets.clientSecret
(string: <required>)
- The secret used to authenticate to HCP, which is returned as part of the HCP Consul Central cluster creation. It can also be obtained by fetching the HCP Consul Central cluster secrets.
Sample Payload
Sample Request
Sample Response
Read Link
This endpoint reads a Link so you can view information about your cluster's current linking status.
Method | Path | Produces |
---|---|---|
GET | /api/hcp/v2/link/global | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
NO | stale , consistent | none | operator:read |
Sample Request
Sample Response
Delete Link
This endpoint deletes a Link, which removes the cluster's connection with HCP Consul Central.
Method | Path | Produces |
---|---|---|
DELETE | /api/hcp/v2/link/global | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
NO | stale , consistent | none | operator:write , acl:write |
Sample Request