Questions tagged [rest]

Representational state transfer, or REST, is an architectural style for networking software to transfer information through the web.

Filter by
Sorted by
Tagged with
0 votes
1 answer
58 views

Additional questions for an old topic: "How to specify many ids and their variable name in a REST API request?"

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 ...
-3 votes
1 answer
69 views

Advice on stack and architecture for a newbie [closed]

I need some advice regarding architecture and elements for a little project I want to do. I'd like to make a dashboard showing multiple small charts of serial data coming from a microcontroller. I can ...
1 vote
1 answer
71 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": "...
-2 votes
1 answer
37 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 ...
  • 127
0 votes
2 answers
83 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 ...
-2 votes
0 answers
26 views

Considerations when invoking CLI to process web requests

What are the ramifications of invoking a CLI command on a server to process a HTTP restful web request, and sending back the results from stdout as the response? Are there any scalability and security ...
  • 107
0 votes
0 answers
54 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
303 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 ...
  • 53
2 votes
2 answers
131 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 ...
  • 516
3 votes
4 answers
135 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 ...
  • 147
-1 votes
2 answers
118 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
72 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 ...
  • 11
2 votes
2 answers
70 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 ...
  • 121
1 vote
1 answer
62 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") ...
  • 239
2 votes
3 answers
85 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 '...
  • 217
0 votes
1 answer
67 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
174 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
117 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
265 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
82 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
126 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
92 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 ...
  • 109
0 votes
3 answers
137 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": "...
  • 13
0 votes
0 answers
44 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/{...
  • 101
0 votes
4 answers
224 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
3 answers
206 views

How to implement HATEOAS with CQRS?

Let's say I have a CQRS system where my write model contains the business rules. My read model is simply a DTO; it is a collection of properties and "dumb". Now if you were to create a REST ...
-1 votes
3 answers
82 views

Content Negotiation: Is a meta representation of a resource, like a JSON Schema, an appropriate REST representation?

This MDN article here summarises quite well the technique of Content Negotiation on a REST API. In essence, if we have a GET /student/:id endpoint, we might want to see different representations of ...
  • 2,473
1 vote
3 answers
163 views

REST API endpoint to request all available data from a resource

I am developing a REST API where users can request data from one or more sensors, using the following scheme: GET /sensors - returns a list of available sensors GET /sensors/<sensor_ids>/data - ...
  • 113
1 vote
2 answers
307 views

Should you limit the size of JSON array to avoid abuse? Or is this already covered by size limits?

I'm working with a basic REST API, through user interaction on the UI, the JSON object is built up, including Arrays and a POST is sent to an endpoint using this object as the request body. For ...
  • 113
2 votes
5 answers
235 views

Are values like 'lastUpdated' an exception to the idempotency requirement for a PUT request?

In REST APIs a PUT request is meant to be an idempotent action - the result should always be the same, regardless of what the initial state was. However, often resources will have attributes like '...
  • 2,473
2 votes
1 answer
161 views

Is it RESTful for a resource to have different values to different users?

Two scenarios: Scenario 1 - Redacting information on a resource Let's say I've got a User resource id: string; username: string; address: string; For privileged users they may see: id: "1&...
  • 2,473
-2 votes
1 answer
62 views

Is it appropriate (RESTful) to have a resource that is an aggregation of another resource?

Let's say you have a resource KeyValuePair type KeyValuePair = { id: string; key: string; value: unknown; } and we can CRUD this resource via a /keyvaluepairs endpoint. Now - lets we have ...
  • 2,473
1 vote
3 answers
184 views

In RESTful APIs, what's the proper way to have different resource properties based on user authorization?

I'm struggling with defining proper endpoints for a RESTful API, given the following requirements: We have an existing /customers endpoint, which when called with the GET verb, returns a list of ...
  • 121
0 votes
1 answer
164 views

REST API Design: Should we have separate endpoints for same resource if the system uses both ElasticSearch and MySQL?

Suppose we have a resource which uses either MySQL or ElasticSearch, depending on whether the query params require full-text search or not. For example the possible query filters are: fk_id which is a ...
0 votes
5 answers
238 views

Standard Error response for Backend API failure

In REST APIs, http error codes 4XX, 5XX are used to convey error messages on the server. When the API itself is dependent on another backend API, is it a good practice to expose error codes or error ...
  • 363
1 vote
1 answer
58 views

Can a REST API response include a reference and preview data

Let's say I have a REST API with resources that look something like this: /users/<id> { "id": <str:user_id>, "firstName": <str:first_name>, "lastName&...
-1 votes
2 answers
89 views

How to deal with upsert PUT requests in a Spring Boot web application without crossing service and controller layers?

I've got a pretty simple web service that I need to add a PUT endpoint for that can handle upserts. This application is primarily a middleware layer to handle logging, caching and instrumentation in ...
0 votes
2 answers
73 views

REST Api - deleting a resource based on either ID, or its OwnerID

I have this list of Notes: public static List<Note> _notes = new List<Note> { new Note { Id = new Guid("00000000-0000-0000-0000-000000000001"), CategoryId = "1", ...
-1 votes
2 answers
88 views

Best practices for API design for an E-Commerce System

I have a few basic questions on how to implement an API for a basic e-commerce system. The relevant entities are Customer, Puffle, and Review. Each Puffle can have zero or more Reviews. Each Review is ...
2 votes
1 answer
342 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 ...
  • 33
-2 votes
1 answer
95 views

Is it okay to return an object in a list endpoint according to REST API specification?

I need to add extra data to a list endpoint. Basically it is the list I want to return and an extra data. Like below { "results": [...], "extra_data": { "field": &...
1 vote
1 answer
73 views

REST - different response from same resource dependent on requester

Let's say I have a single resource of employee that belongs to user: { "id": 1, "name": "John Doe", "userId: 1 } When making a GET request to /employees/1, I'...
3 votes
5 answers
421 views

Version REST APi as a whole, or by endpoint

I had a discussion with a colleague of mine today regarding versioning of a REST Api. We currently have an API with support for versinong by providing the correct version in the URL. So for instance: ...
  • 203
0 votes
1 answer
596 views

Designing a system to hit multiple HTTP requests serially

Hope this is the right StackExchange community to ask this question. I am building a (Python) project that will have a list if URLs to hit. They have to be hit serially, and part of response of one ...
  • 109
3 votes
3 answers
203 views

Is it appropriate to return derived/aggregated representations of resources, via content negotiation, in a REST API?

I refer to this fantastic answer to an earlier question I had. My question is, say you have an endpoint GET /tasks and that endpoint accepts query params to get certain groupings of data like: GET /...
  • 2,473
0 votes
0 answers
50 views

Best way to align multiple RESTful API's through an API gateway

We currently have a monolith public api which serves most of our api endpoints. This has introduced a bottleneck as the owning team needs to make changes to publicise anything new and other teams don'...
  • 1
2 votes
3 answers
1k views

REST API Design: Should the update (PUT) request include the ID in the resouece URL

When designing a REST API for update request. Usually PUT is used. Question: should the resource URL include the id usually? For instance, there is a book resource: http://localshot:8080/library/book ...
  • 1,499
0 votes
3 answers
110 views

Communicating error conditions in client API for remote RESTful server, what's the best way?

I'm writing an application based on a RESTful API located in a server (written in Python). An Android app will access the API endpoints to get, post, put or delete data. The usual. The server has a ...
0 votes
1 answer
29 views

Should I check the ownership of every "somethig_id" fields from a POST request?

I have an endpoint API for a POST request in a multi-tenant application, let's say it is for a Payment, where we have to store these fields: tenant_id (this is the account owner) amount date payer_id ...
0 votes
1 answer
87 views

REST API Per-Method Versioning

New to writing REST APIs. Had a question about versioning. Let's say that we have a service with the following methods: Search <- Given some data, it will perform a search Billing <- Given a ...
  • 155

1
2 3 4 5
31