All files of or related to F.I.I.R.
##Installing
Make sure you have git installed:
sudo apt-get install git
Clone the project:
git clone [email protected]:lukesalamone/FIIR.git
Make sure you have Android Studio installed
##Android Projects
###FIIRapp
Working version of Android application
###POST Test
Demo of simple POST requests to server.
Database and API endpoints for FIIR app
to start the server in debug mode(messages will be printed out to std), go to ./python and run:
./server.py
to start the server in production mode(messages will be logged in ../../server.py.out), go to ./python and run:
nohup ./server.py >> ../../server.py.out &
to check if server is running, type:
ps -fC python3
and if it shows an entry ending with 'python3 ./server.py', it means server is running(it will also show the PID of server)
to stop the server, type:
kill XXX
where XXX is the PID of server
Promo code is known as token
in the following
Endpoint | Type | Parameters-example | Done? | Port |
---|---|---|---|---|
/users/create | POST | {"phone":"phonenumber", "invitedby":"userid", "email":"emailaddress"} | yes | 9096 |
/users/create | POST | {"phone":"phonenumber", "invitedby":"userid", "email":"emailaddress", "carrier":"carrier"} | yes | 9096 |
/users/verify | POST | {"user":1, "verification":"896154"} | yes | 9096 |
/users/setPromo | POST | {"key":"key", "user":"userid", "promoCode":"code"} | yes | 9096 |
/pics/create | POST | {"key":"key", "user":"userid", "price":"price", "token":"code/null"} | yes | 9096 |
/pics/created | GET | {key:"key", user:"userid"} | yes | 9096 |
/pics/flag | POST | {key:"key", user:"userid", picId:"picture ID"} | yes | 9096 |
/pics/hide | POST | {key:"key", user:"userid", picId:"picture ID"} | yes | 9096 |
/friends/list | GET | {key:"key", user:"userid"} | yes | 9096 |
/friends/add | POST | {key:"key", user:"userid", friend:"userid"} | yes | 9096 |
/friends/remove | POST | {key:"key", user:"userid", friend:"userid"} | yes | 9096 |
/settings/update_email | POST | {key:"key", user:"userid", email:"emailaddress"} | yes | 9096 |
/settings/update_phone | POST | {key:"key", user:"userid", phone:"phonenumber"} | yes | 9096 |
/newest/pics | GET | {} | yes | 9096 |
Request type: POST
Endpoint: http://fiirapp.ddns.net:9096/users/create
Header: {'Content-Type': 'application/json'}
query sample: {"phone":"(608)320-7727", "invitedby": 1, "email":"[email protected]"}
example response(200):
{"status":"ok", "msg":"user successfully created","user_id":"20"}
This endpoint may also errorback to request for phone carrier:
{"status":"err", msg:"carrier not found"}
Request type: POST
Endpoint: http://fiirapp.ddns.net:9096/users/create
Header: {'Content-Type': 'application/json'}
Query sample: {"phone":"(608)867-5309", "invitedby":-1, "email":"[email protected]", "carrier":"att"}
example response (200):
{"status":"ok", "msg":"user successfully created","user_id":"30"}
Carriers will be sent as the following abbreviations:
Company | Abbreviation |
---|---|
Alltel | alltel |
AT&T | att |
Boost Mobile | boost |
Sprint | sprint |
T-Mobile | tmobile |
US Cellular | uscellular |
Verizon | verizon |
Virgin Mobile | virgin |
Request type: POST
Endpoint: http://fiirapp.ddns.net:9096/users/verify
Header: {'Content-Type': 'application/json'}
query sample: {"user": 10, "verification":"859278"}
{"status":"user successfully verified","auth_token":"03X4I8HYJK6X71ASI2712U2ZM7SHMUB9"}
{status:"error", msg:"user not verifiable"}
{"status":"error","msg":"wrong activation code"}
{"key":"QWERTYUIOPLKJHGFDSAQWER123456789", "user":1, "promo":"deeznuts"}
{"status":"ok", "msg":"updated with token deeznuts"}
Server may also errorback:
{"status":"err", "msg":"token not found"}
request type: GET
end-point: http://fiirapp.ddns.net:9096/newest/pics
header: {'Content-Type': 'application/json'}
{"status":"success","num_pic":10,"pictures":[{"id":20,"price":-1,"date_added":"2016-10-12 20:09:52"}{"id":19,"price":-1,"date_added":"2016-10-12 19:31:27"}{"id":18,"price":-1,"date_added":"2016-10-08 11:51:17"}{"id":17,"price":-1,"date_added":"2016-09-25 23:11:45"}{"id":16,"price":-1,"date_added":"2016-09-25 23:11:28"}{"id":15,"price":-1,"date_added":"2016-09-25 23:10:24"}{"id":14,"price":-1,"date_added":"2016-09-25 23:06:16"}{"id":13,"price":-1,"date_added":"2016-09-25 22:59:11"}{"id":12,"price":-1,"date_added":"2016-09-25 22:55:46"}{"id":11,"price":-1,"date_added":"2016-09-25 22:31:00"}]}
request type: POST
end-point: http://fiirapp.ddns.net:9096/pics/hide
header: {'Content-Type': 'application/json'}
query sample: {"key":"DX0SRPYUYZQ4ZQXYSRNWOGZZCPCMIWQS", "user": 1, "picId":"18"}
{"status":"success","msg":"picture 18 successfully hidden"}
example response(400 user not exist):
{"status":"error","msg":"invalid user id"}
example response(400 invalid key):
{"status":"error","msg":"invalid key"}
example response(400 invalid picture id)
{"status":"error","msg":"this picture is not owned by 1"}
request type: POST
end-point: http://fiirapp.ddns.net:9096/pics/flag
header: {'Content-Type': 'application/json'}
query sample: {"key":"DX0SRPYUYZQ4ZQXYSRNWOGZZCPCMIWQS", "user": 1, "picId":"18"}
{"status":"success","msg":"picture 18 successfully flagged"}
{"status":"error","msg":"invalid user id"}
{"status":"error","msg":"invalid key"}
{"status":"error","msg":"this picture is not owned by 1"}
We will be using API of numverify.con to determine carriers for any given number. We will then use the email to SMS gateway to send messages to the correct carrier:
Alltel [email protected]
AT&T (formerly Cingular) [email protected]
Boost Mobile [email protected]
Nextel (now Sprint Nextel) [email protected]
Sprint PCS (now Sprint Nextel) [email protected]
T-Mobile [email protected]
US Cellular 1234567890email.uscc.net
Verizon [email protected]
Virgin Mobile USA [email protected]