Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
-2 votes
0 answers
26 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 ...
user avatar
  • 2,424
0 votes
0 answers
38 views

Is a hexagonal architecture a good choice for a python REST API?

I have a flask backend (REST API) written in python using flask-restx (mainly for automatic swagger docs), marshmellow for serialization and API schema definitions and SQLAlchemy for persistence. I ...
user avatar
1 vote
3 answers
112 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 - ...
user avatar
  • 113
1 vote
2 answers
184 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 ...
user avatar
  • 113
2 votes
5 answers
217 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 '...
user avatar
  • 2,424
2 votes
1 answer
131 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&...
user avatar
  • 2,424
-2 votes
1 answer
59 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 ...
user avatar
  • 2,424
1 vote
3 answers
120 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 ...
user avatar
  • 119
0 votes
1 answer
104 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 ...
user avatar
0 votes
5 answers
130 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 ...
user avatar
  • 353
1 vote
1 answer
46 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&...
user avatar
-1 votes
2 answers
53 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 ...
user avatar
0 votes
2 answers
68 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", ...
user avatar
-1 votes
2 answers
56 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 ...
user avatar
2 votes
1 answer
201 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 ...
user avatar
  • 33
-2 votes
1 answer
68 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": &...
user avatar
1 vote
1 answer
70 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'...
user avatar
3 votes
5 answers
203 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: ...
user avatar
  • 193
0 votes
1 answer
101 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 ...
user avatar
  • 109
3 votes
3 answers
180 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 /...
user avatar
  • 2,424
0 votes
0 answers
44 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'...
user avatar
  • 1
1 vote
3 answers
266 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 ...
user avatar
  • 1,467
0 votes
3 answers
87 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 ...
user avatar
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 ...
user avatar
0 votes
1 answer
68 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 ...
user avatar
  • 155
0 votes
1 answer
106 views

Best way to design multiple paginations in a REST API

Let's suppose that I have a model named Collection. I can create a collection, this collection have two important fields: shared_with_company, shared_list. currently I have an endpoint: /collections ...
user avatar
-2 votes
1 answer
94 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 ...
user avatar
1 vote
1 answer
134 views

What is the best way to design calls of post and comments in a rest api?

So, currently I have two models: Post and Comment. Where a post can have multiple comments. I have an endpoint named Posts and an endpoint named Comments that is called to retrieve comments of a post. ...
user avatar
0 votes
2 answers
127 views

When updating a model on a RESTful API, should there be an update endpoint per field? or one endpoint for the model?

For a RESTful API, consider a model schema as follows: MyCoolObject { field_a field_b field_c } Is it better to create one update endpoint to update one or many fields on the model? Or create ...
user avatar
1 vote
1 answer
173 views

What is the common practice to serve a REST API based request asynchronously?

I am building a microservice app where the client sends requests through REST APIs to the backend server, and the backend will communicate with other services using gRPC. I am aware that this is ...
user avatar
-1 votes
1 answer
120 views

rest api design for bulk post [closed]

Is it OK for an API to accept either an object or an array on the same endpoint? I want to allow the user to post multiple items at once. I am thinking of creating a different endpoint, but then it ...
user avatar
  • 125
0 votes
1 answer
73 views

Am I understanding OAuth2 correctly and is what I am trying to achieve possible?

I am creating a web application which has three distinct components as far as I understand. A Nuxt frontend, and Spring Boot backend and Google OAuth2 for authentication using OpenID Connect. Nuxt can ...
user avatar
2 votes
1 answer
130 views

Naming convention for the classes holding REST APIs [closed]

Our new team suffixes class names with API to indicate that they encapsulate RESTful methods. Eg: "PaymentTemplateAPI", "FeeTemplateAPI" classes. I find it odd since API is a ...
user avatar
  • 139
0 votes
0 answers
21 views

DRF API - using Multitable Inheritance vs "profiles"

I'm looking forward to your opinion on how to do this. This is a backend that will be served as a Django Rest Framework API. There will be multiple types of properties. Properties have approximately ...
user avatar
  • 119
1 vote
2 answers
122 views

How does a RESTful client know the proper way of manipulating the state of a resource?

I've read that a key portion of a RESTful interface is that the client doesn't have to know what options are available before they hit the page/access the resource. The client starts with the initial ...
user avatar
  • 2,321
0 votes
1 answer
277 views

How to share users between multiple web application?

Objective I have to create way to use the same users to connect to multiple application, and i am thinking about how to do it and how to share the data between the applications. Details Each ...
user avatar
0 votes
1 answer
43 views

Bad Request or Unauthorized with missing data in POST / PUT

We have a simple POST / PUT that requires that some of the body data matches an organization id that is contained in the JWT. If the data doesn't match, that is clearly a 401 but wondering about an ...
user avatar
  • 139
0 votes
1 answer
30 views

Is there a set of guidelines on how to handle/code execution of Spring Microservices RESTful API calls?

I'm building a RESTful web api using Spring Microservices. I am following the Controller/Service/Repository Structure. Where can I find some guidelines on what the responsibility of each class should ...
user avatar
  • 753
0 votes
0 answers
27 views

REST API partially incorrect request handling

I'd like some insight/heuristics on how to tackle a specific kind of situation. Entity A, B have a parent child relationship with Entity C. Entity A creation is done thru a POST /createA API in ...
user avatar
2 votes
2 answers
139 views

API design: how to minimize client support?

I am tasked with designing an API for a car registration service. I don't have all the details yet, but we will receive requests from car dealers via API that my client will then process and forward ...
user avatar
  • 396
-1 votes
1 answer
101 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. ...
user avatar
  • 11
1 vote
3 answers
318 views

Using IP address vs domain name for microservice communication

We have microservices in separate machines that currently use IP addresses in their configuration to communicate via REST APIs. There are also domain names defined for these machines. Is it a good ...
user avatar
  • 179
1 vote
2 answers
174 views

What Is the Industry Standard of Specifying APIs for Frontend-Backend Handshake?

I am somewhat new to web development and maybe this question belongs to stackoverflow, but there is a human-interaction component here. Here is the scenario. I am serving some neural network models ...
user avatar
  • 119
0 votes
1 answer
86 views

How to get the CSRF token when using a cross-origin REST API?

Usually, the web server that is serving a page includes the CSRF token inside the HTML. However when I'm using a cross-origin REST API, there is no "initial" page that could include the CSRF ...
user avatar
0 votes
1 answer
202 views

RESTful web APIs using MVVM architecture

As the title implies, I would like to know if it is possible to create RESTful web APIs using MVVM architecture? Or we can use just MVC pattern to create web APIs?
user avatar
  • 103
0 votes
2 answers
61 views

Data entry (forms, validation) in RESTful Web app

I'm designing a web-app that will use a REST API. What I've never understood is what is REST's equivalent of HTML forms? HTML5 forms have a reasonably rich set of server-provided, declarative controls,...
user avatar
0 votes
2 answers
78 views

How to structure URL when retrieving a REST resource by an attribute that isn't the ID?

Let's say I have a collection of cars, all identified by VIN, such that cars/xyz123 will return the car with that VIN. Furthermore, I can get subsystems (children) by using URIs similar to cars/xyz123/...
user avatar
  • 103
0 votes
2 answers
76 views

REST GET /organization/1/department/2/workarea/3 with optional components

Suppose my system has Organizations which contain Departments which contain Work Areas, so it makes sense for me to query something like get /organization/o1/department/d2/workarea/w3/employees to get ...
user avatar
  • 1,611
0 votes
2 answers
78 views

How to implement resources of a REST API as classes?

I need to access and process different resources from a REST API. For this I've come up with two different approaches: Approach 1: Create one class per resource, that handles accessing the data from ...
user avatar
  • 129
0 votes
0 answers
47 views

Where to deploy a Flask Rest API with 1500 active users per day?

I will be working on a Flask Rest API and I don't know where to deploy my Flask app depending on number of the active users. This is my use case; My customer has an Oracle DB for their hospital and ...
user avatar

1
2 3 4 5
30