All Questions
137
questions
0
votes
1
answer
157
views
How to handle different json response for the same api rest endpoint and different http status
I have an endpoint similar to GET ../produtcs/123 where 123 stands for an ID. The REST service response
with either status 200 and a json object A {"deliveryData": {"status": 200, ...
0
votes
1
answer
227
views
POST and PATCH for a nested resource in REST API
One post can have many comments.
How can I design REST API urls for HTTP POST and HTTP PATCH for comments.
My idea is to have the following endpoints:
HTTP GET: /posts/{postId}/comments
HTTP GET (all ...
1
vote
3
answers
244
views
Should this request return a status of 404 or a different status
We have an API that allows clients to POST some request which takes some time to complete, so the API simply places it on a message queue and returns a 202 (Accepted) and a new GUID in the body.
The ...
0
votes
1
answer
153
views
When to use PUT vs POST while calling APIs?
GIST:
PUT is idempotent PUT is used for updating/creating a resource.
POST isn't idempotent. POST is used for creating a resource.
So, I'm wondering what should I use in this case and why?
I want to ...
0
votes
3
answers
509
views
Is it appropriate to use PUT for resources when the id is deterministically derived from immutable properties?
I'm working with a RESTful API where a POST operation is used to create a user. A required field, which could be an email or a unique user nickname, is unique across the system. The response to this ...
1
vote
1
answer
302
views
Best practise for designing REST API endpoint that accepts a nested resource POST
What's the recommended design for an endpoint that accepts a nested resource as the following:
POST /account
{
"name": "Project John Doe",
"description": "...
0
votes
0
answers
281
views
Returning header Location on POST with no content
I am designing an API that some operations may take a while, for example, creating a backup (not the actual case).
I am planning to have an endpoint to query the current job
http GET /api/v1/jobs/{...
1
vote
4
answers
2k
views
Design REST Polymorphic API
I have a client/server application that exposes data and commands through REST APIs. This API exposes a GET /recipes/:id endpoint that instructs the client on how to show a recipe. A recipe can be ...
2
votes
1
answer
2k
views
Does it make sense to add an additional REST API to access a database?
I've recently joined a startup that has, in my opinion, a strange (and inefficient) way to access their database.
Their implementation consists of multiple REST APIs that are exposed to multiple ...
-1
votes
1
answer
584
views
Should I use http status code 402 in my api specification for api methods that allow payment?
According to the MDN the http protocol has the 402 status code:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses
And is used for methods that require payment.
Also RFC ...
-1
votes
1
answer
161
views
Should micro services follow HTTP verbs precisely?
I'm concerned with the practices on my team regarding following REST and HTTP verbs precisely. For example, when we hit a get endpoint for a resource/resources that doesn't exist, we return a 404. ...
1
vote
2
answers
212
views
REST HTTP Response code for a resource that the user is not authorised to access
Suppose user A creates a private resource at, for example, /books/somebooktitle
If user B attempts to access the resource at /books/somebooktitle what code should be returned?
HTTP403: Permission ...
1
vote
3
answers
584
views
Is the "archetype controller" really complies with REST architectural style
I've read the Fielding's thesis that defines the REST architectural style and noticed that the defined style appears to significantly conflicts with the so called "archetype controller", ...
1
vote
1
answer
499
views
What is the correct architecture for communication between an HTTP server and a WS server on the same machine running in separate processes?
I have a Node.js HTTP REST API server and a Node.js WS server. I separated them into 2 entrypoints so that they can be more easily debugged and run separated from each other, but now I need the REST ...
0
votes
1
answer
303
views
How to design a rest api for updating collection(ArrayList) of Resource in Spring boot?
I have a resource called Client and it has the following attributes id, name, redirect URLs(ArrayList).
class Client{
int id;
String name;
List<String> redirectUrls;
}
I have all CRUD ...