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
5
votes
2answers
11k views

Best practice for REST API call with many parameters

I have a REST API with GETs operations which receive a (long) list of parameters (8 parameters, for example). The aim of this operation is to search and filter elements. Which is the best practice to ...
75
votes
3answers
85k views

Should cookies be used in a RESTful API?

I'm specifically interested in how users perform authorized / authenticated operations on a web API. Are authentication cookies compatible with the REST philosophy, and why?
5
votes
4answers
16k views

REST: Can I use POST request to read data?

Is it against best-practices to use a POST request to read data? Are there any exceptions to this? e.g. Authentication requests where you have to POST data to perform a read action. I have an API ...
4
votes
3answers
1k views

Designing a REST API with resource relationships?

I'm working to design a REST API to be consumed by a React SPA. The client-side of the SPA queries data about a relationship between two entities: Team and Player where Teams have many Players and ...
7
votes
3answers
269 views

Interoperability between client and server versions

Similar question: How do you handle versioning in a multi-sided project? Since the question above was asked almost 4 years ago, I was wondering if any new ideas have emerged . - We have a situation ...
1
vote
3answers
318 views

If URLs are broken, and how to fix them

I have been having trouble clearly defining/specifying how a URL/URI should be applied to situations such as search queries or different resource formats. The question is what an actual "uniform ...
2
votes
1answer
153 views

Microservices loose coupling using distributed business logic or centralized?

How do we achieve loose coupling in the below scenario: N microservices (let's call them Callers) needs a logic or business( let's call it Worker) to be executed with different contracts. Although ...
1
vote
1answer
55 views

Restful Services - URI design

I am new to restful services and need some clarification with constructing the URI for a restful service. Suppose the hierarchy of my data is as follows - products/types/prodids/orders. Is this URI ...
7
votes
4answers
2k views

Should an idempotent service always return the same

When designing REST endpoints idempotency is a crucial tool. Say we have a HTTP endpoint accepting PUT which we would like to be idempotent. In case a client makes the same request multiple times, ...
3
votes
1answer
160 views

How to deal with friend requests in social API REST

I'm designing an API that a social network app will consume. I need to manage friend requests between users. I have this endpoint: POST /users/{userId}/friend-requests { requesterId: string } ...
0
votes
1answer
2k views

Pros and Cons, use REST api vs querying directly to database with different client platforms [closed]

We want to figured out, whats are the pros and cons, when you use a REST api vs querying directly to a database, if you have different client platforms (Web-Application, Android, iOS). Edit: I know ...
-1
votes
1answer
74 views

APIs: Many minimal ones or a few bigger

I'm currently working on a project/product which consists of ~60 REST APIs and one client (Web app) I find many downsides on this design, and not so many benefits, and I'd like to know if this is ...
3
votes
1answer
2k views

JsonAPI - Updating the relationship for a resource

I am having trouble understanding http://jsonapi.org/. Say, I have the following endpoints in my API for authors and articles. /authors /authors/:id/articles If I wanted to fetch the details ...
4
votes
2answers
228 views

Is it violation of single responsibilty to add a method to an existing API

Say i have a Rest API that has a POST and GET method. If i want to overwrite a resource in the API i can call the GET method to get the original item and then call the POST method to replace that ...
2
votes
1answer
46 views

recommendations regarding resource uri

lets say we have a "door api" and I want to create a resource to close the door. I could do this in 3 ways: traditional way using PUT with payload {id: XX, color: YY, closed: true} advantages: ...
0
votes
1answer
57 views

What's the current state with Application-Level Profile Semantics? Anyone use them?

Reading books on REST architecture(especially O'Reilly) many times I came across the idea that one should attach data's description into link http header. Link: <http://example.com/...
2
votes
2answers
592 views

Internal REST API versioning strategy

We are developing internal api's for integrating the server side logic (backend) with frontend (web, mobile etc). We have a java stack in our backend and front end is coded in react and react native. ...
0
votes
2answers
78 views

RESTful API authorization for updatable fields

I've got a resource as follows where state is a enum: { id: 123, industry: { id: 245, name: "Farming" }, "scheduleDate": "2018-01-01", "state": "Requested|Approved|Standardized|...
1
vote
2answers
1k views

Stateful authentication in REST API using tokens

I have recently started on a project involving a REST API. The API requires authentication with requirements for administrators to be able to view logged in users and to be able to revoke specific ...
1
vote
1answer
54 views

Should I separate the REST sessions from the sessions in the rest of the application?

Assuming I have resources I restrict access to with a username + password login in my web application and in my REST API. Should I keep different sessions for both meaning that a login via the web UI ...
3
votes
2answers
194 views

Proper URL structure in REST API to change status of one particular record

What's the proper URL structure in REST API for changing state of one particular record (e.g. change from "new" to "processed"). Now I work with this URL without request body: PATCH /employees/123/...
7
votes
3answers
10k views

Is it bad design to internally call API endpoints from within the API instance?

For context, I am running a REST API built with Node.js. Because of callbacks and some complex DB calls, I have a chain of functions that are async but also unique, so it's tough to reduce redundancy. ...
1
vote
2answers
66 views

API - editing subset of attributes

Given a resource for which only its subsets of attributes can be edited, {E.g. invoice (resource) with a status (attribute) and paidAmount (attribute)}, in terms of API design, which amongst the ...
7
votes
4answers
1k views

Pagination with API

I'm currently building an opensource administration interface to help people easily manage their contens/websites. Application built on Vue.js and heavily rely on json configurations for which fields ...
3
votes
1answer
439 views

Web API: REST-ish pattern for flexible querying of time-series data

I'm working on a product that exposes a RESTful API to interact with system entities (the usual CRUD), which works very well. In addition to CRUD, we've recently encountered a need to expose the ...
0
votes
2answers
138 views

How to limit the amount of requests by minute to a external system on a micro services environment?

I'm having some problems to think on a solution to control the amount of requests by minute to a external system on a micro services environment on Kubernetes. The scenario This external system is ...
1
vote
1answer
107 views

Are data attributes good identifiers of certain blocks of HTML code?

I have a complex environment which is mostly oriented around / ends up spitting out blocks of HTML, which make up the entire page. Now, I need a way to "point and click" identify any block on my page ...
1
vote
2answers
170 views

Stateless Service

I am currently working on a player design. Without going into details I have two main layers 1. Playback services 2. User Interface. Playback services consist mainly of Player service and Browser ...
0
votes
2answers
468 views

Multiple complex parameters in a REST post call

This is a blindspot in my understanding of REST. I understand how to make get calls (and Post) if the call is simple, and requires maybe a few parameters. Example: https:\\randomAPI\get\coats\size:...
1
vote
4answers
978 views

Rest API Design in case of partial success

So I have a ticket booking system. I have ticket booking request on api, from my application we call payment service. If failed on first attempt we proceed by adding message on queue for handling ...
2
votes
1answer
158 views

Spring Restful API - Controller strategy

We are developing a new REST Api for our Spring MVC legacy enterprise web application (before this it was communicationg with Adobe Flex frontends). As a general rule we stated that we were creating ...
1
vote
2answers
349 views

Returning JPA Entities in Rest Api's?

Recently Ive seen so many devs working with the stack Spring/JPA and returning all these JPA entities on their rest controllers. In my opinion it's a BAD PRACTICE for several reason such: ...
1
vote
0answers
339 views

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

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. Please ...
1
vote
1answer
73 views

API Architecture: Should the API update the database on it's own? Or should there be another service to tell it to update the database?

I am working on a project which has a requirement to records in the database every day. I currently have a REST API which does the usual CRUD functions. Should I create a service within the ...
1
vote
3answers
117 views

How use a REST interaface for implementing tasks commands on my Web API?

I'm creating a Web API with a lot of REST Resources. My service also have some tasks which should be started on demand. for instance "Start sending emails". For now I do have a specific URL which I ...
1
vote
0answers
50 views

API Architecture Decision on Authorization & Validation levels

We are designing an authorization mechanism for a Product API where users have their own claims. The api has a patch request like this: PATCH https://product-fcd.com/api/product -d {"Products": []} -...
1
vote
0answers
30 views

Does this archicteture work for a Mobile App and Destkop App

This is a proposal of a Distribuited Cloud Architecture for DAWUF which is a Digital Audio Workstation under design and developmente in JAVA, XAMARIN, with REST services The white boxes are the ...
2
votes
1answer
2k views

Implementing a REST API in a Clean Architecture

I have been implementing a proof of concept application using Uncle Bob's Clean Architecture and I have run into a bit of a problem. Uncle Bob's architecture calls for the explicit separation of ...
0
votes
1answer
118 views

API POST Response for Hierarchical objects

If I am sending a POST request to update some object in a DB, such as : User{ id: 20, name: "Jack", UserAssociations:[{ id: 100, association: object1 ...
2
votes
0answers
251 views

Migrating a client from a REST API to a WebSocket one

I'm working on a system that integrates with several third party services via APIs. Those services require authentication. Usually, the services are implemented as REST APIs using HTTP. My system ...
3
votes
1answer
256 views

API internationalization

I have a question about architecture and I would like to know your opinion. Given a product formed by an API and several consumers (Android apps, iOS apps, web apps ...), where should I implement the ...
37
votes
5answers
6k views

How to describe an architectural shift that intentionally breaks REST standards?

I'm proposing changes to a very poorly architected software project that suffers from a multitude of problems. At a high level the project utilizes Angular on the front-end and consumes various REST ...
-1
votes
2answers
56 views

What should be the REST API (URL) for a user to be assigned to multiple territories

In our application we have a user who can be assigned multiple territories. What is the best way to expose the REST API? Should it be as : [POST] www.xyz.com/Territory/User OR [POST] www.xyz.com/...
8
votes
5answers
831 views

Designing function based RESTful API

Please settle an argument between me and a friend. We'r currently designing a product API. Our Product entity looks like this { "Id": "", "ProductName": "", "StockQuantity": 0 } Product ...
2
votes
2answers
117 views

Should a POST endpoint in a REST API allow the inclusion of related resources?

Given the following REST endpoints: (GET, POST) /api/v2/employer (GET) /api/v2/employer/{id} (GET, POST) /api/v2/employer/{id}/employees Should a consumer of this API have the ability to ...
2
votes
3answers
4k views

Does it make sense for User-Agent to be required for REST APIs?

One company (who I will refer to as Company NNN from here forth), has a REST API. At my company, we use Company NNN's REST API to provide some content to our end users. If I send the request with the ...
3
votes
2answers
328 views

REST Resource Validation: Conditionally Required Fields Vs. Separate Resources

Is it better REST API design to use conditionally required fields or to create different resources based on the controlling field's value? Here's an example: POST route/automobile { "type": "car", //...
0
votes
2answers
452 views

Single page apps and backend APIs

When creating single page apps that communicate with a backend API via ajax, what is common (best?) practice regarding updating different server side database objects as a result of one client side ...
13
votes
4answers
25k views

Why do we need REST service security if we have HTTPS

I refer to this excellent article http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/ which speaks of amazon like security for web service. However I was asked a ...
1
vote
3answers
2k views

Commenting strategies in C# & asp.net web api

I've been working on a ASP.NET Web Api 2 project as a learning exercise, and I was wondering what the norm regarding commenting is. I use the Repository / Service Pattern, and everything is very much ...