Sign Up

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

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

Authentication

Twidget supports Bearer Authentication to ensure secure access to your endpoints. You can specify which endpoints should be secured or open. Once secured, an endpoint can only be accessed using a valid Bearer Token, which is generated via our API. Additionally, we provide functionality to generate a...

Endpoint Inputs

In Twidget, endpoints have a variety of input types that can be used to configure and execute API requests. These input types include queries, headers, body, files, and path inputs. Each input type serves a specific purpose in allowing users to interact with APIs efficiently. Files. The files input ...

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...

What is an API

An API (Application Programming Interface) is a set of rules and protocols that allows different software applications to communicate and interact with each other. It defines the methods and data formats that applications can use to request and exchange information, services, or functionalities from...

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...