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

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

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

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

Creating Authentication Endpoints

Follow these steps to create authentication endpoints in Twidget: Step-by-Step Guide. 1. Navigate to API Tab: - Go to the `API` tab in your Twidget dashboard. 2. Create New Endpoints: - Click on the `Create Endpoints` button located at the top right corner. 3. Select Authentication: - In the newly o...

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