Questions tagged [rest]
Representational state transfer, or REST, is an architectural style for networking software to transfer information through the web.
113
questions
194
votes
6
answers
268k
views
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 ...
116
votes
9
answers
82k
views
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 ...
32
votes
7
answers
6k
views
What are the deciding factors in choosing to expose a web service as a SOAP or REST service?
As far as I can see consuming SOAP requires a SOAP stack, so it is harder for your clients to consume i.e. they need to ensure that they have a SOAP stack in place that formats the POST data and the ...
19
votes
2
answers
47k
views
What is the best way to create REST API error response model and error codes system?
My REST implementation will return errors in JSON with next structure:
{
"http_response":400,
"dev_message":"There is a problem",
"message_for_user":"Bad request",
"some_internal_error_code":...
160
votes
9
answers
96k
views
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}...
86
votes
7
answers
208k
views
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 ...
65
votes
5
answers
9k
views
What does HATEOAS offer for discoverability and decoupling besides ability to change your URL structure more or less freely?
Lately I've been reading about Hypermedia as the Engine of Application State (HATEOAS), the constraint that is claimed to make a web API "truly RESTful". It boils down to basically including links ...
85
votes
3
answers
33k
views
What is REST (in simple English) [closed]
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 (...
43
votes
5
answers
63k
views
Should HTTP status codes be used to represent business logic errors on a server?
I'm at a bit of a crossroads with some API design for a client (JS in a browser) to talk to a server. We use HTTP 409 Conflict to represent the failing of an action because of a safety lock in effect. ...
32
votes
3
answers
84k
views
Should I return a 204 or a 404 response when a resource is not found?
I am developing a simple RESTful service for tournaments and schedules. When a tournament is created through a POST request containing a JSON body, the tournament is inserted in a BiMap, declared as ...
15
votes
1
answer
8k
views
Software architecture for authentication/access-control of REST web service
I am setting up a new RESTful web service and I need to provide a role-based access control model. I need to create an architecture that will allow users to provide their username and password to get ...
11
votes
1
answer
9k
views
Use 404 or 200 when null result (REST) [duplicate]
Let's assume we have an Entity
{
"id": 1
"inProgress": true,
}
We have endpoints:
/api/v1/entities/ for fetching all entities,
/api/v1/entities/1 for fetching entity with id = 1
/api/v1/...
3
votes
1
answer
3k
views
js spa rest backend business logic vs presention logic
I am very confused about what should a SPA's REST backend do and expose. In most blog posts and books I read they depict the backend pretty much like a direct access to the DB, practically CRUD ...
2
votes
1
answer
6k
views
How to handle exception in REST API
Given a REST API, which throws an exception when handling a request from a client. Whenever the REST API throws an exception, it's logged and the application (in this case a console application) ...
98
votes
8
answers
79k
views
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 ...