Skip to content

A REST API example implemented with Jersey and Spring Framework

Notifications You must be signed in to change notification settings

cagataygurturk/java-rest-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

REST Example

This repository includes a basic REST API built with Jersey and Spring framework and for demonstration purposes.

Run and Test

To run the application type

mvn spring-boot:run

To execute unit and acceptance tests

mvn test

For unit tests and acceptance tests JUnit and REST Assured frameworks are used.

Endpoints

Important: Content-Type: application/json header must be present to use API.

The most common HTTP status codes are returned when there is an error.

Add a transaction

/transactionservice/transactions/{id} [POST]

Content-Type: application/json

{
    "amount": double,
    "type": string
    "parent_id": long|null
}

When succeeed 201 Status code and newly created transaction object are returned.

Get a transaction

/transactionservice/transactions/{id} [GET]

Gets a transaction with given id.

Get sum amount a transaction

/transactionservice/transactions/{id}/sum [GET]

Gets the total amount of transactions whose parent is the transaction with id {id}

Get transactions with a given type

/transactionservice/types/{type} [GET]

Gets ID's of the transactions with given type.

About

A REST API example implemented with Jersey and Spring Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published