Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions simple-books-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ GET `/books/:bookId`

Retrieve detailed information about a book.

## API Authentication ##

To submit or view an order, you need to register your API client.

POST `/api-clients/`

The request body needs to be in JSON format and include the following properties:

- `clientName` - String
- `clientEmail` - String

Example

```
{
"clientName": "Postman",
"clientEmail": "valentin@example.com"
}
```

The response body will contain the access token. The access token is valid for 7 days.

### Submit an order ###

Expand Down Expand Up @@ -71,7 +92,7 @@ Allows you to view an existing order. Requires authentication.

PATCH `/orders/:orderId`

Update an existing order. Requires authentication.
Update the costumer name of an existing order. Requires authentication.

The request body needs to be in JSON format and allows you to update the following properties:

Expand Down Expand Up @@ -101,28 +122,6 @@ DELETE /orders/PF6MflPDcuhWobZcgmJy5
Authorization: Bearer <YOUR TOKEN>
```

## API Authentication ##

To submit or view an order, you need to register your API client.

POST `/api-clients/`

The request body needs to be in JSON format and include the following properties:

- `clientName` - String
- `clientEmail` - String

Example

```
{
"clientName": "Postman",
"clientEmail": "valentin@example.com"
}
```

The response body will contain the access token. The access token is valid for 7 days.

**Possible errors**

Status code 409 - "API client already registered." Try changing the values for `clientEmail` and `clientName` to something else.