Simple Rest API for managing book's CRUD. App retrieves book info from OpenLibrary api by ISBN
Authentication All requests, excluding /signup, should have these headers to be authorizes:
- Key: user key
- Sign: MD5 sign of the following string "{Method}+{URL}+{Body}+{UserSecret}"
Example: User:
- Key: "MyUserKey"
- Secret: "MyUserSecret"
REQUEST:
- Method: "POST"
- URL: "http://mydomain.com/books"
- Body: "{"isbn":"9781118464465"}"
AUTH HEADERS: String to sign should be as follows "POSThttp://mydomain.com/books{"isbn":"9781118464465"}MyUserSecret"
- Key: "MyUserKey"
- Sign: "a616317d753f2b4520d0717395b41a21"
curl --location --request POST '/signup' \
--header 'Key: {Key}' \
--header 'Sign: {Sign}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Jackson",
"key": "MyKey",
"secret": "MySecret"
}'
{
"data": {
"id": 32,
"name": "Jackson",
"key": "MyKey",
"secret": "MySecret"
},
"isOk": true,
"message": "ok"
}
curl --location --request GET '/myself' \
--header 'Key: {key}' \
--header 'Sign: {sign}'
{
"data": {
"id": 32,
"name": "Jackson",
"key": "MyKey",
"secret": "MySecret"
},
"isOk": true,
"message": "ok"
}
curl --location --request POST '/books' \
--header 'Key: {key}' \
--header 'Sign: {sign}' \
--data-raw '{
"isbn":"9781118464465"
}'
{
"data": {
"book": {
"id": 21,
"isbn": "9781118464465",
"title": "Raspberry Pi User Guide",
"author": "Eben Upton",
"published": 2012,
"pages": 221
},
"status": 2
},
"isOk": true,
"message": "ok"
}
curl --location --request GET '/books' \
--header 'Key: {key}' \
--header 'Sign: {sign}'
{
"data": [
{
"book": {
"id": 21,
"isbn": "9781118464465",
"title": "Raspberry Pi User Guide",
"author": "Eben Upton",
"published": 2012,
"pages": 221
},
"status": 0
}
],
"isOk": true,
"message": "ok"
}
curl --location --request PATCH '/books/:id' \
--header 'Key: {key}' \
--header 'Sign: {sign}' \
--data-raw '{
"book": {
"isbn": "9781118464465",
"title": "Raspberry Pi User Guide",
"author": "Eben Upton",
"published": 2012,
"pages": 221
},
"status": 1
}'
{
"data": {
"book": {
"id": 21,
"isbn": "9781118464465",
"title": "Raspberry Pi User Guide",
"author": "Eben Upton",
"published": 2012,
"pages": 221
},
"status": 1
},
"isOk": true,
"message": "ok"
}
curl --location --request GET '/books' \
--header 'Key: {key}' \
--header 'Sign: {sign}'
{
"data": "Successfully deleted",
"isOk": true,
"message": "ok"
}