Base URI
https://elon-micro.herokuapp.com
GET Login
Returns a login endpoint
-
URL
/users/login
Example requesthttps://elon-micro.herokuapp.com/users/login
-
Method
GET
-
URL Params
None
-
Data Params
None
-
Success Response
Code: 200
Content:
{ message: "Welcome to Hackerbay. You may login." }
second
Login
Logs in a user by assigning a JWT
-
URL
/users/login
Example request (POST Request)https://elon-micro.herokuapp.com/users/login
-
Method
POST
-
URL Params
None
-
Request Body
{ "username":"***your_username***", "password": "***your_password***" } -
Success Response
Code: 200
Content:
{ "message": "Login Successful! Welcome ***your_username***" } -
Error Response
Code: 401
Content:
{ "message": "You must provide a valid username and password" }
jsonpatch
Patch JSON
Patches a JSON object
-
URL
/jsonpatch
-
Method
PATCH
-
URL Params
None
-
Request Body
'obj' is the object to be patched and 'patchobj' is the patch. 'op' property of 'patchobj' represents patch operations and it accepts only three; add,remove, and replace. The 'key' and 'value' properties represent the key-value pair to be patched.
{ "obj": { "name": "Elon", "age": 21, "gender": "Female" }, "patchobj": { "op": "replace", "key": "gender", "value": "Male" } } -
Success Response
Successful Response comprises of the initial object, an array containing the patch
Code: 200
Content:
{ "message": "Patch Successful", "initialObj": { "name": "Elon", "age": 21, "gender": "Female" }, "jsonPatchArray": [ { "op": "replace", "path": "/gender", "value": "Male" } ], "patchedObj": { "name": "Elon", "age": 21, "gender": "Male" } } -
Error Response
Code: 400
Content:
{ "message": "Body must contain a JSON object and a JSON patch object" }OR
Code: 401
Content:
{ "message": "Authentication Failed ! Login first!" }
thumbnail
Create Thumbnail
Downloads an image from a url provided in a request body and resizes it into a 50X50 thumbnail
-
URL
/thumbnails
-
Method
POST
-
URL Params
None
-
Request Body
Request body comprises of only the url to the image. N/B: File extensions are figured out by the controller assigned to this request.(Do not worry about file extensions)
{ "imgurl": "https://informationcradle.com/kenya/wp-content/uploads/2015/12/maureen-kunga.jpg" } -
Success Response
Successful Response comprises of a unique name of the created thumbnail stored in thumbnails directory in the root folder.
Code: 200
Content:
{ "message": "Thumbnail created", "thumbnail": "c5c656a0-a457-11e8-bef4-a1dafa81ec9e.jpg" } -
Error Response
Code: 400
Content:
{ "message": "You must provide a valid image URL" }OR
Code: 401
Content:
{ "message": "Authentication Failed ! Login first!" }
Built With
- dockerfile
- javascript