RESTful API for acqua / acqua를 위한 RESTful API
Short for ‘acquaintance’, acqua is a service for managing your acquaintances. Never forget anything about your friends, coworkers, and family again; make memos on acqua, and it will remind you of your friends’ details right before you meet them. Use the acqua calendar for additional functionality like schedule integration with your friends and reminders.
RESTful API for acqua
Server written in Node.js, database in MySQL
Deployed to Heroku, current URL: https://acqua-api.herokuapp.com
POST
POST
GET
GET
GET
GET
PUT
PUT
GET
GET
PUT
GET
GET
POST
PUT
POST
user
to sign upusers
table in the database and a JWT token is returned
{
"email": "email address",
"password": "password",
"first_name": "first name",
"last_name": "last name",
"phone_number": "phone number"
}
{
"isSuccess": true,
"user": {
"id": 231
"last_name": "Belfort",
"first_name": "Jordan",
"email": "apitest@gmail.com",
"phone_number": "01049182881"
}
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE0LCJpYXQiOjE1MzQ3NTI3MTAzMzF9.ZYo5qXNkGJ7l1rvCaKIYLknkUJNa3YjXT87Do-PyQZI"
}
POST
user
to sign in
{
"email": "email address",
"password": "password"
}
{
"isSuccess": true,
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE0LCJpYXQiOjE1MzQ3NTI3MTAzMzF9.ZYo5qXNkGJ7l1rvCaKIYLknkUJNa3YjXT87Do-PyQZI"
}
GET
entries
written by user
about other friends
user
identified by JWT token provided in the header
{
"authorization": "JWT token"
}
friend_id
(entries
table friend_id
column users
table id
column)
[
{
"id": 423,
"user_id": 2,
"friend_id": 8,
"memo": "memo written by user 2 about user 8, blah blah...",
"created_at": "2018-08-19T12:30:21.000Z",
"last_modified": "2018-08-19T12:30:21.000Z"
},
{
"id": 516,
"user_id": 2,
"friend_id": 8,
"memo": "another memo written by user 2 about user 8, blah blah...",
"created_at": "2018-08-20T06:32:17.000Z",
"last_modified": "2018-08-20T06:32:17.000Z"
},
...
]
POST
entry
written by user
about friend
to the database
{
"authorization": "JWT token"
}
{
"memo": "memo about a friend"
}
friend_id
(entries
table friend_id
column users
table id
column)
{
"isSuccess": true,
"user_id": 2,
"friend_id": 8,
"entry_id": 610
}
PUT
user
‘s memo about friend
using entry_id
{
"authorization": "JWT token"
}
{
"memo": "edited memo"
}
entry_id
(entries
table id
column)
{
"isSuccess": true,
"user_id": 15,
"friend_id": 13,
"entry_id": 9
}
GET
user
‘s friends
{
"authorization": "JWT token"
}
{
"friends_list": [
{
"id": 7,
"last_name": "Park",
"first_name": "Mark",
"email": "parkmark@gmail.com",
"phone_number": "01099291028"
},
{
"id": 9,
"last_name": "Jong",
"first_name": "Soon",
"email": "jongsoon@gmail.com",
"phone_number": "01012345678"
},
...
]
}
friend
for user
{
"authorization": "JWT token"
}
{
"friend_id": "friend_id"
}
{
"isSuccess": true,
"friend_id": 8
}
PUT
friend
‘s nickname to be displayed to user
{
"authorization": "JWT token"
}
{
"nickname": "new nickname"
}
friend_id
(friends
table friend_id
column users
table id
column)
{
"isSuccess": true,
"friend_id": 7,
"nickname": "Wolverine"
}
GET
user
‘s complete profile information
{
"authorization": "JWT token"
}
{
"basic_profile": {
"id": 116,
"last_name": "Lee",
"first_name": "Paul",
"email": "paul@gmail.com",
"phone_number": "01031887610"
},
"expanded_profile": {
"gender": "male",
"birthday": null,
"profile_picture": null,
"high_school": "Walnut High School",
"university_name": "Emory University",
"university_major": "Computer Science",
"graduate_masters_name": null,
"graduate_masters_major": null,
"graduate_phd_name": null,
"graduate_phd_major": null
},
"work_history": [
{
"id": 231,
"user_id": 116,
"status": "current",
"company": "Twitter",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
{
"id": 182,
"user_id": 116,
"status": "past",
"company": "Samsung",
"position": "Intern",
"start_date": "2015-11-22T15:00:00.000Z",
"end_date": null
},
...
]
"current_work": [
{
"id": 231,
"user_id": 16,
"status": "current",
"company": "Twitter",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
...
]
}
GET
user
‘s complete profile information
{
"authorization": "JWT token"
}
user_id
(users
table id
column profiles
table user_id
column works
table user_id
column)
{
"basic_profile": {
"id": 116,
"last_name": "Lee",
"first_name": "Paul",
"email": "paul@gmail.com",
"phone_number": "01031887610"
},
"expanded_profile": {
"gender": "male",
"birthday": null,
"profile_picture": null,
"high_school": "Walnut High School",
"university_name": "Emory University",
"university_major": "Computer Science",
"graduate_masters_name": null,
"graduate_masters_major": null,
"graduate_phd_name": null,
"graduate_phd_major": null
},
"work_history": [
{
"id": 231,
"user_id": 116,
"status": "current",
"company": "Twitter",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
{
"id": 182,
"user_id": 116,
"status": "past",
"company": "Samsung",
"position": "Intern",
"start_date": "2015-11-22T15:00:00.000Z",
"end_date": null
},
...
]
"current_work": [
{
"id": 231,
"user_id": 16,
"status": "current",
"company": "Twitter",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
...
]
}
GET
profile
information about own user
{
"authorization": "JWT token"
}
{
"id": 231
"last_name": "Belfort",
"first_name": "Jordan",
"email": "apitest@gmail.com",
"phone_number": "01049182881"
}
GET
profile
information about another user
{
"authorization": "JWT token"
}
user_id
(users
table id
column)
{
"id": 231
"last_name": "Belfort",
"first_name": "Jordan",
"email": "apitest@gmail.com",
"phone_number": "01049182881"
}
PUT
user
‘s basic, private profile
information, except for passwordupdate
parameter is true
, the item is updated to value
; if false
, the item is not updatedupdatedItems
in the response contains only items that were updated
{
"authorization": "JWT token"
}
{
"last_name": {
"update": true or false,
"value": "updated value"
},
"first_name": {
"update": true or false,
"value": "updated value"
},
"email": {
"update": true or false,
"value": "updated value"
},
"phone_number": {
"update": true or false,
"value": "updated value"
}
}
{
"isSuccess": true,
"updatedItems": {
"last_name": "Kim",
"first_name": "Chulsoo",
"email": "chulsoo@gmail.com"
"phone_number": "01012345678"
}
}
PUT
user
‘s password
{
"authorization": "JWT token"
}
{
"old_password": "original password",
"new_password": "new password"
}
{
"isSuccess": true
}
GET
user
‘s public profile
information
{
"authorization": "JWT token"
}
{
"user_id": 13,
"gender": "female",
"birthday": null,
"profile_picture": null,
"high_school": "Centennial High School",
"university_name": "Korea University",
"university_major": "Computer Science",
"graduate_masters_name": null,
"graduate_masters_major": null,
"graduate_phd_name": null,
"graduate_phd_major": null
}
GET
user
‘s public profile
information
{
"authorization": "JWT token"
}
user_id
(profiles
table user_id
column users
table id
column)
{
"user_id": 13,
"gender": "female",
"birthday": null,
"profile_picture": null,
"high_school": "Centennial High School",
"university_name": "Korea University",
"university_major": "Computer Science",
"graduate_masters_name": null,
"graduate_masters_major": null,
"graduate_phd_name": null,
"graduate_phd_major": null
}
PUT
user
‘s public profile
informationupdate
parameter is true
, the item is updated to value
; if false
, the item is not updatedupdatedItems
in the response contains only items that were updated
{
"authorization": "JWT token"
}
{
"gender": {
"update": true or false,
"value": "updated value"
},
"birthday": {
"update": true or false,
"value": "updated value"
},
"profile_picture": {
"update": true or false,
"value": "updated value"
},
"high_school": {
"update": true or false,
"value": "updated value"
},
"university_name": {
"update": true or false,
"value": "updated value"
},
"university_major": {
"update": true or false,
"value": "updated value"
},
"graduate_masters_name": {
"update": true or false,
"value": "updated value"
},
"graduate_masters_major": {
"update": true or false,
"value": "updated value"
},
"graduate_phd_name": {
"update": true or false,
"value": "updated value"
},
"graduate_phd_major": {
"update": true or false,
"value": "updated value"
}
}
{
"isSuccess": true,
"updatedItems": {
"gender": "male",
"birthday": "1994-07-18",
"profile_picture": "path/images/1923812.png",
"high_school": "Los Osos High School",
"university_name": "Brown University",
"university_major": "Anthropology",
"graduate_masters_name": "Harvard University",
"graduate_masters_major": "Political Science",
"graduate_phd_name": "Yale University",
"graduate_phd_major": "Economics"
}
}
GET
user
‘s work
history information
{
"authorization": "JWT token"
}
{
"work_history": [
{
"id": 231,
"user_id": 16,
"status": "current",
"company": "Google",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
{
"id": 320,
"user_id": 16,
"status": "past",
"company": "Samsung",
"position": "Intern",
"start_date": "2015-11-22T15:00:00.000Z",
"end_date": null
},
...
],
"current_work": [
{
"id": 231,
"user_id": 16,
"status": "current",
"company": "Google",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
...
]
}
GET
user
‘s work
history information
{
"authorization": "JWT token"
}
user_id
(works
table user_id
column users
table id
column)
{
"work_history": [
{
"id": 231,
"user_id": 16,
"status": "current",
"company": "Google",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
{
"id": 320,
"user_id": 16,
"status": "past",
"company": "Samsung",
"position": "Intern",
"start_date": "2015-11-22T15:00:00.000Z",
"end_date": null
},
...
],
"current_work": [
{
"id": 231,
"user_id": 16,
"status": "current",
"company": "Google",
"position": "Developer",
"start_date": "2017-06-20T15:00:00.000Z",
"end_date": null
},
...
]
}
POST
user
‘s work
historycompany
, position
, start_date
are required parametersend_date
can be included if work
has ended, in which case the ended
parameter should be set to true
and value
provided. status
is set to past
automatically.work
is ongoing, set ended
to false
and leave value
empty. status
is set to current
automatically.
{
"authorization": "JWT token"
}
{
"company": "company name",
"position": "job position",
"start_date": "starting date",
"end_date": {
"ended": true or false,
"value": "ending date if work ended"
}
}
{
"isSuccess": true,
"work": {
"id": 118,
"user_id": 165,
"company": "JP Morgan",
"position": "Financial Analyst",
"start_date": "2016-08-01",
"end_date": "2018-06-01",
"status": "past"
}
}
PUT
user
‘s work
history informationstart_date
and end_date
are updated, it must be checked that start_date
is not later than end_date
. If the conditions are not met, an error message is returned.
{
"authorization": "JWT token"
}
{
"company": {
"update": true or false,
"value": "updated value"
},
"position": {
"update": true or false,
"value": "updated value"
},
"start_date": {
"update": true or false,
"value": "updated value"
},
"end_date": {
"update": true or false,
"value": "updated value"
}
}
item_id
(works
table id
column)
{
"isSuccess": true,
"work_updated": {
"id": "12",
"user_id": 15,
"company": "Hyundai Motors",
"position": "Marketer",
"start_date": "2017-06-13",
"end_date": null,
"status": "current"
}
}