ibonly / naija-emoji
Requires
- php: >=5.5
- firebase/php-jwt: ^3.0
- guzzlehttp/guzzle: ^6.1
- ibonly/potato-orm: 1.0.0.x-dev
- slim/slim: ^2.6
- vlucas/phpdotenv: ^2.0
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpunit/phpunit: 4.8.*
This package is not auto-updated.
Last update: 2024-12-11 19:37:54 UTC
README
Emojinaija is a restful API service that provide access for emoji management. Just link to the emojinaija.
Installation
PHP 5.5+ and Composer are required.
Via Composer
$ composer require ibonly/naija-emoji $ composer install
Usage
API ENDPOINT
EndPoint Public Access
POST /auth/Login TRUE
GET /auth/Logout FALSE
POST /emojis FALSE
GET /emojis/ TRUE
GET /emojis/{id} TRUE
POST /emojis/{id} FALSE
PATCH /emojis/{id} FALSE
PUT /emojis/{id} FALSE
DELETE /emojis/{id} FALSE
API FUNCTIONALITY
EndPoint Functionality
POST /auth/login Logs a user in
GET /auth/logout Logs a user out
GET /emojis List all the created emojis.
GET /emojis/{id} Gets a single emoji
POST /emojis Create a new emoji
PUT /emojis/{id} Updates an emoji
PATCH /emojis/{id} Partially updates an emoji
DELETE /emojis/{id} Deletes a single emoji
Methods accessible to the public
####Single emoji retrieval
REQUEST:
GET https://emojinaija.herokuapp.com/emoji/1 HEADER: {"Content-Type": "application/json"}
RESPONSE MESSAGE: If emoji with id of 1 exist:
HEADER: {"status": 200} BODY: [ { "id": 1, "name": "lips", "char": "�" "keyword": [ "lips", "parts", "body", "kiss" ], "category": "human", "date_created": "2015-11-19 22:37:08", "date_modified": "2015-10-19 22:37:08", "created_by": "foo" } ]
RESPONSE MESSAGE: If emoji of id 1 is not found
HEADER: {"status": 404} BODY: { "message": "Not Found" }
- Retrieve all emoji
REQUEST:
HEADER: GET https://emojinaija.herokuapp.com/emojis HEADER: {"Content-Type": "application/json"}
RESPONSE MESSAGE: Get all emoji:
HEADER: {"status": 200} BODY: If there are saved resources [ { "id": 3, "name": "Olopa", "char": "👮", "keywords": [ "man", "police", "human" ], "category": "Peoples", "date_created": "2015-11-25 09:30:19", "date_modified": "2015-11-25 09:35:00", "created_by": "foo" }, { "id": 4, "name": "nose", "char": "👃", "keywords": [ "human parts", "nose", "body" ], "category": "human", "date_created": "2015-11-26 09:09:46", "date_modified": "2015-11-26 09:09:46", "created_by": "foo" }, { "id": 5, "name": "Prof", "char": "👴", "keywords": [ "Human", "People" ], "category": "Human", "date_created": "2015-11-26 15:32:19", "date_modified": "2015-11-26 15:32:19", "created_by": "foo" } ]
RESPONSE MESSAGE: If no emoji found:
HEADER: {"status": 404} BODY: { "message": "Not Found" }
-
In order to access private methods, Registration is required and a token will be generated for the registered user when logged in. The token generated will be used to access private API.
-
Registration
REQUEST:
POST https://emojinaija.herokuapp.com/register HEADER: {"Content-Type": "application/json"} BODY: { "username": your_preferred_username, "password": your_preferred_password }
RESPONSE MESSAGE:
HEADER: {"status": 200} BODY: { "username": "ogeni", "message": "Registration Successful. Please Login to generate your token" }
- Login authentication
REQUEST:
POST https://emojinaija.herokuapp.com/auth/login HEADER: {"Content-Type": "application/json"} BODY: { "username": your_username, "password": your_password }
RESPONSE MESSAGE:
HEADER: {"status": 200} BODY: { "username": "user", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" }
- Logout
REQUEST:
GET https://emojinaija.herokuapp.com/auth/logout HEADER: { "Content-Type": "application/json", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" }
RESPONSE MESSAGE:
HEADER: {"status": 200} BODY: { "message": "Logged out Successfully" }
- Creating new emoji
REQUEST:
POST https://emojinaija.herokuapp.com/emojis HEADER: { "Content-Type": "application/json", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" } BODY: { "name": "Horse", "char" : "🐎" "keyword": "Animal, Horse, Farm, Esin", "category": "Animal" }
RESPONSE MESSAGE:
HEADER: {"status": 200} BODY: { "id": 9, "name": "Horse", "char" : "🐎" "keyword": [ "Animal", "Horse", "Farm", "Esin" ], "category": "Animal", "date_created": "2015-11-26 15:32:19", "date_modified": "2015-11-26 15:32:19", "created_by": "foo" }
- Updating emojis
REQUEST:
PUT https://emojinaija.herokuapp.com/emojis/9 PATCH https://emojinaija.herokuapp.com/emojis/9 HEADER: { "Content-Type": "application/json", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" } BODY: { "keyword": "Animal, Horse, Farm, Esin, Zoo", }
RESPONSE MESSAGE:
HEADER: {"status": 200} BODY: { "Message" => "Emoji Updated Successfully" }
- Delete an emojis
REQUEST:
DELETE https://emojinaija.herokuapp.com/emojis/9 HEADER: { "Content-Type": "application/json", "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJpc3" }
RESPONSE MESSAGE:
HEADER: {"status": 200} BODY: { "Message" => "Emoji Deleted" }
Testing
$ vendor/bin/phpunit test
Contributing
To contribute and extend the scope of this package, Please check out CONTRIBUTING file for detailed contribution guidelines.
Credits
Emojinaija is created and maintained by Ibraheem ADENIYI
.