Testapp 01: Fullstack CRUD - API Definition
Base URL
https://projects.pribyl.top/persons/api
Actions
Creating
- HTTP word:
POST
- Accept header:
*/* oder application/json
- URI:
/persons
- Body:
{ "first_name": "xxxxx", "last_name": "yyyyy" }
- Return Values:
201 (Created) - Body contains created object - Location contains URI to created object.
400 (Bad Request) - Body contains more detailed error message.
Reading
- HTTP word:
GET
- Accept header:
*/* oder application/json
- URI (all items):
/persons
- URI (one item):
/persons/{:id}
- Return Values:
200 (OK) - Body contains a list of persons or the person.
400 (Bad Request) - Body contains more detailed error message.
404 (Not Found) - Body empty.
Updating
- HTTP word:
PUT
- Must contain entire object.
- Accept header:
*/* oder application/json
- URI:
/persons/{:id}
- Body:
{ "first_name": "xxxxx", "last_name": "yyyyy" }
- Return Values:
200 (OK) - Body contains created object - Location contains URI to created object.
400 (Bad Request) - Body contains more detailed error message.
404 (Not Found) - Body empty.
- HTTP word:
POST
- Can omit either
first_name or last_name.
- Accept header:
*/* oder application/json
- URI:
/persons/{:id}
- Body:
{ "first_name": "xxxxx", "last_name": "yyyyy" }
- Return Values:
200 (OK) - Body contains created object - Location contains URI to created object.
400 (Bad Request) - Body contains more detailed error message.
404 (Not Found) - Body empty.
Deleting
- HTTP word:
DELETE
- Accept header:
*/* oder application/json
- URI:
/persons/{:id}
- Return Values:
204 (No Content) - Body empty.
400 (Bad Request) - Body contains more detailed error message.
404 (Not Found) - Body empty.