t01 Rest Hello World
t01 Rest Hello World
Web Services
Installation Instructions
1. Get access to your concordia email/outlook if you haven’t already (see link)
2. Watch the IDE Overview
3. Download the ultimate version at https://www.jetbrains.com/idea/download/ and use
your concordia email to gain access
Winter 2021
Maven and JDK 8 or higher
Apache Maven is a software project management and comprehension tool that is based on the
concept of a project object model (POM).
We will be using Maven to generate a Jersey template (a JAX-RS implementation) for us to work
with.
Winter 2021
Postman and Curl
Postmanis a collaboration platform for API development, and Curl is a command line tool for
doing all sorts of URL manipulations and transfers.
Winter 2021
What about the Application Server?
We will be using the Grizzly HTTP server module in this tutorial, so we won’t actually need to
install an external Application Server.
You can still use Tomcat, Glassfish, Jetty or any other application server if you wish, as long as
you’re using JAX-RS to handle requests.
Winter 2021
What is a REST API?
Winter 2021
CRUD Operations
Create POST
Retrieve GET
Delete DELETE
Winter 2021
Generating a JAX-RS Project
Generation Command:
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 -
DarchetypeGroupId=org.glassfish.jersey.archetypes -
DinteractiveMode=false -DgroupId=com.example.rest -DartifactId=jersey-
service -Dpackage=com.example.rest -DarchetypeVersion=2.17
Winter 2021
Base Classes
Winter 2021
Rest API Class - Part 1
Winter 2021
Rest API Class - Part 2
Winter 2021
Using cURL to test our API
# Creates users
# Modifies a user
# Deletes a user
curl http://localhost:8080/restaurant/customer
Winter 2021
References
- IntelliJ Logo
- Patch Method Specs
- More Information on the Maven POM
- Restful API Info
- Restful API Image
- Generating Jersey Project using Maven
- Tomcat Logo
- Glassfish logo
Winter 2021