Add an API
const url = 'http://localhost:11044/api/v1/world/apis';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"auth":"example","token_env":"example","type":"openapi","url":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/world/apis \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "auth": "example", "token_env": "example", "type": "openapi", "url": "example" }'Saves an API entry to the world. Refresh world to activate.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The API entry to save to the world’s API config: url (required; the spec URL), type (openapi by default, or graphql), auth (the scheme the API expects, e.g. bearer; none or omitted saves no auth) and token_env (the environment variable that holds its token). The spec is not fetched here; the world is rebuilt after the save. A missing url answers 400
An API to save to the world
object
Auth scheme the API expects, e.g. bearer
Name of the environment variable holding the token
Openapi (the default) or graphql
The spec URL — an OpenAPI document or a GraphQL endpoint
Responses
Section titled “Responses”API saved
object
Missing url
A refusal from the world administration surface: what went wrong, and the word error so a client reading the body need not consult the status code
object
What was refused and why, written to be shown. Names the offending value where there is one — the unknown mode, the out-of-range threshold, the invalid cron expression
Always error. Present because the map this replaces carried it and a consumer may branch on it
Example
error
