Skip to content

BW-Receipt-Tracker/Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 

Repository files navigation

Backend

Endpoints

User Endpoints:

  • POST /login
    • Requires JSON User body username, password returns access_token
  • POST /createnewuser
    • Requires JSON User body primaryemail, username, password returns access_token
EndPoint Request Example Response Example
POST
/createnewuser
@Body JSON Object
{
"primaryemail" : "demo@demo.com",
"username" : "demo",
"password" : "demo"
}
Status: 201 Created
{
"access_token": "e73f96a6-d60d-4abb-9802-1a567c7f97da",
"token_type": "bearer",
"expires_in": 3599,
"scope": "read trust write"
}
POST
/login
@Headers (These login headers will always be static)
Key: Content-Type Value: application/x-www-form-urlencoded
Key: Authorization Value: Basic bGFtYmRhLWNsaWVudDpsYW1iZGEtc2VjcmV0

@Body (the content type here is x-www-form-urlencoded)
Key: grant_type Value: password (this key and value will be the same for everyone)
Key: username Value: demo (your username)
Key: password Value: demo (your password)
Status: 200 OK
{
"access_token": "e73f96a6-d60d-4abb-9802-1a567c7f97da",
"token_type": "bearer",
"expires_in": 2625,
"scope": "read trust write"
}

Receipt Endpoints:

  • GET /receipts/receipts
    • Gets all User Specific Receipts
  • GET /receipts/receipt/{receipt's id}
    • Gets receipt by id
  • PUT /receipts/receipt/{id}
    • (update receipt)
    • Requires changes in JSON receipt body
  • POST /receipts/receipt
    • (adds new receipt)
    • Requires JSON body receipt
  • DELETE /receipts/receipt/delete/{receipt's id}
EndPoint Request Example Response Example
GET
/receipts/receipts
@Params
Key: access_token Value: dfcd78e6-3215-4b27-8b56-43656e63beb4
Status: 200 OK
[
{
"receiptid": 215,
"date": "November",
"amount": 22.34,
"category": "Grocery",
"merchantname": "GreatValue",
"imageurl": "the URL"
},
{
"receiptid": 222,
"date": "January",
"amount": 22.34,
"category": "Grocery",
"merchantname": "GreatValue",
"imageurl": null
}
]
GET
/receipts/receipt/{receipt's id}
@Params
Key: access_token Value: dfcd78e6-3215-4b27-8b56-43656e63beb4
{
"receiptid": 215,
"date": "November",
"amount": 22.34,
"category": "Grocery",
"merchantname": "GreatValue",
"imageurl": "the URL"
}
PUT
/receipts/receipt/{receipt's id}
@Params
Key: access_token Value: dfcd78e6-3215-4b27-8b56-43656e63beb4

@Headers
Key: Content-Type Value: application/json

@Body (JSON Object)
{
"amount" : "30.66"
}
Currently Returns Status: 201 Created
Updates object and whichever fields
mentioned.
POST
/receipts/receipt
@Params
Key: access_token Value: dfcd78e6-3215-4b27-8b56-43656e63beb4

@Headers
Key: Content-Type Value: application/json

@Body (JSON Object)
{
"date": "November",
"amount": 18.34,
"category": "Software",
"merchantname": "Amazon",
"imageurl": "the URL"
}
Status: 201 Created
DELETE
/receipts/receipt/delete/{receipt's id}
@Params
Key: access_token Value: dfcd78e6-3215-4b27-8b56-43656e63beb4
Status: 200 OK

Additional documentation can be found at http://project-receipt-tracker.herokuapp.com/swagger-ui.html#/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages