- Implement a RESTful JSON HTTP API gateway that allows programmatic CRUD operations on user records.
- All requests should be authenticated using HTTP Basic Authentication i.e. RFC2617
- Host the API gateway on a publicly accessible server.
Note: If you need a server to host your application and would like us to provide one for you, kindly contact our R&D Team on rd@pmglobaltechnology.com
API Endpoint: “http://{HOSTNAME}:{PORT}/users” e.g. http://test.com/users
Authentication
- Username: test
- Password: pass1234
Request
Endpoint : "/users" e.g. http://test.com/users
Method: POST
Data:
{
"firstname": "chibunna",
"lastname": "oduonye",
"gender": "M",
"date_of_birth": "2015-04-08"
}
Response
Code: 200
Data:
{
"id": "1",
"firstname": "chibunna",
"lastname": "oduonye",
"gender": "M",
"date_of_birth": "2015-04-08",
"date_created": "2014-07-17T03:03:34",
"date_updated": "2014-07-17T03:03:34"
}
Request
Endpoint : "/users" e.g. http://test.com/users?filter_field=firstname&filter_value=chibunna
Method: GET
Parameters (Optional):
- sort_field - this can be any field in the JSON e.g. "firstname",
- sort_order_mode - this can be either "asc" or "desc"
- filter_field - this can be any field in the JSON e.g. "firstname",
- filter_value - the criteria upon which the response data will be filtered
- page : The current page. Default is 1
- page_size: The number of records per page. Default is 25
Response
Code: 200
Data:
[
{
"id": "1",
"firstname": "chibunna",
"lastname": "oduonye",
"gender": "M",
"date_of_birth": "1990-04-08",
"date_created": "2014-07-17T03:03:34",
"date_updated": "2014-07-17T03:03:34"
},
{
"id": "2",
"firstname": "Godwin",
"lastname": "Orubebe",
"gender": "M",
"date_of_birth": "1965-04-08",
"date_created": "2014-07-17T04:12:25",
"date_updated": "2014-07-17T04:12:25"
}
]
Request
Endpoint : "/users/{id}" e.g. http://test.com/users/1
Method: GET
Response:
Code: 200
Data:
{
"id": "1",
"firstname": "chibunna",
"lastname": "oduonye",
"gender": "M",
"date_of_birth": "2015-04-08",
"date_created": "2014-07-17T03:03:34",
"date_updated": "2014-07-17T03:03:34"
}
Request
Method: PUT
Endpoint: "users/{id}" e.g. http://test.com/users/1
Payload:
{
"id": "2"
"firstname": "Godwin",
"lastname": "Jega",
"gender": "M",
"date_of_birth": "2015-04-08"
}
Response
Code: 200
Data:
{
"id": "2"
"firstname": "Godwin",
"lastname": "Jega",
"gender": "M",
"date_of_birth": "2015-04-08",
"date_created": "2014-07-17T04:12:25",
"date_updated": "2014-07-17T18:44:19"
}
Request
Method: DELETE
Endpoint: "users/{id}" e.g http://test.com/1
Response
Code: 200
Data:
Milestone | Marks | |
1 | Ability to create new users | 15 |
2 | Ability to update users | 15 |
3 | Ability to delete users | 15 |
4 | Ability to fetch a single user | 15 |
5 | Ability to search for users by at least one criteria | 10 |
6 | Ability to sort users by at least one criteria | 10 |
7 | Authenticates the test user’s credentials | 10 |
8 | Handle error conditions with the correct HTTP status codes e.g. 404, 403, 401, 400 etc | 10 |
TOTAL | 100 |
Send an email to rd@pmglobaltechnology.com that contains
- The URL to your work
- Include any special instructions on how to test it
The closing date for all submissions is April 30, 2015
Updated closing date July 30, 2019
@christianezeani
The response codes should be HTTP response codes because they are sufficient to explain the state of the request. The data that represents the entity should represent only the entity and not any application process logic such as success codes.
For example, if a request is processed successfully, the HTTP spec recommends that you return a
200
error code.Alternatively, if a request cannot be processed because the resource does not exist, you should return a
404
. If the data submitted is badly formatted or wrong, it should return a400
error.For more info on the common error codes, see http://micheltriana.com/2013/09/27/http-status-codes-in-rest-web-api/