Questions tagged [rest]
Representational state transfer, or REST, is an architectural style for networking software to transfer information through the web.
1,531
questions
0
votes
0
answers
46
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
174
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
158
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
75
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
91
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
211
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
426
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
89
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 ...
0
votes
1
answer
270
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
153
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
134
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 ...
0
votes
1
answer
133
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
116
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 ...
1
vote
1
answer
55
views
How to deal with mixing models between services?
I am working on an API that has a User resource to represent the current user and a User service that handles business logic for representations of this user.
I need to introduce an Organization ...
0
votes
0
answers
69
views
REST API design - Categorised response objects - All, Sub, Dub movies paged response
I am having trouble deciding what is the best way to implement a REST API which does the following:
When page gets loaded, it displays a list of Movies and above is a category selector tab (ALL, SUB, ...
0
votes
0
answers
93
views
How can I secure the backend in a meaningful way when users log in via OAuth2 in the frontend?
I'm thinking about a rewrite of a existing application. This legacy application does not separate frontend and backend. It's a single application with server side rendering.
I want to rewrite it to a ...
0
votes
0
answers
158
views
Howto design a Rest-Client in c# the right way?
apologies, if my question is to trivial. But i after doing some research i couldn't find an appropriate answer to this seemingly simple question. As a developer with some experience, i know that i ...
1
vote
2
answers
75
views
Rest API: paths versus queryparams for user accounts
I'm looking for some guidance around REST design for user account endpoints. I generally understand REST and some of the principles involved, with paths being used to fetch items from a resource:
/...
0
votes
1
answer
133
views
Testing REST API endpoints. How do I setup the tests?
When writing tests for my FastAPI endpoints I am not sure which is the best way to setup the test (store data in the DB, prepare data for the body of a POST call, etc.).
I can either use:
direct ...
-1
votes
1
answer
69
views
How to auto-scale a service based on requests count and internal processes
I have a service which is used to register tasks. These tasks are asynchronous and executed in background using a state management engine.
The state management engine is running inside the service and ...
-1
votes
1
answer
50
views
How to break a bloated decorator into smaller parts in Django?
In a project I am doing, I have to perform a lot of repetitive checks at the beginning of each API end point. As the amount of duplicate code started to grow, I thought of using a decorator to wrap ...
9
votes
7
answers
2k
views
Implicit vs. explicit data structure retrieval from a REST API
I'm using a REST API to retrieve data from my back end at my front end. I'd like to figure out which way of receiving data from the back end is the better one (= clean, robust, and best practiced).
...
2
votes
2
answers
613
views
What's the proper response when I try to update an existing entity but with not found parent ID
I have an update API (PUT/PATCH) entity/{id} to update a certain entity in my DB. Let's say:
entity {
id: number, // Primary key, unique, not null
content: text,
parentId: number // Foreign key, ...
-1
votes
4
answers
580
views
RESTful Batch Delete
When batch deleting a resource. e.g. deleting all Orders that belong to Customer 99:
DELETE /customer/99/order
If there are defined business rules1 that prevent Orders that meet specific criteria ...
0
votes
1
answer
209
views
Where should I create my aggregate root? in api or frontend?
I am writing a simple application to apply what I have learned so far in DDD.
I have the following mysql tables in my api server
Sales
Column
id
pk, int
title
varchar
description
varchar
Images
...
0
votes
4
answers
128
views
REST Route best practices for creating resources
I have some REST API endpoints set up to create a blog post. Each blog Post is owned by a user. I have the following routes:
/users [GET, POST]: Get a list of all users, POST to this endpoint to ...
1
vote
2
answers
550
views
Is it OK to return different DTOs for the same endpoint when the user is logged in vs when it is anonymous?
Say that I have a REST endpoint for a chess server. If I'm not logged in and do a GET on /games I could get all running games like:
{
running_games: [
.....
]
}
but if I'm logged in I ...
0
votes
2
answers
872
views
Rest API design - endpoints for multiple types
REST APIS are a Uniform interface.
Is it better to add functionality to the search parameters of a GET request with a query parameter, than to add nested resource identifiers to a collection /exists ...
-3
votes
1
answer
94
views
Restful design of read only list, with the exception of one published and one draft item
I have the following domain specs:
A historic read only list of items that were published and a currently published item (if any) and an optional draft item (if any).
I thought of the following design:...
1
vote
1
answer
357
views
Additional questions for an old topic: "How to specify many ids and their variable name in a REST API request?" [duplicate]
Sorry, I would have left a comment on the other question, but I don't have enough reputation.
I have the same problem as in this question:
How to specify many ids and their variable name in a REST API ...
1
vote
1
answer
128
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": "...
-1
votes
1
answer
129
views
REST API design for resource that is "uploaded" via Presigned URL
I have an API with some specific resource say "cars" which have the following actions:
Get all Cars
Get one car
Add one car
for Get all cars and Get one Car, I have a REST api resouce with ...
0
votes
2
answers
240
views
Is it okay for a POST response to return resources other than those in the request?
Working on the API, I understood that the behavior for one of the endpoints might be a bit counter-intuitive, but I am not sure whether this violates any RESTful rules. Based on what I have read, it ...
0
votes
0
answers
62
views
What is the best way to design endpoints for a restful application?
I am a backend developer and I am writing a restful application. I have a question about how best to design the endpoints.
I have a database table that stores values (I just provided an example)
|id (...
4
votes
3
answers
748
views
What to name a POST endpoint that behaves like GET?
My app has an API endpoint GET /sessions/{id} which gets info about a session. This endpoint returns a lot of data, so we allow passing JSON in the request body to filter what fields etc. are ...
2
votes
2
answers
170
views
How would I use TDD / BDD when my webapp interacts with an external REST API?
I'm following roughly the TDD style as explained in the "Obey the Testing Goat" book: You have a functional test for your (Django, in my case) web app that tests the observable behaviour via ...
3
votes
4
answers
651
views
Composite ID in hierarchical REST API
Suppose the following:
Building has 0...n Rooms, Room has 0...n Seats.
I am implementing a REST API which accepts data from different companies, with the caveat that the companies must be able ...
-1
votes
2
answers
122
views
REST API vs upserts and "updeletes"
I am building an API that (I am deliberately simplifying the schema below to only focus on what is questionable):
I have a table that roughly looks like this:
CREATE TABLE IF NOT EXISTS some_table
(
...
0
votes
1
answer
153
views
Handling a numerical value that may be specific or a range in a REST API
Let's say I have a REST API that needs to return the width of an object, but that width may either be a specific value or a range of values. What would be the best practice for designing the API to ...
2
votes
2
answers
263
views
Saving REST API IDs into a different microservice
I'm not sure how to best ask this, as it's the first time I have to tackle such stuff. It might be that it's a common problem and I'm just using the wrong keywords to search. Basically, imagine a ...
1
vote
1
answer
275
views
Best method to differentiate between two REST methods with the same pathparam (in Quarkus)
I have an issue regarding the differentiation between two Rest methods that have the same amount of path parameters:
@GET
@Path("image/{ratio}/")
@Produces("image/png")
...
2
votes
3
answers
432
views
REST API Sub-Resources
I feel as if i am over-thinking this, but with a RESTful API design with resources being themselves resources of something how should these 'typically' be accessed?
Of course, an acceptable answer is '...
0
votes
1
answer
285
views
REST API designing resources for complex entities
I have an ASP.Net Core Web API where I am having difficulties designing the REST resources based on the EF Entities I have.
There are three entities that describe a Reservation. First, there is the ...
1
vote
0
answers
492
views
How to handle relationships between resources in Restful API
Problem
Hi, we have an API that it's pretty similar to a standard CRM. That is, we have a really big amount of resources (even our own customers can define new resources). All of these resources share ...
3
votes
2
answers
571
views
Oauth 2.0 - MFA for REST APIs
We are looking at implementing Multi-factor authentication for our application, using Time-based one-time password (TOTP) algorithm.
What we want to achieve:
Users should have the option to enable ...
0
votes
3
answers
1k
views
Designing APIs that don't expose database primary keys
People say "don't expose primary keys from the database in your API" because its a major security leak, so I'm trying to come up with a way for:
RESTful HTTP requests to reference server-...
-2
votes
3
answers
754
views
What HTTP response to return for a patch request with partially correct and partially wrong
I have a campaign, which has URL as a child.
If I make a patch request to add a list of 3 URLs out of which first one is invalid URL, second URL already exists in the campaign and we do not want to ...
0
votes
3
answers
498
views
Optimal method of storing image thumbnails
I'm working on an application with a database containing many recipes. The API is written in Django (with Django REST Framework) and frontend in React.Each recipe is assigned a high-quality image. In ...
0
votes
2
answers
582
views
API Design. Should i use one update route or multiple for each business logic functionality
We are developping an app and I am not really pro at rest API etc.
We decided that a maximum of business logic should be in the backend and started to do "business" route. But sometime I ...
0
votes
3
answers
417
views
REST API design: how to represent users joining and leaving groups?
I'm designing a REST API in which users create groups that other users join and leave.
A user creates a group by making a request like this:
POST /groups
Request body:
{
"name": "...