A centralized REST API server for due diligence system built using Falcon web framework.
This project uses virtualenv as isolated Python environment for installation and running. Therefore, virtualenv must be installed. And you may need a related dependency library for a PostgreSQL database. See install.sh for details.
Install all the python module dependencies in requirements.txt
./install.sh
Start server
./bin/run.sh start
You need to set APP_ENV
environment variables before deployment. You can set LIVE mode in Linux/Heroku as follows.
In Linux, just set APP_ENV
to run in live mode.
export APP_ENV=live
./bin/run.sh start
In Heroku, use the command config:set
. (See here for details)
heroku config:set APP_ENV=live
Create an user
- Request
curl -XPOST http://localhost:5000/v1/users -H "Content-Type: application/json" -d '{
"username": "test1",
"email": "test1@gmail.com",
"password": "test1234"
}'
- Response
{
"meta": {
"code": 200,
"message": "OK",
},
"data": null
}
Log in with email and password
- Request
curl -XGET http://localhost:5000/v1/users/self/login -H "Content-Type: application/json" -d '{
"email": "test1@gmail.com",
"password": "test1234"
}'
- Response
{
"meta": {
"code": 200,
"message": "OK"
},
"data": {
"username": "test1",
"token": "gAAAAABV-TpG0Gk6LhU5437VmJwZwgkyDG9Jj-UMtRZ-EtnuDOkb5sc0LPLeHNBL4FLsIkTsi91rdMjDYVKRQ8OWJuHNsb5rKw==",
"email": "test1@gmail.com",
"created": 1442396742,
"sid": "3595073989",
"modified": 1442396742
}
}
Get a collection of users with auth token
- Request
curl -XGET http://localhost:5000/v1/users/100 -H "Authorization: gAAAAABV6Cxtz2qbcgOOzcjjyoBXBxJbjxwY2cSPdJB4gta07ZQXUU5NQ2BWAFIxSZlnlCl7wAwLe0RtBECUuV96RX9iiU63BP7wI1RQW-G3a1zilI3FHss="
- Response
{
"meta": {
"code": 200,
"message": "OK"
},
"data": [
{
"username": "test1",
"token": "gAAAAABV-UCAgRy-ee6t4YOLMW84tKr_eOiwgJO0QcAHL7yIxkf1fiMZfELkmJAPWnldptb3iQVzoZ2qJC6YlSioVDEUlLhG7w==",
"sid": "2593953362",
"modified": 1442398336,
"email": "test1@gmail.com",
"created": 1442398336
},
{
"username": "test2",
"token": "gAAAAABV-UCObi3qxcpb1XLV4GnCZKqt-5lDXX0YAOcME5bndZjjyzQWFRZKV1x54EzaY2-g5Bt47EE9-45UUooeiBM8QrpSjA==",
"sid": "6952584295",
"modified": 1442398350,
"email": "test2@gmail.com",
"created": 1442398350
},
{
"username": "test3",
"token": "gAAAAABV-UCccDCKuG28DbJrObEPUMV5eE-0sEg4jn57usBmIADJvkf3r5gP5F9rX5tSzcBhuBkDJwEJ1mIifEgnp5sxc3Z-pg==",
"sid": "8972728004",
"modified": 1442398364,
"email": "test3@gmail.com",
"created": 1442398364
}
]
}
/v1/users
/v1/users/self/login
/v1/users/{user_id}
/v1/users/info/self
/v1/users/info/self
/v1/users/info
/v1/users/info