Documentation

API Basics

Define HTTP endpoints and send requests

2 min read

A Layerz app can communicate with real servers. An API is the channel through which your app fetches data from or sends data to the internet.

In most cases, importing OpenAPI / Swagger to auto-generate APIs is the fastest path, but you can also define endpoints by hand.

Endpoint Configuration

A single API represents a single HTTP request.

  • HTTP methodGET, POST, PUT, DELETE, PATCH. The body is sent for POST/PUT/PATCH.
  • URL — The address to send the request to
  • Headers — Headers to send along with the request
  • Body — The data to send
  • Auth — The authentication method (see Auth, Retries & Timeout)

API Collection

Multiple APIs are grouped and managed in an API Collection. A Collection shares a server address (base URL), so each API only needs a relative path instead of the full address. The actual request address is built as base URL + path.

Inserting Dynamic Values

URLs, headers, bodies, and auth values can include binding tokens ({Parameters.…}, {Project.…}) that are filled with actual values at request time.

Sending a Request

A configured API is called with the API Call action in an Action Flow. How to connect the response to the screen is covered in Binding API Responses to UI.

If this is your first time, we recommend starting by importing the OpenAPI document of a public API rather than building one by hand. The endpoints and response structures are prepared all at once.