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

Update/create hierarchical resources REST

I am working on an REST API and I am trying to understand how to deal with hierarchical resources. Background Let's start with a simple example. In my API I have Users, User profiles and Reviews. Users must have a User Profile associated (a User…
Ameba Spugnosa
  • 1,204
  • 2
  • 11
  • 25
21
votes
2 answers

Set Authorization header using PHP and curl

We're using Commission Junction's REST service, which requires we sent an API key in the Authorization header. We set the header like this: $ch = curl_init(); curl_setopt_array($ch, array( // set url, timeouts, encoding headers etc. CURLOPT_URL…
searlea
  • 8,173
  • 4
  • 34
  • 37
21
votes
9 answers

Access Request Body in a WCF RESTful Service

How do I access the HTTP POST request body in a WCF REST service? Here is the service definition: [ServiceContract] public interface ITestService { [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "EntryPoint")] MyData…
urini
  • 32,483
  • 14
  • 40
  • 37
21
votes
2 answers

Rest api design: POST to create with duplicate data, would-be IntegrityError/500, what would be correct?

I have a normal, basic REST api like: / GET - list POST - create / GET - detail PUT - replace PATCH - patch DELETE - delete When a POST comes in to /, I usually create an object and make a new id. Some (one) of the…
Skylar Saveland
  • 11,116
  • 9
  • 75
  • 91
21
votes
1 answer

How to test Express/node REST API backend with Advanced REST Client or Postman?

I need to test my REST API backend that accepts JSON with the Advanced REST Client or Postman for Chrome. But I am running into issues: I can only send the request using the built-in form and using Content-Type:…
ragulka
  • 4,312
  • 7
  • 48
  • 73
21
votes
2 answers

Difference between an Output of a normal API and a REST API

What is the difference between a REST API and a normal API (which prints a JSON response)?
Shaolin
  • 2,541
  • 4
  • 30
  • 41
21
votes
10 answers

Is the WCF REST Starter Kit dead in the water?

We are looking at switching from using WCF for our service layer in applications to REST. So far we are assuming that the way to do this is to use the WCF REST Starter Kit. However this is still in Preview 2 and hasn't been updated since March…
Richard Ev
  • 52,939
  • 59
  • 191
  • 278
20
votes
2 answers

REST API Framework. Recommended behavior for invalid querystring parameter

I am implementing a REST API Framework, and I wonder what the recommendedbehavior is, when a client submits an invalid querystring parameter. I will illustrate what I mean with a specific example: Say, I have an API handler on the /api/contacts/…
20
votes
2 answers

Using Pentaho Kettle, how do I automatically retry rest requests which fail due to connection hiccups?

How can we make Pentaho retry rest requests on connection errors? We have a Pentaho BI system which, among numerous data sources, is querying a particular REST api for over 20k query variations each run. Predicatably, on most runs a few of these…
ms-tg
  • 2,688
  • 23
  • 18
20
votes
2 answers

RESTful API design - best practices for passing dates

What is the best practice for sharing dates in an API? Is it best to share dates with an SQL-like datetime format - 'YYY-MM-DD HH:MM:SS' with an optional timezone embedded inside of it? Or is it best to use milliseconds based on UTC?
Greg
  • 2,559
  • 4
  • 28
  • 46
20
votes
4 answers

Can Spring MVC have request parameters for an HTTP PUT method, or must I use post? Which should I use to be RESTful?

I have a controller action I think should be an HTTP PUT, but Spring is complaining when I try and use @RequestParam in the controller action. Is request parameters not allowed for HTTP PUT methods, and is that why Spring is rejecting…
egervari
  • 22,372
  • 32
  • 121
  • 175
20
votes
5 answers

How to create a Restful web service with input parameters?

I am creating restful web service and i wanted to know how do we create a service with input parameters and also how to invoke it from a web browser. For example @Path("/todo") public class TodoResource { // This method is called if XMLis…
SSG
  • 829
  • 5
  • 12
  • 23
20
votes
3 answers

Is Spray framework production ready?

Spray framework (spray.cc) seems to be a fun and productive way to build REST services using Scala & Akka. I come from Java + Spring school, where everything is well documented, mature and has good community support. While Spray is fun to play with…
Aravindan R
  • 3,084
  • 1
  • 28
  • 44
20
votes
2 answers

Securing a REST API with Facebook OAuth

I am building a app/API that allows user to login with Facebook, Twitter or Google. I am wondering what are the best practices in allowing those user to use the same account to login to the API. A couple Ideas that I have had is pass the auth…
Vitaly Babiy
  • 6,114
  • 4
  • 26
  • 24
20
votes
3 answers

Fetching REST resource as List with Jersey

I'm trying to write a generic function in Jersey which can be used to fetch a List of objects of the same type through REST. I based it on the informations found in this forum: link @Override public List fetchResourceAsList(String url) { …
NagyI
  • 5,907
  • 8
  • 55
  • 83
1 2 3
99
100