https://github.com/ankushkhanna/spring-example
https://github.com/ankushkhanna/spring-example
spring springboot
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ankushkhanna/spring-example
- Owner: AnkushKhanna
- Created: 2016-12-26T13:22:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T17:06:36.000Z (over 8 years ago)
- Last Synced: 2025-01-17T04:46:06.356Z (over 1 year ago)
- Topics: spring, springboot
- Language: Java
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring example for maintaining Transaction in memory
## Featues provided:
### Add transaction:
```
curl -H "Content-Type: application/json" -X PUT -d '{"amount":10,"type":"cc"}' {URL}/transaction/{transaction-id}
curl -H "Content-Type: application/json" -X PUT -d '{"amount":10,"type":"dc", "parentId":1}' {URL}/transaction/{transaction-id}
```
### GET transaction:
```
curl -H "Content-Type: application/json" -X GET {URL}/transaction/{transaction-id}
```
### GET all transaction of same type
```
curl -H "Content-Type: application/json" -X GET {URL}/transaction/types/{transaction-type}
```
### GET sum of all transactions linked from parent downward
```
curl -H "Content-Type: application/json" -X GET {URL}/transaction/sum/{transaction-id}
```
## Examples:
```
PUT transaction:
curl -H "Content-Type: application/json" -X PUT -d '{"amount":10,"type":"cc"}' {URL}/transaction/1
curl -H "Content-Type: application/json" -X PUT -d '{"amount":10,"type":"cc", "parentId":1}' {URL}/transaction/2
GET transaction:
curl -H "Content-Type: application/json" -X GET {URL}/transaction/1
curl -H "Content-Type: application/json" -X GET {URL}/transaction/2
GET all transactions for same type:
curl -H "Content-Type: application/json" -X GET {URL}/transaction/types/cc
GET sum of all transactions linked from parent downward:
curl -H "Content-Type: application/json" -X GET {URL}/transaction/sum/1
```