Questions tagged [rest]

Representational state transfer, or REST, is an architectural style for networking software to transfer information through the web.

Re‌presentational s‌tate t‌ransfer, or REST, is an architectural style for networking software to transfer information through the web. REST is a simpler alternative to SOAP. The main principals of a RESTful architecture are:

  • Use HTTP methods explicitly.
  • Be stateless.
  • Expose URI's that simulate a directory structure.
  • Transfer XML, JavaScript Object Notation (JSON), or both.

External References:

1560 questions
21
votes
5 answers

RESTful API represent the absence of a thing

Imagine an API to identify whether a person has selected their spirit animal. They can only have zero or one spirit animals. Currently: /person/{id}/selectedSpiritAnimal when they have selected an animal returns http 200 and…
21
votes
3 answers

Represent actions(verbs) in REST URI

I have a print operation to perform for my customer documents. I need the other standard operations to be performed as well, like add,update, delete. so, I have following: For creating new customer:URI = /customer/{id}, type = POST, Methodname =…
Nitya Maha
  • 311
  • 1
  • 2
  • 3
17
votes
1 answer

Proper response for a REST insert - full new record, or just the record id value?

I'm building a REST API which allows inserts (POST, not idempotent) and updates (PUT, idempotent) requests to add/update database to our application. I'm wondering if there are any standards or best practices regarding what data we send back to the…
15
votes
4 answers

How is oData different from a REST service?

I am looking into writing a web service API and I am thinking of creating a REST service. What does OData means in this context? Can you please explain the difference between OData and REST?
gyurisc
  • 253
14
votes
6 answers

Do server-side sessions violate REST?

According to Roy Fielding (one of the principle authors of the HTTP specification) in his seminal thesis Architectural Styles when discussing REST, he mentions: [E]ach request from client to server must contain all of the information necessary to…
Matt
  • 243
  • 2
  • 8
12
votes
5 answers

Why do we need REST service security if we have HTTPS

I refer to this excellent article http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/ which speaks of amazon like security for web service. However I was asked a question in the team of why do we need it if we…
12
votes
2 answers

Is it reasonable for REST resources to be singular and plural?

I have been wondering if, rather than a more traditional layout like this: api/Products GET // gets product(s) by id PUT // updates product(s) by id DELETE // deletes (product(s) by id POST // creates product(s) Would it be more useful to have a…
Eva
  • 547
10
votes
2 answers

Rest design - Multiple calls vs returning all data in one call

I am trying to build a rest API for an android app. Suppose I have a users table with (id, name, email) and a songs table with (id, song_name, album) and a rich join association between them as streams having (user_id, song_id, listen_count). I want…
aandis
  • 203
9
votes
2 answers

REST autocomplete endpoint design

We're designing a rest endpoint for retreiving name autocompletion suggestions for hotel names. Currently it's defined like this: GET /suggest/:term, so that if you queried `/suggest/hil' you would get responses like "Hilton Paris", "Hilton New…
Zoltán
  • 191
8
votes
3 answers

What are the benefits of a RESTful web service?

Academic task… First we were told to generate a set of static .html files showing election results in various administrative divisions. Then we were told to "modernize" this by using Django templates. Fair enough, I can see the benefits of such…
gaazkam
  • 4,417
8
votes
1 answer

How to avoid multiple calls to a REST API?

Suppose I have a REST API and I can fetch the list of my friends and the favorite songs of each friend in my list. Now I want to fetch all favorite songs of all my friends. The problem with REST API is that I can't do that just using only one…
Hunsu
  • 197
7
votes
3 answers

RESTful way of requesting server generated resource

I want a server to be a producer of tasks for the client to process and be sent back. What is the proper HTTP method in RESTful approach to create and return a new resource? This seems silly, but the natural way seems to be GET /task/, or more…
luk32
  • 400
  • 2
  • 8
6
votes
3 answers

Does it make sense for User-Agent to be required for REST APIs?

One company (who I will refer to as Company NNN from here forth), has a REST API. At my company, we use Company NNN's REST API to provide some content to our end users. If I send the request with the User-Agent header field filled in, the REST API…
an12
  • 171
6
votes
5 answers

How to adhere to pure REST principles when different functionality is required in different situations

We have a RESTful API that allows for creation of users by POSTing to a particular endpoint, api/v1/users In the system, when a user is created, an email is sent to the user with content along the lines of "{Authenticated user} just added you to the…
6
votes
2 answers

Creating entities with validated Addresses via REST API

I am building a REST service. This services enables the user to create an entity that has an Address. For simplification, let say this other entity is 'House', so 'A House has an Address'. The system has to geocode every House so along with the…
mario595
  • 309
1
2 3 4 5 6