2. Bài tập
Bài 1: Lấy thông tin access_token
-
Login với thông tin:
-
Url:
https://server.aptech.io/auth/login
-
Method: POST
-
Body (Raw, JSON):
{
"username": "tungnt@softech.vn",
"password": "123456789"
}
-
-
Bóc tách access_token:
- Dùng JSON Extractor (nằm trong Post Processors)
- Lưu vào biến:
my_access_token
-
Thực hiện lấy danh sách Categories với thông tin:
- Url:
https://server.aptech.io/online-shop/categories
- Authorization: Bearer
${my_access_token}
- Method: GET
Bài 2: Đọc file CSV
-
Đọc file CSV với CSV Data Set Config (nằm trong Config Element) lưu vào 2 biến: username,password
-
Thực hiện Login với:
-
Url:
https://server.aptech.io/auth/login
-
Method: POST
-
Body (Raw, JSON):
{
"username": ${username},
"password": ${password}
}
-
Bài 3: Online Shop API
Thực hiện trên bộ API: https://server.aptech.io/online-shop
Các API:
- GET ALL,
- GET BY ID,
- POST,
- PATCH,
- DELETE
Hướng dẫn
Trình tự thực hiện:
- Login với thông tin
- Bóc tách access_token lưu vào biến
my_access_token
- Thực hiện API với Authorization: Bearer
${my_access_token}