Learn an API
const url = 'http://localhost:11044/api/v1/world/apis/learn';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"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/learn \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "type": "openapi", "url": "example" }'Introspects an API from a spec URL (OpenAPI or GraphQL endpoint) and returns metadata. Does not save.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Where the spec lives: url (required; an OpenAPI document URL or a GraphQL endpoint) and type (graphql; any other value is treated as openapi). The spec is fetched and parsed during the request and its name, description and auth requirements returned; nothing is saved. A missing url, or a spec that cannot be fetched or parsed, answers 400
An API to introspect
object
Openapi (the default) or graphql
The spec URL — an OpenAPI document or a GraphQL endpoint
Responses
Section titled “Responses”Learned API info
object
Missing url, or the spec could not be learned
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
