The live catalog is read now and kept with the connection; session start checks the server against it. A put under an existing name replaces the connection with the catalog as it is now. A credential, if given, must be a secret the tenant holds and is sent as a bearer. Given none, a server that demands one is linked through an authorization: the answer carries the URL the owner opens, and the callback finishes the link. A server whose earlier authorization still opens is relinked with it.
const url = 'https://api.canopyhq.dev/connections/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"credential":"example","endpoint":"example","name":"example","result_limit":"example","return_to":"example","timeout":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.canopyhq.dev/connections/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "credential": "example", "endpoint": "example", "name": "example", "result_limit": "example", "return_to": "example", "timeout": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The name the tenant gives the connection; installs select its tools by this.
Request Bodyrequired
Section titled “Request Bodyrequired”What the tenant supplies to link a server. The catalog is discovered
here, never supplied. A server that demands a bearer and is given none
is linked through an authorization; return_to is where the browser is
sent once that is done.
object
Examplegenerated
{ "credential": "example", "endpoint": "example", "name": "example", "result_limit": "example", "return_to": "example", "timeout": "example"}Responses
Section titled “Responses”The outcome is replaced or unchanged, with the catalog just captured.
What a link answers: the connection as it stands, and, when the server demands an authorization, the URL the owner opens to grant it.
object
object
The tenant’s readable namespace for this connection’s tools.
Where a connection stands: linked with its catalog, or waiting on the owner to authorize it. A linked connection whose token set was refused and could not be refreshed reads as needing authorization again.
The result of applying a resource write at the door.
Example
{ "connection": { "auth": { "kind": "bearer" }, "state": "linked" }, "outcome": "created"}The connection, linked, with the catalog just captured.
What a link answers: the connection as it stands, and, when the server demands an authorization, the URL the owner opens to grant it.
object
object
The tenant’s readable namespace for this connection’s tools.
Where a connection stands: linked with its catalog, or waiting on the owner to authorize it. A linked connection whose token set was refused and could not be refreshed reads as needing authorization again.
The result of applying a resource write at the door.
Example
{ "connection": { "auth": { "kind": "bearer" }, "state": "linked" }, "outcome": "created"}The server demands an authorization: the connection stands as authorizing and authorize is the URL the owner opens. Starting authorization reports created or replaced, never unchanged.
What a link answers: the connection as it stands, and, when the server demands an authorization, the URL the owner opens to grant it.
object
object
The tenant’s readable namespace for this connection’s tools.
Where a connection stands: linked with its catalog, or waiting on the owner to authorize it. A linked connection whose token set was refused and could not be refreshed reads as needing authorization again.
The result of applying a resource write at the door.
Example
{ "connection": { "auth": { "kind": "bearer" }, "state": "linked" }, "outcome": "created"}An invalid body returns an error naming the field and reason; the name may be empty or the credential may name a secret the tenant does not hold.
No console token, or one that did not verify.
Only an owner of the tenant may configure it.
The server could not be reached, registered with, or read; nothing changed.