Change a connected API. The spec is fetched first; a failed fetch changes nothing
const url = 'http://localhost:11044/api/v1/learn/apis/example';const options = { method: 'PUT', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"fields":{"additionalProperty":"example"},"headerName":"example","mode":"example","name":"example","specUrl":"example","token":"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 http://localhost:11044/api/v1/learn/apis/example \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "fields": { "additionalProperty": "example" }, "headerName": "example", "mode": "example", "name": "example", "specUrl": "example", "token": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Name of the connected API to change, as listed by GET /api/v1/learn/sources; 404 when it is not an API this user connected
Request Bodyrequired
Section titled “Request Bodyrequired”The new connection, in the shape POST /api/v1/learn/apis takes. specUrl is required, mode defaults to none, a blank token keeps the stored one, and headerName defaults to X-API-Key; a name in the body is ignored, since the path names the API. The spec is fetched first and nothing changes when that fails; a saved change drops the reviews held for this source and rebuilds the world
How to reach an API, sent to POST /learn/apis: an auth mode and that mode’s fields, with the top-level specUrl, name, token and headerName accepted too, for a script that has them in hand
object
Values for the mode’s form, keyed by each field’s name (specUrl, name, token, headerName). A top-level property of the same name takes precedence; blank values count as absent
object
The header that carries the key, for mode api-key only; absent means X-API-Key. Not secret
An auth-mode id from GET /learn/apis/modes: none, bearer or api-key. Absent means none; any other value is refused 400
The gateway namespace to register the API under, made into a slug; absent uses the spec’s own title
URL of the API’s OpenAPI document, fetched to prove it answers. Required, here or as fields.specUrl
The bearer token or API key, required for modes bearer and api-key. Stored in the user’s wallet, never echoed back and never written to world YAML
Example generated
{ "fields": { "additionalProperty": "example" }, "headerName": "example", "mode": "example", "name": "example", "specUrl": "example", "token": "example"}Responses
Section titled “Responses”Spec unreachable or unparseable, or a token missing for the mode
A refusal carrying only its explanation, with no code to branch on
object
What went wrong, written to be shown. Carries the underlying driver’s or parser’s own message where there is one
Example generated
{ "error": "example"}Not an API this user connected
A refusal carrying only its explanation, with no code to branch on
object
What went wrong, written to be shown. Carries the underlying driver’s or parser’s own message where there is one
Example generated
{ "error": "example"}
