Introduction
REST-ful Spring Statemachine is a RESTful web service for managing orders. It uses hypermedia to describe the relationships between resources and to allow navigation between them.
Running the service
RESTful Spring Statemachine is written using Spring Boot which makes it easy to get it up and running so that you can start exploring the REST API.
The first step is to clone the Git repository:
$ git clone https://github.com/otrosien/spring-statemachine-jpa-and-rest
Once the clone is complete, you’re ready to get the service up and running:
$ ./gradlew bootRun
You can check that the service is up and running by executing a simple request using cURL:
$ curl 'http://localhost:8080/' -i -X GET
This request should yield the following response:
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 206
{
"_links" : {
"orders" : {
"href" : "http://localhost:8080/orders{?page,size,sort}",
"templated" : true
},
"profile" : {
"href" : "http://localhost:8080/profile"
}
}
}
Note the _links
in the JSON response. They are key to navigating the API.