Questions tagged [rest]

REST (Representational State Transfer) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. It has increased in popularity relative to RPC architectures such as SOAP due to the intrinsic de-coupling of client from server that comes from having a uniform interface between heterogeneous systems.

(Not to be confused with or reST)

REST (REpresentational State Transfer) is an architectural style that uses identification of resources; manipulation of resources through representations; self-descriptive messages, and hypermedia as the engine of application state, to build distributed systems that are scalable and resilient to change.

The term was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation. Fielding is one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification versions 1.0 and 1.1.

In simple language, REST is an alternative to SOAP based web services. Where SOAP tries to model the exchange between client and server as calls to objects, REST tries to be faithful to the web domain.

Resources


Examples

A website's RESTful API is queried to find out information on a user, specified by a numerical ID.

Request Type: GET
http://www.api.website.com/users/12345

Returns, in a format for this example:

{"username" : "theuser",
 "userid"   :  12345,
 "first"    : "George",
 "last"     : "Washington"}

Question Index

Searching

REST search interface and the idempotency of GET
RESTful URL design for search
Best practice for implementing long-running searches with REST
Querystring in REST Resource url
What is the best way to create RESTful complex queries?
Question on REST conventions: retrieving information where lots of params are needed

Resource Design

How to design a RESTful collection resource?
RESTful design of a resource with binary states
RESTFful/Resource Oriented Design
RESTful resource - accepts a list of objects
RESTful API creates a globally unique resource
REST's 'resource communication mechanisms' and 'on-the-fly' improvement of a client's knowledge of them
How to move a REST resource?

Media Types

REST Media type explosion
Creating hypermedia links in a custom media-type
Custom content types: XLink vs. Atom

Books

Related tags

92665 questions
21
votes
4 answers

How to stop a build in Jenkins via the REST api ?

I have a job in Jenkins. A website of our own triggers builds of this job via the REST api. Sometimes we want to abort the build. Sometimes, it can be before the build is even started. In such cases we have the queueItem # instead of the build #.…
Barth
  • 15,135
  • 20
  • 70
  • 105
21
votes
6 answers

REST best-practice for overlong URIs

I have REST services which should receive really long queries via GET. Say for example I want to query a service with many geographical coordinates to find out something about all this coordinates. 1) My first thought was to use long URIs and…
deamon
  • 89,107
  • 111
  • 320
  • 448
21
votes
5 answers

Get PATCH request data in PHP

I need to make a PATCH request to a PHP application. How can I get the data from that PATCH request inside that application? If I had to do it with a POST, it would just be a simple access to the global $_POST variable.
Daniel Ribeiro
  • 10,156
  • 12
  • 47
  • 79
21
votes
1 answer

Send a curl request with no Accept header?

I have written an REST API and I'm try to test a request that has no Accept header. If I send a request via Curl it adds a default header Accept: */*, you can see this if you add Curl's -v parameter. Is there are way to send a request via Curl with…
user86834
  • 5,357
  • 10
  • 34
  • 47
21
votes
7 answers

Problems running JerseyTest when dealing with HttpServletResponse

Here is a sample Resource class: @Path("/resource") public class SomeResource { @GET @Produces({MediaType.APPLICATION_XML}) public String someMethod(@QueryParam("param1") String param1, ..., @Context HttpServletRequest request) { …
user2638465
  • 213
  • 1
  • 2
  • 4
21
votes
2 answers

POST array of objects to REST API

I'm designing REST API that should be able to accept array of objects, say [ { 'name': 'Alice', 'age': 15 }, { 'name': 'Bob', 'age': 20 }, ... ] Indeed, the API could have a method for accepting single object, which would be called…
Tregoreg
  • 18,872
  • 15
  • 48
  • 69
21
votes
2 answers

Is using HTML5 Server-sent-events (SSE) ReSTful?

I am not able to understand if HTML5s Server-sent-events really fit in a ReST architecture. I understand that NOT all aspects of HTML5/HTTP need to fit in a ReST architecture. But I would like to know from experts, which half of HTTP is SSE in (the…
2020
  • 2,821
  • 2
  • 23
  • 40
21
votes
4 answers

A message body writer for Java class java.util.ArrayList...and MIME media type text/xml was not found

Im using Jersey to build a REST Service and want to return a Collection as XML. @GET @Produces(MediaType.TEXT_XML) @Path("/directgroups") public Response getDirectGroupsForUser(@PathParam("userId") String userId) { try { …
lrxw
  • 3,576
  • 7
  • 32
  • 46
21
votes
1 answer

REST Web Service authentication token implementation

I'm implementing a REST web service using C# which will be hosted on Azure as a cloud service. Since it is a REST service, it is stateless and therefore no cookies or session states. The web service can only be accessed over HTTPS (Certificate…
There is no spoon
  • 1,775
  • 2
  • 22
  • 53
21
votes
3 answers

How to http post with an empty body request using WS API in Playframework 2 / Scala?

I try to send an HTTP POST request to a service endpoint using Play2/Scala WS API. Since there is no parameters to be sent in the HTTP POST body, how can I send it using WS.url("http://service/endpoint").post() I have tried post() without argument…
kaffein
  • 1,766
  • 2
  • 28
  • 54
21
votes
7 answers

Express cannot PUT/DELETE method. What is going wrong?

Ok So I have a simple node.js / express.js / mongodb app set up here with my config as follows. var express = require('express'), mongoose = require('mongoose'); http = require('http'); var app = express(); app.configure(function(){ …
Daniel Tate
  • 2,075
  • 4
  • 24
  • 50
21
votes
1 answer

Login/logout in REST with Spring 3

We are developing RESTful webservices with Spring 3 and we need to have the functionality of login/logout, something like /webservices/login/// and /webservices/logout. The session should be stored in the context until the…
FKhan
  • 213
  • 1
  • 3
  • 6
21
votes
2 answers

What is the importance of the self link in hypermedia APIs?

All the articles and books I read on REST repeat the importance of adding "self" rel links to your hypermedia responses but they're all light on the reasons and use cases. Why should you add a self link and how is it useful?
Ricardo Gladwell
  • 3,770
  • 4
  • 38
  • 59
21
votes
2 answers

Tomcat failing to deploy .war

I'm trying to follow this tutorial on creating a simple REST web service, however I get to deploying it on tomcat and it throws an exception: FAIL - Application at context path /restful could not be started FAIL - Encountered exception…
Pete
  • 1,095
  • 3
  • 9
  • 17
21
votes
5 answers

How correctly produce JSON by RESTful web service?

I am writing a web service the first time. I created a RESTful web service based on Jersey. And I want to produce JSON. What do I need to do to generate the correct JSON type of my web service? Here's one of my…
Philiph Bruno
  • 413
  • 2
  • 4
  • 8
1 2 3
99
100