SparkJava: RESTful APIs
Creating RESTful APIs with SparkJava
When we think of web apps, we normally think of a human end user interacting with the web app through a browser.
- The user a human on a smart phone or tablet, reading pages, and then clicking, selecting, and/or typing in data
But many web applications either instead of this, or in addition to this, provide RESTful APIS.
RESTful APIs are typically NOT designed for human end users; instead, you can think of them as web apps for other pieces of software.
- The replies are also typically formatted in JSON
(Note that in the past, it was more common for RESTful APIs to use XML instead of JSON, and many still do. However, we’ll focus on JSON in this course.
RESTful APIS provide:
- a way for programs written in any language with libraries for http and json (which is pretty much every language these days) to access data from online sources (e.g. Google Maps, Google Places)
Here are some examples of building RESTful APIs using SparkJava
- A very simple example of JUST a RESTful API
- This one has a frontend along with a RESTful API
More on SparkJava: RESTful APIs
- SparkJava: Authentication—login/logout, and securing various pages in your app
- SparkJava: Bootstrap—Adding a nicer looking UI, with common navigation, drop down menus, etc.
- SparkJava: Facebook API—Authenticate with Facebook, then access the Facebook API
- SparkJava: Getting Started—A more clear tutorial
- SparkJava: Github API—Authenticate with Github, then access the Github API
- SparkJava: Image Files—and any other static files your application needs
- SparkJava: MongoDB—Using the NoSQL database MongoDB with SparkJava
- SparkJava: pac4j—Securing a SparkJava webapp, with options for OAuth or LDAP
- SparkJava: RESTful APIs—Creating RESTful APIs with SparkJava
- SparkJava: SLF4J—What is the Simple Logging Framework For Java, and how to configure it
- SparkJava: Templates—The various template engines you can use with SparkJava