Skip to main content
?

DELETE

The HTTP DELETE request method deletes the specified resource.


We already know how to make basic API from the API Example Page.
This Page explains how to make a DELETE method API, delete data in the database and get a response from this DELETE API!

Goal

Add New DELETE Path (in APIs Page)

➑️ Add New DELETE Path (in Server Page).

As you know, we already made API and Server.
So, we just add a NEW PATH and Add this in the Server in Autoflow
Follow the below steps!


note

We will make below DELETE /user/{user_id}
Then we will delete data in the database by DELETE /user/{user_id}

Before Starting, Assuming that the Clients is already connected, this page will only explain the post method.

1. Add New Path with URL Path​

We already made Autoflow API and Autoflow Server.
So we will use this which we made.
Then just add a new Path.

1.1 Click the Add Path button and write your Path name!​

First, we click the Add Path button. Then we will write the path name.
We select the DELETE Method.

Version Location
tip

You can write the URL path Name whatever you want to write.

1.2 API page Overview​

When you added a New path, We can see below the new Path.

DELETE

/user/{user_id}

Version Location
tip

Also, you can make this path by OpenAPI schema on the right side!


2. Add New Path to a Server!​

Let's add new path to a Server!
As you know, we already made a Server from the API Example Page.

2.1. Click Server Page, Then Click Server Operation!​

Click Server Page, then Click Server Operation which we made it before!

Version Location

2.2. Click Add API Operation, Then Click your new Path!​

Click Add API Operation, then Click your new PATH.

Version Location

Now we can see the below screen.
The API has already been made and completed.
However, our goal is to send DELETE /user/{user_id}

Version Location
tip

Now we can use DELETE /user/{user_id}


3. Delete User Data using Action.​

Using DELETE /user/{user_id}
Let's delete the user data in the database!
To parse Data, we should add Autoflow Action.

3.1 Click the Add Action button​

To add Action, we should click the Add Action Button.

Version Location

3.2 Select Action.​

We have lots of Actions in Autoflow.
On this page, we will use Database Query Action.

Select Database

Version Location

Then Select Query

Version Location

3.3 How to use Database Query Action.​

info

This page's goal is to insert a query in the database from DELETE with URL PATH.
I will send DELETE with the request URL PATH

3.3.1 Select your Client​

Select the Client that you connected.
I will connect the 'MySQL' database.

tip

If you don't know how to connect Client, Click hereπŸ”—

Version Location

3.3.2 Write DELETE SQL in 'Query'​

Our goal is to insert a query in the database from the DELETE URL PATH.
Write DELETE QUERY and Select 'Write' in Type.
I only wrote DELETE FROM `account` WHERE id= ;
Because I will put Values from DELETE URL PATH.

Version Location

3.3.3 Add the variable Name that you want.​

Write a variable name in the Key field.

Version Location

3.3.4 Drag the Param to where you want to insert in the query.​

Let's drag the 'user_id' param to where you want to insert in the query!

Version Location

3.3.5 Click String type in Params​

We want to use the DELETE URL path.
So we will this variable as one of the DELETE URL path.

Version Location

3.3.6 Change to Data Type​

Click Data Type.

Version Location

3.3.7 Write Path Scope!​

We can get DELETE Request Body by request > path > user_id.
So write the path below.

Version Location

3.3.8 We are ready to DELETE Request! πŸ‘β€‹

Version Location

3.3.9 Send Database query As a Response.​

I want to DELETE the response as my database table.
So, I will Add one more action to the response.
SELECT * FROM `account`; then the QUERY result will be DELETE Response.

Version Location

4. Test DELETE Request and Response​

info

I will use POSTMAN to DELETE request with URL Path.

Before starting my user database is as below.

Version Location

4.1 DELETE Request with Reqeust PATH.​

First, I will DELETE with URL PATH.

DELETE

URL: http://localhost:8080/user/1

Then I got the below response. Now we can see the URL path user's data was deleted in the MySQL database.

Version Location

Second, I will check the result using Action.

Then I got the below response. Now we can see the URL path user's data was deleted in the MySQL database.

Version Location