Skip to content

Add an API

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

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

Media typeapplication/json

An API to save to the world

object
auth

Auth scheme the API expects, e.g. bearer

string
token_env

Name of the environment variable holding the token

string
type

Openapi (the default) or graphql

string
default: openapi
url
required

The spec URL — an OpenAPI document or a GraphQL endpoint

string

API saved

Media type*/*
object

Missing url

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