HTTP

This node can be challenging, especially for those with limited knowledge of HTTP. However, having a good understanding of HTTP will make it easier to use. In essence, this HTTP sends requests to the API using either the GET or POST method and displays the response in the tabs below. Node này có thể là một node khó, đặc biệt đối với những người có kiến ​​thức hạn chế về HTTP. Tuy nhiên, hiểu rõ về HTTP sẽ giúp sử dụng dễ dàng hơn. Về bản chất, HTTP này gửi yêu cầu tới API bằng phương thức GET hoặc POST và hiển thị phản hồi trong các tab bên dưới.

  • Enter URL: Request URL address

  • Request method: GET, POST, PUT, DELETE.

  • Headers: Header of the request

  • Cookies: HTTP cookies

  • Select content Type: Select your content type.

  • Response body mapping: Response of the request

  • Nhập URL: Địa chỉ URL yêu cầu

  • Phương thức yêu cầu: GET, POST, PUT, DELETE.

  • Headers: Header được yêu cầu

  • Cookies: HTTP cookies

  • Select content Type: Chọn loại nội dung của bạn.

  • Response body mapping: Phản hồi của yêu cầu

  1. Example 1: The API has the following response:

Ví dụ 1: API có response như sau:

[
    {
        "value": 132,
        "label": "tag 1"
    },
    {
        "value": 136,
        "label": "tag 2"
    },
    {
        "value": 137,
        "label": "tag 3"
    },
    {
        "value": 138,
        "label": "tag 4"
    }
]

To get the Value of "label": "tag 3" we write as follows: 2.value

Để lấy được Value của "label": "tag 3" ta viết như sau: 2.value

  1. Example 2: We have the following response:

Ví dụ 2: Ta có đoạn response sau:

{
    "status": "success",
    "data": [
        {
            "id": 7,
            "email": "michael.lawson@gmail.com.",
            "first_name": "Michael",
            "last_name": "Lawson"
        },
        {
            "id": 8,
            "email": "lindsay.ferguson@gmail.com",
            "first_name": "Lindsay",
            "last_name": "Ferguson"
        },
        {
            "id": 9,
            "email": "tobias.funke@gmail.com",
            "first_name": "Tobias",
            "last_name": "Funke"
        }
    ]
    }
}

To get the email of "first_name": "Michael", we write data.0.email

Để lấy được email của "first_name": "Michael" , ta viết data.0.email

Additionally, if you want to get the entire api response, you can write as follows:

Ngoài ra nếu bạn muốn lấy toàn bộ response của api thì bạn có thể ghi như sau:

In Response body mapping, enter response and select the variable to store the data, so you can get the entire response of that API.

Tại Response body mapping bạn nhập là response và chọn biến để lưu dữ diệu, như vậy là bạn đã có thể lấy toàn bộ response của API đó.

Last updated