-
Notifications
You must be signed in to change notification settings - Fork 0
User Account API
Muhammad Surya edited this page Nov 25, 2015
·
1 revision
POST /account/register/personal
Example Request:
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 39338bcb-a2f6-7029-9473-5a45d07ddc8b" -d '{
"username" : "vivi",
"password" : "vivi123",
"email" : "vivi@gmail.com",
"personal" : {
"firstname" : "Putri",
"middlename" : "Vivi",
"lastname" : "Melati",
"birthdate" : "Nov 21 1995",
"address" : "Perumahan Naga merah",
"telephone" : "0853535353"
}
}
' 'https://milarian.herokuapp.com/account/register/personal'
Example Response:
{
"__v": 0,
"username": "vivi",
"password": "$2a$05$qGfKRz/2vF2SYg4BkfygVO.kkUCFhdhrPzTTpjJQ6GAVLTQLtix6O",
"email": "vivi@gmail.com",
"personal": {
"__v": 0,
"firstname": "Putri",
"middlename": "Vivi",
"lastname": "Melati",
"birthdate": "1995-11-21T00:00:00.000Z",
"address": "Perumahan Naga merah",
"telephone": "0853535353",
"_id": "565607e2f389361100f268bc",
"updated_at": "2015-11-25T19:11:30.574Z"
},
"_id": "565607e2f389361100f268bd",
"roles": "personal"
}
POST /account/register/company
Example Request:
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 0e8b7995-0006-c807-dd03-0051859c111e" -d '{
"username" : "cocacola",
"password" : "cocacola",
"email" : "admin@cola.com",
"company" : {
"name" : "PT. Coca-cola",
"industry" : "fast drink",
"address" : "Jakarta",
"telephone" : "23343"
}
}
' 'https://milarian.herokuapp.com/account/register/company'
Example Response:
{
"__v": 0,
"username": "cocacola",
"password": "$2a$05$ocz2.hfhY.9zgKHO0oihN.d7C9pRWHTUmnn.wQkZUDbXFYEOQX17O",
"email": "admin@cola.com",
"company": {
"__v": 0,
"name": "PT. Coca-cola",
"industry": "fast drink",
"address": "Jakarta",
"telephone": "23343",
"_id": "565609d9f389361100f268c0",
"updated_at": "2015-11-25T19:19:53.726Z"
},
"_id": "565609d9f389361100f268c1",
"roles": "company"
}
PUT /account/
Example Request:
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Basic dml2aTp2aXZpMTIz" -H "Cache-Control: no-cache" -H "Postman-Token: 3f492b97-164b-2238-0a32-16e6bda2cde8" -d '{
"email" : "putri.melati@gmail.com",
"personal" : {
"telephone": "08123123123"
}
}
' 'https://milarian.herokuapp.com/account/'
Example Response:
{
"_id": "565607e2f389361100f268bd",
"username": "vivi",
"password": "$2a$05$qGfKRz/2vF2SYg4BkfygVO.kkUCFhdhrPzTTpjJQ6GAVLTQLtix6O",
"email": "putri.melati@gmail.com",
"personal": "565607e2f389361100f268bc",
"__v": 0,
"roles": "personal"
}
GET /account/
Example Request:
curl -X GET -H "Content-Type: application/json" -H "Authorization: Basic dml2aTp2aXZpMTIz" -H "Cache-Control: no-cache" -H "Postman-Token: 6d7a66f7-e640-8bd3-0602-47549fbff1b1" 'https://milarian.herokuapp.com/account/'
Example Response:
{
"_id": "565607e2f389361100f268bd",
"username": "vivi",
"email": "putri.melati@gmail.com",
"personal": {
"_id": "565607e2f389361100f268bc",
"firstname": "Putri",
"middlename": "Vivi",
"lastname": "Melati",
"birthdate": "1995-11-21T00:00:00.000Z",
"address": "Perumahan Naga merah",
"telephone": "08123123123",
"__v": 0,
"updated_at": "2015-11-25T19:11:30.574Z"
},
"__v": 0,
"roles": "personal"
}