Sign Up

Custom Endpoints

In addition to generating CRUD (Create, Read, Update, Delete), authentication, and file management endpoints, Twidget allows you to create completely custom endpoints from scratch. These custom endpoints give you full control over the various aspects of endpoint configuration, including the inputs, the sequence of commands to be executed, and the outputs.

-

Creating a Custom Endpoint

Follow the steps below to create a custom endpoint in Twidget:

  1. Navigate to the API Page: Start by navigating to the API section of your Twidget dashboard.

  2. Click Create Endpoint: In the top-right corner of the page, you'll see a button labeled "Create Endpoint." Click on it.

  3. Open New Tab for Custom Endpoint: A new tab will open, guiding you to the endpoint creation interface.

  4. Select Custom Endpoint: Choose the option for a custom endpoint. This will allow you to define a completely new endpoint according to your specific needs.

  5. Enter Name and Path:

    • Name: Enter a descriptive name for your endpoint. This name will help you identify the endpoint later.

    • Path: Specify the path for the endpoint. The path is the URL at which the endpoint can be accessed.

      • Path Variables: You can use path variables to make the endpoint dynamic. Path variables are specified by surrounding the variable name with curly braces {}. For example, if you want to create an endpoint that retrieves user data based on a user ID, you might use a path like /user/{userId}. When calling the endpoint, you would replace {userId} with an actual user ID value.

Defining Inputs

In the custom endpoint interface, you can define the input parameters that your endpoint will receive. Inputs can include:

  • Headers: Define any headers that need to be passed along with the request.

  • Query Parameters: Specify additional parameters sent in the query string of the URL.

  • Body: Define the structure of the JSON body if the request method supports it (e.g., POST, PUT).

Selecting Commands

After defining the inputs, you can choose the series of commands that the endpoint will execute. Commands can include:

  • Database Operations: CRUD operations on your database.

  • External API Calls: Interacting with external APIs.

  • Authentication Checks: Ensuring the requester has the necessary permissions.

  • Data Transformation: Manipulating data before returning it as a response.

Configuring Outputs

Finally, define the outputs for your endpoint:

  • Response Status Codes: Specify the HTTP status codes your endpoint will return (e.g., 200 for success, 404 for not found).

  • Response Body: Define the structure of the response body. This can be static, dynamic based on the input, or the result of the executed commands.

Related Topics

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

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

Generate CRUD Endpoints

What are CRUD Endpoints?. CRUD stands for Create, Read, Update, Delete. These are the basic operations required to manage data in a database. Each operation corresponds to a specific HTTP method: - Create: Adds new data (HTTP POST) - Read: Retrieves data (HTTP GET) - Update: Modifies existing data (...

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

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