| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An example project based around a 'offer' demonstrating Spring Boot and exposing a REST API.
Technologies used:
Clone this repository and then run:
mvn clean install
Please note: this project has been tested on Windows 10 and Linux (Ubuntu) using JDK 8.
This project has a number of modules, which albeit don't contain much code, but are there to show how a complex system could be split up:
The project could have been split into other module structures, namely something like the below:
After building the project:
cd offer-example-web
then:
mvn spring-boot:run
This will start the Spring Boot fat JAR webapp.
Please note: the documentation is basic and manually generated - see "Things To Do", such as improving the documentation.
This API aimed at being 'Level 2' on the REST maturity model: https://martinfowler.com/articles/richardsonMaturityModel.html
Resource: /v1/offers/{merchantIdentifier}
Method: POST <-- Note: this is POST instead of PUT because the Create Offer operation is not idempotent - the Offer Identifier is generated by the server-side.
Request body: Offer JSON (see below)
Response code: 201 for Offer created, 400 for bad request - invalid offer.
Response body: Offer Identifier of newly created OfferOffer JSON - offerIdentifier not required because it is assigned by the service.
{
"merchantIdentifier": "merchant-123",
"description": "DESCRIPTION-123",
"offeringIdentifier": "offering-123",
"price": 1.23,
"currencyCode": "GBP",
"activeStartDate": "2018-01-01 00:00:00.000",
"activeEndDate": "2019-02-03 23:59:59.000",
"statusCode": "A"
}Resource: /v1/offers/{merchantIdentifier}/{offerIdentifier}
Method: DELETE
Response code: Return 200 for OK, 404 for Offer not foundResource: /v1/offers/{merchantIdentifier}
Method: GET
Response code: Return 200 for OK
Response body: active Offers JSONResource: /v1/offers/{merchantIdentifier}/{offerIdentifier}
Method: GET
Response code: Return 200 for OK, 404 for Offer not found
Response body: active OfferTimezones have been ignored.
Bump
| Back | FazBrowse Home | New Git URL |