Posts

Showing posts with the label REST

REST Endpoint: Consume / Produce JSON/XML

Image
Import Jackson Data format: Annotate the REST method to consume and produce the desired format(s): In HTTP Request header, set attribute: Content-Type  to application/json|xml to indicate the body format Accept  to application/json|xml to indicate the desired response format

Post data using curl command

Simple example of posting data using curl command: curl -i \ -H "Accept: application/json" \ -H "Content-Type:application/json" \ -X POST --data    '{"param1": "val1", "param2": "val2"}' "https://localhost:8080/endpoint"

Is it RESTful, or simply RPC?

"Pretty URLs like /employees/3 aren’t REST. Merely using GET, POST, etc. aren’t REST. Having all the CRUD operations laid out aren’t REST. In fact, what we have built so far is better described as RPC (Remote Procedure Call)... What needs to be done to make the REST architectural style clear on the notion that hypertext is a constraint? In other words, if the engine of application state (and hence the API) is not being driven by hypertext, then it cannot be RESTful and cannot be a REST API. Period. Is there some broken manual somewhere that needs to be fixed? of NOT including hypermedia in our representations is that clients MUST hard code URIs to navigate the API. This leads to the same brittle nature that predated the rise of e-commerce on the web. It’s a signal that our JSON output needs a little help. Introducing Spring HATEOAS (Hypermedia as the Engine of Application State), a Spring project aimed at helping you write hypermedia-driven outputs." Read here: https...

REST - Richardson Maturity Model

"A model (developed by Leonard Richardson) that breaks down the principal elements of a REST approach into three steps. These introduce resources, http verbs, and hypermedia controls..." https://martinfowler.com/articles/richardsonMaturityModel.html

Steps towards REST

Steps toward the glory of REST https://martinfowler.com/articles/richardsonMaturityModel.html

REST API Best Practices

"If they are used as POST mediumgameapi.com/getaccounts , it gives the feeling that our objective is contradicting the URL structure. Hence, it is assumed to be better to have it in nonverbal format. For example, if it is mediumgameapi.com/accounts, it can be preceded with any HTTP methods like ... " https://dzone.com/articles/designing-rest-api-best-practices-you-should-be-fo

REST with Spark

"Spark focuses on being as simple and straight-forward as possible, without the need for cumbersome (XML) configuration, to enable very fast web application development in pure Java with minimal effort..." http://sparkjava.com/documentation.html

An academical presentation of REST

Roy Fielding's dissertation "Architectural Styles and the Design of Network-based Software Architectures" CHAPTER 5 - Representational State Transfer (REST) http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm