Skip to content

Learn an API

POST
/api/v1/world/apis/learn
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.

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

Media typeapplication/json

An API to introspect

object
type

Openapi (the default) or graphql

string
default: openapi
url
required

The spec URL — an OpenAPI document or a GraphQL endpoint

string

Learned API info

Media type*/*
object

Missing url, or the spec could not be learned

Media type*/*

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
message
required

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

string
status
required

Always error. Present because the map this replaces carried it and a consumer may branch on it

string

Example

error