Create an application that helps user transer and store their business cards virtually.
https://bussiness-card-app.herokuapp.com/
The preferred JSON object to be returned by the API is structured as follows:
Login
{
"status": 200,
"data": [
{
"id": 2,
"first_name": "Ikechukwu",
"last_name": " Nmeregini",
"email": "nmereginiikechukwu@yahoo.com",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0IjoyLCJ1c2VybmFtZSI6Im5tZXJlZ2luaWlrZWNodWt3dUB5YWhvby5jb20iLCJpYXQiOjE1NjQ0MjUzMjgsImV4cCI6MTU2NDUxMTcyOH0.6_njjykrIyMgqctr0hDvKYi8kuyPoHoHz3TFAV2PgrE"
}
]
}
{
"status": 201,
"data": [
{
"first_name": "Ikechukwu",
"last_name": " Nmeregini",
"email": "nmereginiikechukwu@yahoo.com"
}
]
}
"status": 200,
"data": [
{
"id": "1",
"first_name": "Vincent",
"last_name": "Nmeregini",
"email": "nmereginivincent@gmail.com"
}
]
"status": 201,
"data": [
{
"event_name": "lambda build week",
"event_date : "22/8/2019",
"event_venue" : " zoom",
"event_location": "online",
"user_id" : 2,
}
]
"status": 200,
"data": [
{
"id": 1,
"name_event": "lambda school hackaton",
"event_date": "2019-01-11T23:00:00.000Z",
"event_venue": "zoom",
"event_location": "online",
"user_id": 1
},
{
"id": 3,
"name_event": "lambda school hackaton",
"event_date": "2019-01-11T23:00:00.000Z",
"event_venue": "zoom",
"event_location": "online",
"user_id": 1
},
{
"id": 4,
"name_event": "lambda school hackaton",
"event_date": "2019-01-11T23:00:00.000Z",
"event_venue": "zoom",
"event_location": "online",
"user_id": 1
},
"status": 201,
"data": [
{
"id": 1,
"qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACECAYAAABRRIOnAAAAAklEQVR4AewaftIAAAOVSURBVO3BO67kWgIDwcwD7X/LnDaeQUuAoKrbn2GE+YWZ/xxmymGmHGbKYaYcZsphphxmymGmHGbKYaYcZsphphxmymGmHGbKxUsqPykJn6TSkvCESktCU/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lymCmHmXKYKYeZcpgp/wOBdYNA7Yhm3QAAAABJRU5ErkJggg==",
"occupation": "software engineer",
"phone": "08097425429",
"created_at": "2019-07-31T10:52:30.523Z",
"user_id": 1
}
]
"status": 200,
"data": [
{
"occupation": "software engineer",
"phone": "08056745324",
"name_event": "lambda build week",
"event_date": "2019-02-01T23:00:00.000Z",
"event_venue": "zoom",
"event_location": "online"
},
{
"occupation": "Fullstack Software engineer",
"phone": "08097425429",
"name_event": "lambda build week",
"event_date": "2019-02-01T23:00:00.000Z",
"event_venue": "zoom",
"event_location": "online"
}
]
If a request fails any validations, expect errors in the following format:
{
"status": 400,
"message": "User already exists"
}
}
If requests on creating or updating event fails any validations, expect errors in the following format:
{
"status": 400,
"message": {
"name_event": [
"The name event field is required."
],
"event_venue": [
"The event venue field is required."
]
}
}
401 for Unauthorized requests, when a request requires authentication but it isn't provided
403 for Forbidden requests, when a request may be valid but the user doesn't have permissions to perform the action
404 for Not found requests, when a resource can't be found to fulfill the request
POST /api/login
Example request body:
{
"user":{
"email": "jake@jake.jake",
"password": "jakejake"
}
}
No authentication required, returns a User
Required fields: email
, password
POST /api/register
Example request body:
{
"email": "nmereginiikechukwu@yahoo.com",
"first_name" : "Ikechukwu",
"last_name" : " Nmeregini",
"password": "12345"
}
No authentication required, returns a User
Required fields: email
, first_name
, last_name
,password
GET /api/user/:id
req.header.token = token
Authentication required, returns a User that's the current user
set token on the header and pass the token recieved during Login
PATCH /api/user/:id/image
req.header.token = token
Authentication required, returns a User that's the current user
set token on the header and pass the token recieved during Login
Example request body:
{
"user_image" : the image you want to upload
}
POST /api/user/:id/event
where id id the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Example request body:
{
"event_name": "lambda build week",
"event_date : "22/8/2019",
"event_venue" : " zoom",
"event_location": "online",
}
Required fields: event_name
, event_date
, event_venue
Authentication is required set token in req.header
GET /api/user/:id/event
where id id the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
PATCH /api/user/:id/event/event_id
where id is the users id
event_id is the events id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Example in request body:
{
"event_name": "lambda build week frontend",
"event_date : "22/8/2019",
"event_venue" : " zoom",
"event_location": "online",
}
Required fields: event_name
, event_date
, event_venue
returns all the events for that user
DELETE /api/user/:id/event/event_id
where id is the users id
event_id is the events id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Returns the event deleted by the user.
POST /api/user/:id/card
where id is the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Example in request body:
{
qr_code: "https://www.google.com",
occupation: "Software engineer",
phone: "08097425429"
}
Required fields: qr_code
, occupation
, phone
qr_code
must be a valid url and phone
a valid moblile number.
GET /api/user/:id/card
where id is the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Returns the users bussiness card
PATCH /api/user/:id/card
where id is the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Example in request body:
{
qr_code: "https://www.google.com",
occupation: "Software engineer",
phone: "08097425429"
}
Required fields: qr_code
, occupation
, phone
qr_code
must be a valid url and phone
a valid moblile number.
DELETE /api/user/:id/card
where id is the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Returns the card deleted.
POST /api/user/:id/collection
where id is the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Example in request body:
{
card_id: 1,
event_id: 2,
}
Required fields:card_id
the id of the card you want to add.
if user already have the card it returns a 400.
GET /api/user/:id/collection
where id is the users id
req.header.token = token
Authentication required, returns a User that's the current user set token on the header and pass the token recieved during Login
Returns the list of bussiness cards.