-
Notifications
You must be signed in to change notification settings - Fork 0
/
powershell.txt
32 lines (27 loc) · 1.19 KB
/
powershell.txt
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
// get list
$response = Invoke-WebRequest -Uri 'http://localhost:8000/api/inventory' -Method GET
// save item
$headers=@{}
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'http://localhost:8000/api/inventory' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"name": "item name",
"description": "desc for the item",
"priceCents": 35487546,
"inventoryCount": 1
}'
// update item
$headers=@{}
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'http://localhost:8000/api/inventory/<YOUR ITEM ID>' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "new description"
}'
// delete item
$headers=@{}
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'http://localhost:8000/api/inventory/<YOUR ITEM ID>' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{
"reason": "deletion reason"
}'
// show deleted items
$response = Invoke-WebRequest -Uri 'http://localhost:8000/api/inventory/archive' -Method GET
// undelete an item
$response = Invoke-WebRequest -Uri 'http://localhost:8000/api/inventory/restore/<YOUR ITEM ID>' -Method POST