Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better documentation #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ To run tests in Bestoon simply use `python manage.py test`.

If you want more verbosity you can use `-v` option with `0, 1, 2, or 3.`; e.g. `python manage.py test -v2`

## API
Click [HERE](./apis.md) to Learn More.

## More Clients

The project contains two different clients (command line and an ionic app for android/iOS) but all the 3rd party clients are more than welcomed. Add yours below.
Expand All @@ -62,7 +65,6 @@ The project contains two different clients (command line and an ionic app for an
- [Bestoon php client](https://github.com/iamalirezaj/bestoon-php-client)



## TODO
- [x] a restful login service. user will give user pass and will get her token
- [x] local storage for ionic app. will store token and will using it when calling anything
Expand Down
117 changes: 78 additions & 39 deletions apis.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,78 @@
/submit/expense/
POST, returns a json
input: date (optional), text, amount, token
output: status:ok

/submit/income/
POST, returns a json
input: date (optional), text, amount, token
output: result:ok

/accounts/login/
POST, returns a json
input: username, password
output: status:ok & token

/accounts/register/
step1:
POST
input: username, email, password
output: status:ok
step2: #click on link with the code in the email
GET
input: email, code
output: status: ok (shows the token)

/q/generalstat/
POST, returns a json
input: fromdate (optional), todate(optional), token
output: json from some general stats related to this user

/q/incomes/
POST, returns json
input: token, num (optional, default is 10)
output: last num incomes

/q/expenses/
POST, returns json
input: token, num (optional, default is 10)
output: last num expenses
# API User Manual

## Submits
### /submit/expense/
#### Submit A Expense
- POST, returns a json
- input: date (optional), text, amount, token
- output: status:ok

### /submit/income/
#### Submit A Income
- POST, returns a json
- input: date (optional), text, amount, token
- output: result:ok

## Account Managment
### /accounts/login/
#### Login A User
- POST, returns a json
- input: username, password
- output: status:ok & token

### /accounts/register/
#### Singup A User
#### Step 1:
- POST
- input: username, email, password
- output: status:ok
#### Step 2 (this part is not required, Email verifacation is not working.):
##### Note: Click on link with the code in the email
- GET
- input: email, code
- output: status: ok (shows the token)

## Get Status and Previous Data(s)
### /q/generalstat/
#### Get General Status Of User
- POST, returns a json
- input: fromdate (optional), todate(optional), token
- output: json from some general stats related to this user

### /q/incomes/
#### Get Previous Incomes
- POST, returns json
- input: token, num (optional, default is 10)
- output: last num incomes

### /q/expenses/
#### Get Previous Expenses
- POST, returns json
- input: token, num (optional, default is 10)
- output: last num expenses

## Edit and Remove Data
### /edit/expense/
#### Edit Expense
- POST, returns json
- input: pk(id), text, amount, token
- output: status: ok

### /edit/income/
#### Edit Income
- POST, returns json
- input: pk(id), text, amount, token
- output: status: ok

### /edit/rmincome/
#### Remove Income
- POST, returns json
- input: pk(id), token
- output: status: ok

### /edit/rmexpence/
#### Remove Expence
- POST, returns json
- input: pk(id), token
- output: status: ok