This repository has been archived by the owner on Apr 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
server-queries.http
101 lines (81 loc) · 2 KB
/
server-queries.http
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
@apiUrl = http://localhost:5000/api
# ================= AUTH ======================= #
### LOGIN
POST {{apiUrl}}/auth/login
content-type: application/json
{
"email": "[email protected]",
"password": "wiezA123"
}
### REGISTER
POST {{apiUrl}}/auth/register
content-type: application/json
{
"name": "Łukasz K.",
"email": "[email protected]",
"password": "wiezA123"
}
### LOGOUT
POST {{apiUrl}}/auth/logout
# ================= PARTNERS ======================= #
### GET all
@deletedPartners = 0
// @name partners
GET {{apiUrl}}/partners?withDeleted={{deletedPartners}}
### GET one
// @name partner
GET {{apiUrl}}/partners/{{partners.response.body.$.[0].id}}
### CREATE
// @name partner
POST {{apiUrl}}/partners
content-type: application/json
{
"name": "ABC Company",
"taxNumber": "78912311222",
"address": {
"street": "Some street",
"city": "Some city"
}
}
### UPDATE
// @name partner
PUT {{apiUrl}}/partners/{{partners.response.body.$.[0].id}}
content-type: application/json
{
"name": "ABC Company {{$randomInt 1 20}}",
"taxNumber": "78912311221"
}
### DELETE
DELETE {{apiUrl}}/partners/{{partner.response.body.$.id}}
# ================= INVOICES ======================= #
### GET all
@deletedInvoices = 1
// @name invoices
GET {{apiUrl}}/invoices?withDeleted={{deletedInvoices}}
### GET one
// @name invoice
GET {{apiUrl}}/invoices/{{invoices.response.body.$.[0].id}}
### CREATE
// @name invoice
POST {{apiUrl}}/invoices
content-type: application/json
{
"number": "01/12/2019",
"invoiceDate": "{{$datetime iso8601}}",
"paymentDate": "{{$datetime iso8601 10 d}}",
"partnerId": "{{partner.response.body.$.id}}",
"invoiceItems": [
{
"name": "item 1",
"quantity": {{$randomInt 1 6}},
"unitPrice": "{{$randomInt 5 55}}.{{$randomInt 0 100}}"
},
{
"name": "item 2",
"quantity": {{$randomInt 2 10}},
"unitPrice": "{{$randomInt 1 35}}.{{$randomInt 0 100}}"
}
]
}
### DELETE
DELETE {{apiUrl}}/invoices/{{invoice.response.body.$.id}}