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
0 answers
28 views

Multithreaded processing of single REST requests

Background: We're prodiving an API that provides information about all users within a given group. Our API is a high level fascade over another low-level REST API. To gather those information we first ...
15 votes
4 answers
26k views

Use composition and inheritance for DTOs

We have a ASP.NET Web API that provides a REST API for our Single Page Application. We use DTOs/POCOs to pass data through this API. The problem is now, that these DTOs are getting bigger over time, ...
0 votes
3 answers
117 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 ...
2 votes
2 answers
133 views

Displaying various subsets of content stored in a database

I am looking for advice on database design for a web app I am building. Part of the website needs to display content from a SQL database dynamically depending on the component's context. To be more ...
0 votes
1 answer
105 views

Azure Event Grid API layer beneath a HTTP API layer

I am part of a project/team that is building a new web app in Azure for the first time, having previously built and developed a traditional three tier ASP.NET web app over a number of years. We have ...
1 vote
3 answers
164 views

REST action as part of request body - action not stored alongside entity

I am working on an API that allows a client document to updated under the endpoint of PUT /client/{documentId}. As part of this document, I need to include an extra field 'ReplicateInManager' that ...
1 vote
3 answers
58 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
68 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 ...
0 votes
1 answer
86 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 ...
20 votes
2 answers
15k views

REST API security: HMAC/key hashing vs JWT

I just read this article that is a few years old but describes a clever way of securing your REST APIs. Essentially: Each client has a unique public/private key pair Only the client and the server ...
1 vote
3 answers
99 views

REST API: model file uploads as part of a resource or as subresources?

I am designing a REST API that has to deal with users and two video uploads associated to each user. So far, I've come up with two different approaches of modeling this: Video as part of a user ...
1 vote
2 answers
314 views

How to manage primary keys in CQRS

I'm building a backend following the CQRS pattern and I don't know how to manage properly the primary keys (surrogate keys) between the command and query databases. For example: I have a model with ...
-1 votes
1 answer
115 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 ...
5 votes
3 answers
673 views

Designing a flexible search API response

Quick Summary I'm building a search micro-service that will allow searching across different types of resources in a particular system (e.g. blog posts, users etc.). The API that will be exposed will ...
2 votes
2 answers
2k views

Different responses in REST

Let's say I've got a REST endpoint which is returning a list of people from some location, which can be referenced by address. GET /people?address=London A response could be: [{ "name":"Jane", ...
1 vote
1 answer
54 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
62 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, ...
1 vote
2 answers
74 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
103 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
0 answers
40 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
102 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 ...
85 votes
3 answers
33k views

What is REST (in simple English) [closed]

Lately I have become interested in familiarizing myself with REST. I tried reading wiki entry on REST, but it was of no help. I would really appreciate it if someone can explain in simple English (...
0 votes
1 answer
765 views

Adding resources to subresource REST API

I'm trying to build an web API that closely represents a library of books. I currently have the following routes. GET /api/books GET /api/books/:bookID GET /api/libraries POST /api/libraries This ...
0 votes
1 answer
97 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 ...
0 votes
1 answer
49 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 ...
10 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). ...
0 votes
0 answers
96 views

Async Polling REST API Design

What do you think should be the optimal design pattern for long-task resource create/update using a Polling-Task strategy? Example of Create: POST https://api.contoso.com/v1.0/products HTTP/1.1 Accept:...
3 votes
3 answers
3k views

Is is OK to use a non-primary key as the id in a rails resource?

I am getting ready to set up a resource for some new api calls to my rails application. I am planning on calling the resource devices ie resources :devices This is going to represent android mobile ...
0 votes
4 answers
959 views

Frontend/backend SPA communication: how to handle a list of string options

I have single page application with an Angular frontend and a Spring REST-backend. What is the proper way to handle a list of string-based options in the fronted the enduser can select from, which ...
0 votes
1 answer
953 views

How to setup REST API in Codeigniter 3.0

I am creating the REST API using codeigniter. I downloaded this library and installed in my application. It works great! https://github.com/chriskacerguis/codeigniter-restserver But I have an doubt. ...
-2 votes
1 answer
6k views

How to deal with very large file in request body in REST API?

I have created a rest api. It supports multipart/form-data request type. My API clients used to attach content of files in their system to POST request body. It works fine. But recently there is need ...
1 vote
1 answer
187 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
2 answers
978 views

WCF service design

I am rather new to WCF (or rest, or Json for that matter) and I'd like to have some expert opinions on which methods to define. Some short introduction to give an idea of what the webservice should ...
4 votes
3 answers
4k views

What architecture/design to adopt when consuming a RESTful API? (iOS App)

TL;DR Part 1) I want to refactor the biggest part of the app on which I work - and it is pretty much spaghetti. It's a single class that makes the requests to the server, parses the JSON, and saves ...
2 votes
2 answers
261 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, ...
0 votes
4 answers
224 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
3k views

Two way data synchronization between web application and REST API server

I have a web application and a REST API server (Microsoft Dynamics CRM 2016) that I don't have access to it's code, but I have access to the available resources. I need to create a data sync between ...
0 votes
2 answers
2k views

@OneToMany relationship in a microservice environment

I am coming from a typical monolithic background and I've been experimenting a lot with Spring Framework. I have also build some simple microservices communicating with each other etc. Now I want to ...
42 votes
5 answers
52k views

Should HTTP status codes be used to represent business logic errors on a server?

I'm at a bit of a crossroads with some API design for a client (JS in a browser) to talk to a server. We use HTTP 409 Conflict to represent the failing of an action because of a safety lock in effect. ...
0 votes
2 answers
238 views

Best way to make insert data in logs web API. REST or WebSockets

I want to make a centralized log web API, so it will have a large amount of data per seconds. the logs will comming from others WEB API I was thinking if i make the REST API, all of the POST made ...
10 votes
4 answers
7k views

Warnings in a REST API as not critical errors

I have a REST API that for some of entpoinds like DELETE, POST or PUT I have some validation rules that can return an error. Now I need a new type of an error like a non-critical error, that it ...
1 vote
1 answer
154 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 ...
69 votes
4 answers
27k views

Why PATCH method is not idempotent?

I was wondering about this. Suppose I have a user resource with id and name fields. If I want to update a field I could just do a PATCH request to the resource like this PATCH /users/42 {"name&...
0 votes
1 answer
2k views

Exposing complex actions using http verbs in REST API

consider the following REST resource Account { number:"number-000", name: "name", customer : {}, type : {}, status : "status", balance : 0, rating : 0....
83 votes
6 answers
62k views

HTTP Status Code for "Still Processing"

I'm building a RESTful API that supports queuing long-running tasks for eventual handling. The typical workflow for this API would be: User fills in form Client posts data to API API returns 202 ...
1 vote
4 answers
94 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
336 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 ...
1 vote
0 answers
555 views

How to make rest api end points in swagger UI pre authenticated in Spring BOOT [closed]

I have written a spring boot rest API application with OAuth.I have integrated swagger UI for API documentation. I want the API endpoints on swagger UI to be accessible without an access token. This ...
-2 votes
1 answer
92 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:...
0 votes
1 answer
110 views

Sending multiple calls from angular application

I am working in Angular project which is connected to REST API. Here we have an endpoint to create and update room types. POST endpoint for create and PUT endpoint for update exiting room types. Both ...

1
2 3 4 5
31