#naija_emojis
This is a simple RESTFul API rendering emoji service to users. It was built with PHP and implements the Slim framework and JSON web token (JWT) for user authentication.
Via Composer
$ composer require Wilson/naija-emoji
- Create a new users
Send a POST request to https://w-naija-emoji.herokuapp.com/register
request body:
{
'username' : 'wil',
'password' : '******'
'name' : 'Wilson Omokoro'
}
response
{
'Status' : '200'
'Message' : 'User registration successful.'
}
- User login
Send a POST request to https://w-naija-emoji.herokuapp.com/auth/login
request body:
{
'username' : 'wil',
'password' : '******'
}
A JSON Web Token should be returned on successful login
response
{
'Status' : '200'
'Message' : 'Login successful'
'Token' : 'eyJ0eXAiOiJKV1QiLCJh.bGciOiJIUzI1NiJ9.eyJpYXQiOjE0NT'
}
- User logout
Send a GET request to https://w-naija-emoji.herokuapp.com/auth/logout
request header
{
'Authorization' : 'eyJ0eXAiOiJKV1QiLCJh.bGciOiJIUzI1NiJ9.eyJpYXQiOjE0NT';
}
- Create an Emoji
Send a POST request to https://w-naija-emoji.herokuapp.com/emojis
request body:
{
'name' : 'Happy'
'emoji_char' : 😀
'category' : 'Facial'
'key_words' : ['happy, glad, delighted']
'created_by' : 'Wilson Omokoro'
}
request header
{
'Authorization' : 'eyJ0eXAiOiJKV1QiLCJh.bGciOiJIUzI1NiJ9.eyJpYXQiOjE0NT';
}
response
{
'Status' : '201'
'Message' : 'Emoji creation successful.'
}
- Show all Emojis in the database
Send a GET request to https://w-naija-emoji.herokuapp.com/emojis
Response should contain all emojis in JSON format.
- Get a particular Emoji
Send a GET request containing the Emoji's ID in the emojis table to https://w-naija-emoji.herokuapp.com/emojis
E.g. to get the third emoji:
https://w-naija-emojis.herokuapp.com/emojis/3
Response should contain the emoji in JSON format.
- Partialy update an Emoji
Send a PATCH request containing the Emoji's ID in the emojis table to https://w-naija-emoji.herokuapp.com/emojis
E.g. to update just the name of the first emoji:
https://w-naija-emojis.herokuapp.com/emojis/1
request body
{
'name' : 'some other name',
}
request header
{
'Authorization' : 'eyJ0eXAiOiJKV1QiLCJh.bGciOiJIUzI1NiJ9.eyJpYXQiOjE0NT';
}
response
{
'Status' : '200'
'Message' : 'Emoji successfully updated.'
}
- Fully update an Emoji
Send a PUT request containing the Emoji's ID in the emojis table to https://w-naija-emoji.herokuapp.com/emojis
E.g. to fully update the first emoji:
https://w-naija-emojis.herokuapp.com/emojis/1
request body
{
'name' : 'Happy'
'emoji_char' : 😀
'category' : 'Facial'
'key_words' : 'happy, glad, delighted'
'created_by' : 'Wilson Omokoro'
}
request header
{
'Authorization' : 'eyJ0eXAiOiJKV1QiLCJh.bGciOiJIUzI1NiJ9.eyJpYXQiOjE0NT';
}
response
{
'Status' : '200'
'Message' : 'Emoji successfully updated.'
}
- Delete a particular Emoji
Send a DELETE request containing the Emoji's ID in the emojis table to https://w-naija-emoji.herokuapp.com/emojis
E.g. to DELETE the third emoji:
https://w-naija-emojis.herokuapp.com/emojis/3
request header
{
'Authorization' : 'eyJ0eXAiOiJKV1QiLCJh.bGciOiJIUzI1NiJ9.eyJpYXQiOjE0NT';
}
response
{
'Status' : '200'
'Message' : 'Emoji 3 deletion successful.'
}
If the folder containing your test classes is "tests"
$ phpunit tests
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email wilson.omokoro@andela.com instead of using the issue tracker.
Naija-emoji is maintained by Wilson Omokoro.
The MIT License (MIT). Please see License File for more information.