Questions tagged [rest]
Representational state transfer, or REST, is an architectural style for networking software to transfer information through the web.
1,567
questions
0
votes
1
answer
74
views
Using both websocket and REST for the application requiring two-way communication
I am currently implementing front-end part of the collaborative application requiring two-way live communication between server and the web app. Cloud service responsible for the data exchange will be ...
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 (...
3
votes
3
answers
381
views
Encapsulating a central soap service in a microservice?
I am currently developing an application (rest-backend and SPA) that requires information from people (personal data, department, superior... ). Our company has a central directory for this purpose. ...
0
votes
0
answers
52
views
Multi-tenant (realm based) REST Web API authentication
We're building a multi-tenant setup with a C# Web API and KeyCloak for auth and APISIX as application gateway. APISIX handles the authentication and passes an X-Access-Token to our API when ...
0
votes
1
answer
126
views
How to model two bounded contexts with tight coupling between them
Context
Hello, at my company we have been working with DDD for some time now. We have a monolith and some services. The bounded contexts in the monolith use HTTP calls to communicate between them or ...
-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 ...
1
vote
3
answers
313
views
How can I avoid duplicate annotations when validating both Entity and DTOs?
I am using the Spring Boot framework to create a RESTFUL API and I need a way to avoid the duplication of validation rules when using multiple DTOs as request/response objects for my endpoints.
Using ...
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, ...
-1
votes
2
answers
122
views
Efficient access control list for collections of objects returned by REST api
We have a REST api endpoints that return collections of objects where users could perform different types of actions on those objects. We need it to turn on/off different UI options based on that ...
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 ...
0
votes
1
answer
74
views
Alternative ways to transfer records from one environment to another
I'm working on an application which has a feature of syncing records between two environments. For example, a record A is created in environment A. After a user verifies it, the user can use the sync ...
1
vote
2
answers
108
views
Request validation on API proxy
I am creating an API proxy that acts as a bridge between our frontend application and an AWS opensearch server. This proxy has additional features such as retries and timeouts.
One of the features I'm ...
1
vote
2
answers
163
views
Creating associated resources before creating the main one in a REST setting
I'm not sure how common of a scenario this is, but what are some approaches to creating associated entities before you have the actual main entity they're supposed to be linked to? (basically having ...
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
1
answer
175
views
Many to many REST design for users and teams
I am designing REST API for users and teams of users. One user can belong to multiple teams . One of the requirements is to be able to sort the users belonging to team in alphabetical order. Teams can ...
1
vote
0
answers
63
views
Endpoint design for single and bulk requests
I'm working on a project in Python and want to get it hosted for others to use, the internal recommendation has been to host it on AzureML (it is a non-machine learning model, but follows the same ...
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
1
answer
148
views
Which is better API design for POST endpoints?
I want to create an endpoint for posting different types of commands. I have the option to have one route /commands which can be used for every command type or one route for each command i.e. /...
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
132
views
Strategies for Adapting SQL-Based Data Retrieval to a Newly Introduced REST API in a Short Timeline
I'm in a pickle following a recent executive decision by our parent company. They have elected to abstract away our SQL data warehouse, transitioning to a REST API for data retrieval. The purported ...
-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
2
answers
1k
views
Do we need APIs to just access databases?
At work, we have a Web application, which makes queries to databases, and I’m asked to determine if using Web APIs could be an added value.
Personally, I’m not convinced it is.
I know Web APIs are ...
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 ...
0
votes
0
answers
228
views
Client-Server Coupling in gRPC vs REST
Quoting this article - The Other key differences: gRPC vs. REST section (client server coupling):
Client-server coupling
REST is loosely coupled, which means the client and the server do not
need to ...
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 ...
-2
votes
1
answer
77
views
How to Implement Spring Boot Endpoint for Confluent Cloud-Like Batch Payloads?
I'm currently working on a Spring Boot application where I need to create an endpoint similar to the one mentioned in the Confluent Cloud documentation (link).
The cURL example provided in the ...
0
votes
0
answers
174
views
REST Api filtering, sorting and order
I've seen in several REST API guidelines recommendations to use filtering in form of, e.g.:
/products?filter=name eq 'Milk' or price lt 2.55
(example from: https://github.com/microsoft/api-guidelines/...
2
votes
2
answers
190
views
Do RESTful endpoints elminate the need to SQL triggers?
Do RESTful endpoints eliminate the need to SQL triggers?
Triggers are supposed to execute after a certain event. Would moving to RESTful api endpoints conceptually eliminate the need for SQL triggers?
...
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}/...
1
vote
3
answers
1k
views
Should I use a REST API in addition to websockets?
I am writing a web application for a simple, multiplayer dice game so the traffic from the client to the server is going to be pretty light and latency tolerant. The client will need real-time updates ...
1
vote
2
answers
359
views
Handling simultaneous duplicate expensive read-only HTTP requests
(updated)
We have a read-only REST endpoint that performs a somewhat “expensive“ but transient request. Without client needing to poll, we need a mechanism for the server to avoid unnecessary ...
0
votes
0
answers
88
views
sync over async in K8S
We build up a microservice architecture which is called from above by a REACT SPA. All is deployed in the AWS Cloud, that is to say in an AWS EKS (K8S). We have at most 600 users in parallel.
Do you ...
0
votes
2
answers
307
views
Is this service considered "an API"? Could it benefit from being Restful?
I'm confused about the meaning of API, specially in the context of REST. I'm thinking of one example.
My company creates an application that runs on a server (the "backend"). (JavaScript in ...
-1
votes
3
answers
1k
views
HTTP REST API: Is it wrong to put search parameters in a custom header?
The contents of search string are typically sent as part of the URI query:
https://domain.name/resource?search=something+i+am+searching+for
Those same contents can be sent as the value of a custom ...
0
votes
1
answer
83
views
REST API: Include graphical resource representation URL: multiple formats problem
Many resources in the REST API I'm designing have a graphical representation. My fist idea was to include the image URL into the resources:
Resource1:
type: object
properties:
image:
...
0
votes
1
answer
172
views
How do I avoid reading from S3 every time the user updates a filter on the webpage?
I am building a web application where a user logs in, and uploads a CSV file with employee data to S3.
This is an example of the format of the file.
id
name
country
age
3243
John Doe
USA
48
Using ...
1
vote
3
answers
2k
views
Correct way to return JSON schemas in a REST API
in our company we have some APIs that return some JSON data. Before sending, for instance, data to the backend using PUT, PATCH, or POST, we need to do some kind of validation in the different clients ...
1
vote
4
answers
4k
views
What's the convention to name a REST endpoint that returns a boolean?
I have an endpoint that returns whether a resource is valid or not (true or false):
GET resource/{id}/valid
Where the returned value is not a field of the resource and is dynamic, it does not depend ...
0
votes
1
answer
190
views
How can I implement a lazy-loading cache for REST objects with custom role-based access?
I'm thinking through adding a lazy-loading cache to my API. Currently, REST objects are filtered out (scoped) based on the user's role, and additional constraints in the system. Users of the same role ...
1
vote
4
answers
3k
views
Multithreaded processing of single REST requests
Background:
We're providing an API that provides information about all users within a given group. Our API is a high level facade over another low-level REST API.
To gather those information we first ...
0
votes
3
answers
944
views
Should a REST endpoint return always the same JSON fields?
For example, let's say that I have an endpoint to get a list of buildings, that can be either apartment or house. The client can filter by apartment or house. Apartment has a property floor that house ...
1
vote
3
answers
642
views
Filter using routes in REST API
I am working on making changes to an existing Web API that exposes information about orders for specific customers.
As a developer, I am used to seeing "more or less" RESTful APIs, and I ...
1
vote
1
answer
624
views
Exchanging data between two Microservices
I am facing this problem and would like to review my approach to it here.
A Client sends an HTTP request to Service A and is expecting an answer.
Service A is connected to DB A. When it receives a ...
-1
votes
1
answer
252
views
When does a REST API stops being one in terms of state management?
As far as I understand, there is no certain boundaries for the RESTness of an API. However, I would like your help to understand how large and long (in terms of running time) a caching or state ...