From 097ada5f11c47d26880ca18f71d55ba38a19ac04 Mon Sep 17 00:00:00 2001 From: emmymayo Date: Wed, 22 Feb 2023 20:39:46 +0100 Subject: [PATCH] initial commit --- QA.postman_collection.json | 304 +++++++++++++++++++++++++++++++++++++ readme.md | 83 ++++++++++ 2 files changed, 387 insertions(+) create mode 100644 QA.postman_collection.json create mode 100644 readme.md diff --git a/QA.postman_collection.json b/QA.postman_collection.json new file mode 100644 index 0000000..4b14c97 --- /dev/null +++ b/QA.postman_collection.json @@ -0,0 +1,304 @@ +{ + "info": { + "_postman_id": "c5f48fad-7390-4a3d-b93d-0517f1529f06", + "name": "QA", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "19666283" + }, + "item": [ + { + "name": "List Books (No Auth)", + "request": { + "method": "GET", + "header": [ + { + "key": "x-project", + "value": "bGlicmFyeTpyM3VqMWI2Ym84ZGsxNTBhazkxYjVmYWtrazZyZjY=", + "type": "text" + } + ], + "url": { + "raw": "{{baseURL}}/v2/api/custom/qa/books", + "host": [ + "{{baseURL}}" + ], + "path": [ + "v2", + "api", + "custom", + "qa", + "books" + ] + } + }, + "response": [] + }, + { + "name": "Get A Book (No Auth)", + "request": { + "method": "GET", + "header": [ + { + "key": "x-project", + "value": "bGlicmFyeTpyM3VqMWI2Ym84ZGsxNTBhazkxYjVmYWtrazZyZjY=", + "type": "text" + } + ], + "url": { + "raw": "{{baseURL}}/v2/api/custom/qa/books/3", + "host": [ + "{{baseURL}}" + ], + "path": [ + "v2", + "api", + "custom", + "qa", + "books", + "3" + ] + } + }, + "response": [] + }, + { + "name": "Create Book (Auth)", + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjozLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2NzcwODI4MzUsImV4cCI6MTY3NzA4NjQzNX0.Mk6ArQ6TXkAEiyDA4GgSJnqcLJtoCg47fkLTlpCbZVw", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "x-project", + "value": "bGlicmFyeTpyM3VqMWI2Ym84ZGsxNTBhazkxYjVmYWtrazZyZjY=", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"Sage Mode\",\r\n \"publisher\": \"Roberts Publishing\",\r\n \"cost_price\": 200,\r\n \"selling_price\": 600,\r\n \"author_id\": 0\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseURL}}/v2/api/custom/qa/books", + "host": [ + "{{baseURL}}" + ], + "path": [ + "v2", + "api", + "custom", + "qa", + "books" + ] + } + }, + "response": [] + }, + { + "name": "Update Book (Auth)", + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjozLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2NzcwNzk0MTcsImV4cCI6MTY3NzA4MzAxN30.pdGQDnJG9PSMI-jw4LUiv0rq_VOvGssvKiJq-qrjN2c", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "x-project", + "value": "bGlicmFyeTpyM3VqMWI2Ym84ZGsxNTBhazkxYjVmYWtrazZyZjY=", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"Sage Mode\",\r\n \"publisher\": \"Robert \",\r\n \"cost_price\": 400,\r\n \"selling_price\": 600,\r\n \"author_id\": 1,\r\n \"title_id\": 1\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseURL}}/v2/api/custom/qa/books/5", + "host": [ + "{{baseURL}}" + ], + "path": [ + "v2", + "api", + "custom", + "qa", + "books", + "5" + ] + } + }, + "response": [] + }, + { + "name": "Delete Book (Auth)", + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjozLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2NzcwNzk0MTcsImV4cCI6MTY3NzA4MzAxN30.pdGQDnJG9PSMI-jw4LUiv0rq_VOvGssvKiJq-qrjN2c", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [ + { + "key": "x-project", + "value": "bGlicmFyeTpyM3VqMWI2Ym84ZGsxNTBhazkxYjVmYWtrazZyZjY=", + "type": "text" + } + ], + "url": { + "raw": "{{baseURL}}/v2/api/custom/qa/books/5", + "host": [ + "{{baseURL}}" + ], + "path": [ + "v2", + "api", + "custom", + "qa", + "books", + "5" + ] + } + }, + "response": [] + }, + { + "name": "Create Author (Auth)", + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjozLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2NzcwNzk0MTcsImV4cCI6MTY3NzA4MzAxN30.pdGQDnJG9PSMI-jw4LUiv0rq_VOvGssvKiJq-qrjN2c", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "x-project", + "value": "bGlicmFyeTpyM3VqMWI2Ym84ZGsxNTBhazkxYjVmYWtrazZyZjY=", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"Sam Dam\",\r\n \"age\": 35,\r\n \"rating\": 3\r\n \r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseURL}}/v2/api/custom/qa/authors", + "host": [ + "{{baseURL}}" + ], + "path": [ + "v2", + "api", + "custom", + "qa", + "authors" + ] + } + }, + "response": [] + }, + { + "name": "Authenticate", + "request": { + "method": "POST", + "header": [ + { + "key": "x-project", + "value": "bGlicmFyeTpyM3VqMWI2Ym84ZGsxNTBhazkxYjVmYWtrazZyZjY=", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"email\": \"adminlibrary3@manaknight.com\",\r\n \"password\": \"a123456\",\r\n \"role\": \"admin\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseURL}}/v2/api/lambda/login", + "host": [ + "{{baseURL}}" + ], + "path": [ + "v2", + "api", + "lambda", + "login" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "baseURL", + "value": "https://mkdlabs.com", + "type": "string" + } + ] +} \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..a28e43d --- /dev/null +++ b/readme.md @@ -0,0 +1,83 @@ + +**BASE** : https://mkdlabs.com +**Credential** + - role : admin, + - email: adminlibrary3@manaknight.com. + - password: a123456 + + +## APIS + +***Authenticate*** + + POST /v2/api/lambda/login + + *Authenticates a user and returns the token which expires in an hour.* + Required/Mandatory Fields + email: 'required|string' + password: 'required|string' + role: 'required' + + +***List Books*** + + GET /v2/api/custom/qa/books + + *List all books* + +***Get A Book*** + + GET /v2/api/custom/qa/books/:id + *Get a book where id is `:id`* + +***Create Book*** + + POST /v2/api/custom/qa/books + + *Creates a new book,* + + - [x] Bearer authentication required, role - admin + + Required/Mandatory Body + name: 'required|string', + publisher: 'required|string', + cost_price: 'required' + +***Update Book*** + + PUT /v2/api/custom/qa/books/:id + + *Updates book where id is `:id`,* + + - [x] Bearer authentication required, role - admin + + Body + name: 'sometimes|string', + publisher: 'sometimes|string', + cost_price: 'sometimes', + selling_price: 'sometimes', + author_id: 'sometimes', + title_id: 'sometimes' + +***Delete Book*** + + + DELETE /v2/api/custom/qa/books/:id + + *Deletes book where id is `:id`,* + + - [x] Bearer authentication required, role - admin + + +***Create Author*** + + POST /v2/api/custom/qa/authors + + *Creates a new author,* + + + - [x] Bearer authentication required, role - admin + + Required/Mandatory body + name: 'required|string', + age: 'required|number', \ No newline at end of file