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:

1541 questions
200
votes
7 answers

How do searches fit into a RESTful interface?

When designing a RESTful interface, the semantics of the request types are deemed vital to the design. GET - List collection or retrieve element PUT - Replace collection or element POST - Create collection or element DELETE - Well, erm, delete…
Rob Baillie
  • 2,416
  • 2
  • 13
  • 12
190
votes
6 answers

Difference between REST and CRUD

I learned REST and it feels a lot like CRUD (from what I have read about CRUD). I know they are different, and I wonder if thinking they are similar means I don't understand them. Is it that REST is a "superset" of CRUD? Does it do everything CRUD…
Jesse Black
  • 2,415
  • 3
  • 16
  • 15
147
votes
9 answers

Which HTTP verb should I use to trigger an action in a REST web service?

I am implementing a RESTful web service and one of the available actions will be reload. It will be used to reload configurations, cache, etc. We started with a simple GET to an URI like this: ${path}/cache/reload (no parameters are passed, only the…
Renato Dinhani
  • 2,885
  • 2
  • 17
  • 18
127
votes
4 answers

REST API security Stored token vs JWT vs OAuth

I am still trying to find the best security solution for protecting REST API, because the amount of mobile applications and API is increasing every day. I have tried different ways of authentication, but still has some misunderstandings, so I need…
CROSP
  • 1,548
  • 3
  • 11
  • 17
116
votes
8 answers

RESTful API. Should I be returning the object that was created / updated?

I'm designing a RESTful web service using WebApi and was wondering what HTTP responses and response bodies to return when updating / creating objects. For example I can use the POST method to send some JSON to the web service and then create an…
iswinky
  • 1,263
  • 2
  • 9
  • 8
115
votes
9 answers

How to safeguard a REST API for only trusted mobile applications

How do I make sure my REST API only responds to requests generated by trusted clients, in my case my own mobile applications? I want to prevent unwanted requests coming from other sources. I don't want users to fill in a serial key or whatever, it…
supercell
  • 1,497
  • 3
  • 12
  • 11
109
votes
3 answers

Should cookies be used in a RESTful API?

I'm specifically interested in how users perform authorized / authenticated operations on a web API. Are authentication cookies compatible with the REST philosophy, and why?
Brandon Linton
  • 1,665
  • 3
  • 14
  • 9
97
votes
8 answers

RESTFul: state changing actions

I am planning to build a RESTfull API but there are some architectural questions that are creating some problems in my head. Adding backend business logic to clients is an option that I would like to avoid since updating multiple client platforms is…
Miro Svrtan
  • 1,129
  • 1
  • 8
  • 6
85
votes
7 answers

Designing a REST api by URI vs query string

Let's say I have three resources that are related like so: Grandparent (collection) -> Parent (collection) -> and Child (collection) The above depicts the relationship among these resources like so: Each grandparent can map to one or several…
HiChews123
  • 1,103
  • 2
  • 9
  • 10
85
votes
3 answers

What is REST (in simple English)

Lately I have become interested in familiarizing myself with REST. I tried reading wiki entry on REST, but it was of no help. I would really appreciate it if someone can explain in simple English (that is without unnecessary tech jargon) What is…
Gaurav
  • 3,729
  • 2
  • 25
  • 43
84
votes
6 answers

HTTP Status Code for "Still Processing"

I'm building a RESTful API that supports queuing long-running tasks for eventual handling. The typical workflow for this API would be: User fills in form Client posts data to API API returns 202 Accepted Client redirects user to a unique URL for…
Matthew Haugen
  • 1,045
  • 1
  • 8
  • 11
78
votes
3 answers

Trailing slash in RESTful API

I have been having a debate about what to do with a trailing slash in a RESTful API. Lets say I have a resource called dogs and subordinate resources for individual dogs. We can therefore do the following: GET/PUT/POST/DELETE…
GWed
  • 3,085
  • 5
  • 26
  • 43
74
votes
6 answers

Many small requests vs. few large requests (API Design)

I'm currently working on a project with an organization as follows: Client - Gets data from the main server via REST api. Server - Requests data from various other servers via third-party APIs Third-party APIs - Services out of my control that…
williamg
  • 841
  • 1
  • 6
  • 4
70
votes
6 answers

Should "No Results" be an error in a RESTful response?

I'll describe an example: I start making an API for a baking shop. The API will allow people to search their catalogus for baking products, such as home-made minty chocolate chip cookies using api.examplebakery.com/search?q=...... Someone uses this…
Berry M.
  • 829
  • 1
  • 6
  • 6
70
votes
4 answers

Why PATCH method is not idempotent?

I was wondering about this. Suppose I have a user resource with id and name fields. If I want to update a field I could just do a PATCH request to the resource like this PATCH /users/42 {"name": "john doe"} And then the application will update…
seldon
  • 952
  • 1
  • 7
  • 13
1
2 3
99 100