All Questions
Tagged with rest api-design
405
questions
1
vote
0
answers
59
views
How to model api error type with errorCode and parameters
I work on a spring kotlin backend which has an angular and a mobile frontend. We are currently working on error handling and we decided that the backend should return an error code, a general message (...
-1
votes
2
answers
192
views
Idempotency for a financial transaction API
Say you have a REST API endpoint like POST /move-money which transfers money from your main account to a savings pot. There are three path parameters
accountId for the user's account
potId for the ...
-3
votes
1
answer
102
views
HATEOAS API - best practice to create multiple entities in one request
I have a HATEOAS API (in ASP.NET) with an endpoint:
POST /api/messages - to create a new message and it returns the location of a new message
Now I have a requirement that in some cases based on ...
11
votes
5
answers
3k
views
Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?
I have a "Games" API which retrieves video game data from a large database.
The /games endpoint returns some very basic information about the game, such as the title, description, etc.
More ...
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
5
answers
495
views
DTO vs POJO (Entity) on POST request
If I have for example a User POJO like the following
@AllArgsConstructor
public class User {
@Id
private final String id;
private String username;
private String password;
private Date createdDate;...
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 ...
1
vote
3
answers
189
views
What are the benefits of HATEOAS in programs without user interaction?
Let's assume I have a batch job that needs to print orders. It will do so by getting orders from the order service and send them to the print service.
It uses HATEOAS to discover the link from the ...
0
votes
1
answer
460
views
Is it okay to combine bff and rest api?
I'm building an application related to donation on streams.
And I have such models as "alert" and "alert-template".
"alert" is a set of different parameters to understand ...
-3
votes
1
answer
331
views
I do not like RESTful APIs anymore and dont understand why nobody agrees with me [closed]
Some years ago, every API I developed was a REST API and I did everything to follow the best practices to make them "RESTful".
But after some time, I have my doubts if RESTful APIs that ...
0
votes
1
answer
136
views
REST - Adding a new field
I have an object with fields like ID, CODE, NAME, etc., and it has its own database table with each field. And I am working on implementing the REST API for this object. I want to expose all these ...
1
vote
4
answers
1k
views
How to build REST uri that fetches children by parent ID
I am building 2 REST microservices: ParentService and ChildService. I need to build endpoint to fetch all Child resources related to specific Parent, so I have these URI's as options:
GET /parent/{...
-2
votes
2
answers
1k
views
API design. Make multiple PUT request or one single PUT request for updating multiple fields of the same database
I have three seperate fields and all three are unrelated to each other but part of the same collection (Tables for SQL folks).
Now, what I'm getting stuck at is, should I allow end-users to make one ...
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 ...
2
votes
3
answers
1k
views
Is it bad practice to create a resource in a GET request when the resource will be created later automatically?
At the moment I design a RESTful API for a resource that is normally created by a cron job from existing data.
Since the cron job runs only every 10 minutes it is possible that GET: /user/{id}/...