Sign Up
Loading...

Endpoint Basics

An endpoint refers to a specific URL (Uniform Resource Locator) that a client can access to interact with the API and perform various operations. Endpoints act as gateways that allow clients (such as web or mobile applications) to communicate with the server hosting the API and perform actions like retrieving data, submitting data, updating information, or executing specific functionalities.

Each endpoint represents a specific entity or action and is associated with a unique path signature and HTTP method (GET, POST, PUT, DELETE, etc.) to determine the type of operation it supports.

Inputs

Endpoint inputs are values or data that are included in the API call to provide additional information or instructions to the API when making a request. These parameters allow clients to customize the behavior of the API and retrieve specific data or perform particular actions.

List of parameters are:

  • Path Variables: Are inserted directly into the URL path, enclosed in curly braces "{}". Adding "(*)" after the path parameter will allow the inclusion of "/" in the path variable.

  • Query Parameters: Are appended to the URL after a question mark "?" and multiple parameters are separated by an ampersand &. They are used for non-essential or optional data, such as filters, sorting, or pagination.

  • Body: Payload of data that is sent as part of an HTTP request, typically when using the HTTP methods POST, PUT, or PATCH. The body contains the data that needs to be transmitted from the client

  • File: Allows you to transfer files from a client. File uploads are commonly used when you need to send files, such as images, videos, documents, or any other binary data, to a server for processing, storage, or other purposes.

  • Headers: Refers to a part of the HTTP request or response that carries metadata or additional information about the message being sent.

By marking a parameter as required, any endpoint request made without providing that parameter will result in an error being thrown. This will promptly notify the user or client about the mandatory nature of the parameter and prompt them to include it for successful processing of the request.

An endpoint in Twidget is a collection of commands that work together to accomplish a specific business objective. Think of an endpoint like a workflow or a pipeline where each command is a step that processes data or performs an action.

Endpoints can be triggered in various ways, such as via webhooks, scheduled tasks, or direct calls from client applications.

Commands

Commands are the building blocks of endpoints. Each command performs a specific action, such as:

  • Fetching data from a database

  • Sending an email

  • Processing a payment

  • Updating a record

A typical endpoint may consist of multiple commands that are executed in sequence. For example, an endpoint designed to process user registration might include commands to save user details, send a confirmation email, and log the activity.

Outputs

Outputs are the results produced by endpoints after all commands have been executed. These outputs can be in various forms, such as JSON objects, status messages, or raw data. You can use these outputs in your client applications to display information, trigger further actions, or for logging purposes.

Creating an Endpoint

Creating an endpoint in Twidget involves defining a sequence of commands and specifying the desired outputs. Here is a basic overview of the creation process:

  1. Define Objectives: Identify the specific business goal you want the endpoint to achieve.

  2. Add Commands: Add individual commands that need to be executed to achieve the objective.

  3. Configure Parameters: Configure any necessary parameters for each command.

  4. Specify Outputs: Define the outputs that the endpoint should produce.

Using Endpoints in Client Applications

Enable an endpoint

On the API page, open an endpoint's three-dot menu and choose Enable Endpoint. The endpoint becomes callable using its current access settings. Enabling does not publish pending editor changes. Use Disable Endpoint to stop access again. The editor's existing version-publishing workflow remains separate.

Enable endpoints in a category

Open the three-dot menu next to a category name and choose Enable All Endpoints. Confirm the number of disabled endpoints to enable. Already-enabled endpoints remain enabled. This applies to the whole category, even while the search box shows only some endpoints.

This action makes the endpoints' existing saved API behavior callable; it does not publish pending draft changes. Plan limits still apply. A category action accepts up to 500 disabled endpoints; split larger categories before enabling them. If a concurrent edit interrupts the action, some endpoints may already be enabled. Refresh the list, review their status, and retry; retrying will not disable them.

Once you have created an endpoint, you can call it from your client applications to execute the defined sequence of commands and obtain the outputs. This can be done using HTTP requests or Twidget's API client.

Handling Outputs in Client

After calling an endpoint, you will receive the defined outputs that you can use as needed in your client application.


{

    "status": "success",

    "message": "User registration completed.",

    "userId": "12345"

}

You can then utilize this data to provide feedback to the user, trigger additional workflows, or log the results.

Related Topics

Action Stats

Action Stats gives Twidget administrators a history of endpoint calls and event runs. It is an admin tool, rather than a workspace feature available to every team member. Find a run. Open Action Stats in the admin sidebar. Filter by workspace, organization, action type, test or real call, result, st...

API Settings

The API settings in Twidget enable you to customize your APIs to fit your requirements. Here’s how you can do it: Configure. 1. Navigate to the API page. 2. Click on the Settings button located at the top-right corner. This will open a sidebar where you can configure various settings for your API. A...

Streaming responses

Send updates progressively while an endpoint is running, instead of waiting for one final response. This is useful for progress messages or generated text that your app can display as it arrives. Enable a streaming endpoint. 1. Open the endpoint and choose Update endpoint. 2. Set Response mode to St...

Create File Endpoints

Overview. Twidget allows you to create file endpoints, which enable you to manage files in your file store. This feature is designed to streamline your workflow by providing predefined endpoints for common file operations. Creating File Endpoints. To create a file endpoint in Twidget, follow these s...

Customer authentication tools

Use your workspace's Authentication page to manage customer access and independent login sessions. Build signup, login and logout workflows with the authentication commands in the command picker. These tools use your existing [authentication table](/docs/database/authentication-table). They manage p...