first commit
This commit is contained in:
53
rest.client
Normal file
53
rest.client
Normal file
@@ -0,0 +1,53 @@
|
||||
### Get all heroes (no auth)
|
||||
GET http://localhost:8080/api/v1/heroes
|
||||
Accept: application/json
|
||||
|
||||
### Get active heroes (no auth)
|
||||
GET http://localhost:8080/api/v1/hero
|
||||
Accept: application/json
|
||||
|
||||
### Update hero (JSON) — requires admin token
|
||||
PUT http://localhost:8080/api/v1/hero/1
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{ADMIN_TOKEN}}
|
||||
|
||||
{
|
||||
"title": "updated-via-rest",
|
||||
"is_active": false
|
||||
}
|
||||
|
||||
### Update hero (multipart/form-data) — send file + is_active=false
|
||||
PUT http://localhost:8080/api/v1/hero/1
|
||||
Authorization: Bearer {{ADMIN_TOKEN}}
|
||||
Content-Type: multipart/form-data; boundary=---011000010111000001101001
|
||||
|
||||
-----011000010111000001101001
|
||||
Content-Disposition: form-data; name="title"
|
||||
|
||||
multipart-update
|
||||
-----011000010111000001101001
|
||||
Content-Disposition: form-data; name="is_active"
|
||||
|
||||
false
|
||||
-----011000010111000001101001
|
||||
Content-Disposition: form-data; name="image"; filename="test.jpg"
|
||||
Content-Type: image/jpeg
|
||||
|
||||
< ./path/to/test.jpg
|
||||
-----011000010111000001101001--
|
||||
|
||||
### Delete hero (admin)
|
||||
DELETE http://localhost:8080/api/v1/hero/1
|
||||
Authorization: Bearer {{ADMIN_TOKEN}}
|
||||
|
||||
---
|
||||
# Equivalent curl examples:
|
||||
#
|
||||
# curl GET all heroes
|
||||
# curl -sS http://localhost:8080/api/v1/heroes | jq '.'
|
||||
#
|
||||
# curl update JSON
|
||||
# curl -X PUT "http://localhost:8080/api/v1/hero/1" -H "Authorization: Bearer <ADMIN_TOKEN>" -H "Content-Type: application/json" -d '{"title":"test","is_active":false}'
|
||||
#
|
||||
# curl multipart (with image)
|
||||
# curl -X PUT "http://localhost:8080/api/v1/hero/1" -H "Authorization: Bearer <ADMIN_TOKEN>" -F "title=multipart-test" -F "is_active=false" -F "image=@/absolute/path/to/image.jpg"
|
||||
Reference in New Issue
Block a user