Repository navigation
Expand file tree
/
Copy pathLetsPlay ProductRequests.http
More file actions
62 lines (54 loc) · 2.81 KB
/
Copy pathLetsPlay ProductRequests.http
File metadata and controls
62 lines (54 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# E-commerce RESTful API
###
# group: ProductRequests
# @name Get All Products
# This is a GET request and it is used to "get" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).
# A successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data.
//< {%
// TODO: you can add here Pre-request handler
//%}
GET {{base_url}}/products?page=0&size=10&sortBy=NAME&order=desc
###
# group: ProductRequests
# @name Get Product
# This is a GET request and it is used to "get" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).
# A successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data.
GET {{base_url}}/products/67745c48392a89593e53c7c7
Authorization: Bearer {{token}}
###
# group: ProductRequests
# @name Post Product
# This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.
# A successful POST request typically returns a `200 OK` or `201 Created` response code.
POST {{base_url}}/products
Authorization: Bearer {{token}}
Content-Type: application/json
{
"userId": "6761a9abade89e418585b5c6",
"name": "Iphone 16 Pro 256 Go",
"description": "Meilleur smartphone du monde en 2024.",
"price": 950000,
"quantity": 10
}
###
# group: ProductRequests
# @name Update Product
# This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. `id=1`).
# A successful PUT request typically returns a `200 OK`, `201 Created`, or `204 No Content` response code.
PUT {{base_url}}/products/67745c48392a89593e53c7c7
Authorization: Bearer {{token}}
Content-Type: application/json
{
"userId": "6761a9abade89e418585b5c6",
"name": "MacBook Pro 14 pouces M4 Pro",
"description": "Meilleur pc du monde en 2024",
"price": 1000000,
"quantity": 200
}
###
# group: ProductRequests
# @name Delete Product
# This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. `id=1`).
# A successful DELETE request typically returns a `200 OK`, `202 Accepted`, or `204 No Content` response code.
DELETE {{base_url}}/products/6748b967362a2b3af8467050
Authorization: Bearer {{token}}