Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [rest]

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

0
votes
0answers
38 views

Sharing a common parameter in each rest service : good bad idea?

We are designing some restfull services and wondering if we could introduce a generic paramater named CallContext in each (PUT/POST/PATCH) call in order to have the following information : UserId (...
2
votes
4answers
126 views

User calling REST APIs on behalf of a different user

Here's an example: GET /posts POST /posts GET /posts/{post_id} PUT /posts/{post_id} This api is being used by SUPER_ADMIN as well as CONTENT_WRITERS. Its working great. If user is logged in as a ...
0
votes
1answer
43 views

Add the database layer to your application with a service or include it directly?

I am planning to set up a new Web-application that contains the following things: I want to use JavaEE with JSF for the Frontend & Backend combined with git-hooks to deploy them onto my server. ...
1
vote
2answers
68 views

Externalized component and communication approach - REST or RPC?

This is a hypothetical scenario with some concrete parts. Say that I have built a system that allows users to interactively arrange living room layout. The result of this arrangement is presented to ...
-2
votes
0answers
33 views

Backend, API, Frontend confusion

I have experienced hard times to decided which way to go. I try to illustrate with an example. I have a project. lets say todolist app. It will be web application, mobile applications and public API ...
1
vote
2answers
112 views

Is it RESTFul for an endpoint without a path parameter to always have a single resource as a result?

While creating tools for an api, I've noticed the following inside the api specification: GET /cookie-orders returns the following structure as a 200 result: { "first":true "last":false ...
1
vote
3answers
45 views

REST Routes depending on Roles

I'm currently working on a project which will use a REST API and that's exactly what I'm working on and I'm using nodejs with express, mongodb and mongoose. I've users that can have 4 different roles:...
10
votes
5answers
2k views

What should I do when optimistic locking doesn't work?

I have this following scenario: A user makes a GET request to /projects/1 and receives an ETag. The user makes a PUT request to /projects/1 with the ETag from step #1. The user makes another PUT ...
1
vote
2answers
121 views
+200

How to handle “Optimistic Locking” on a collection with ETag headers?

Consider endpoint /projects that returns a list of projects with the following headers: HTTP/1.1 200 OK Etag: "superEtag" The etag value represents a hash of the entire collection and it does not ...
0
votes
1answer
59 views

What HTTP action and return value should be used on resource's action

I have a question about how I should implement a new action for a resource on my API layer. I have a Timesheet which is used by people to let us know how many hours they worked on a job. This ...
0
votes
2answers
52 views

Managing sign-on in mobile applications

I'm programming a mobile app which makes use of REST services. Some of the services are for logged users, so I have a login endpoint which lets me enter my credentials and get a JWT token for ...
2
votes
2answers
78 views

How to expose field constraints using HATEOAS?

For example we have entity object: { "id": 10, "name": "First object", "status": "new", "manager_id": 200, "links": [ { "href": "self", "type" : "...
-2
votes
0answers
60 views

Advice on designing a generic REST service

My team and I have designed a new api to manage user account details. I am in need on some feedback and critics on our design. The user account will be created by another API... In order to have the ...
0
votes
1answer
229 views

How to structure similar structs using Go and PostgreSQL without too much duplicate code

I am making a REST API in Go using PostgreSQL. Quick introduction: I suddenly have a case where I have different variations of the same basic entity, one of the variations have maybe 12 extra fields ...
3
votes
2answers
77 views

How to safeguard a COTS REST API with on-premise servers for approved client apps only?

Goal: Prevent unauthorized 'clone' apps from using REST API-based solutions where the customers manage their own servers and services instead of the vendor doing so (database, resource, and identity). ...
2
votes
5answers
338 views

In a REST API, should you correct user input on server side?

We have a REST API with an endpoint accepting JSON data from the client. One of the JSON fields is a URL that will be rendrered to other users as a hyperlink to a website page associated to the ...
0
votes
2answers
97 views

New version of REST API - deploy two services?

Assume you need to define a completely new REST API for a given service. These rest APIs are distinguished by something like "v1" and "v2" in the path. If you develop these services in Java, would ...
1
vote
1answer
138 views

How can I turn my CRUD database application into a REST application?

I may have gotten myself confused, when reading CRUD vs REST and how they are similar, so I wanted to explicitly ask: can I turn my CRUD application into a REST application, when I have a specific ...
2
votes
3answers
51 views

Using data to maintain compatibility when evolving RESTful service

I've been reading up on API versioning for REST APIs. Most of the articles I've come across (here's an example) seem to focus on two options: URI based versioning, e.g. v1/my_resource/ Media Type ...
-1
votes
1answer
46 views

Consuming Rest, DAO or Service layer?

I feel like this is a dumb question but here it goes: If i'm consuming rest (getting data and transforming in POJO), does it sit in the DAO or Service layer? As for what i've researched I believe that ...
1
vote
2answers
53 views

JSON REST Responses and Embedded Objects

I've been doing some research on RESTful architectures and JSON responses. I'm trying to understand which method of laying out JSON responses is "correct" or if they are both acceptable. For ...
-1
votes
1answer
36 views

Updating entity with REST

I'm looking for the "Holy Grail" (best practise) of how to update an entity with REST? There are three main approaches I've found so far: Always send full entity, regardless what has been changed ...
4
votes
3answers
507 views

Mapping API models(DTOs) to rich domain models

How to implement HTTP's PUT that works with child collections when using DDD's rich domain models? Let's say we've got an aggregate root with a nicely encapsulated collection of items: (I omitted ...
0
votes
1answer
66 views

Dealing with child collections updates in Web API

Let's take some classic enterprise example: Order and OrderItem public class Order { public Guid Id { get; set; } public ICollection<OrderItem> Items { get; set; } } public class ...
0
votes
2answers
85 views

Support multiple request formats for single REST endpoint

I'm building an REST API that exposes a callback method for a 3rd-party service. Let's imagine that there are two similar (but not identical) 3rd-party services. They both call back my API (POST /...
0
votes
2answers
36 views

Web Services with Android and iOS apps

I have a website which uses REST Api for communication. All data retrieval and save happen through Rest Api calls(polyglot environment). Now I am planning to create an Android and iOS app . I have ...
4
votes
2answers
295 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 ...
1
vote
3answers
124 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
189 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 ...
2
votes
3answers
292 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 ...
1
vote
1answer
51 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 ...
2
votes
1answer
100 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 ...
3
votes
1answer
107 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
0answers
47 views

Is there a standard for transmitting credentials using two-factor-authentication?

Wie are currently developing a portal solution. In this portal solution we integrate an authentication service which manages authenticated users. Additionally we integrate another application (...
-1
votes
1answer
221 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
64 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 ...
4
votes
2answers
219 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
40 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
48 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/...
0
votes
2answers
56 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
1answer
47 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 ...
1
vote
2answers
359 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 ...
0
votes
0answers
37 views

Are REST Resources and GraphQL Object Types conceptually equal?

I'm in the process of outlining the intended business logic of a web service. At this point, I'm not too concerned with implementation details. On the contrary, I'm looking for ways to abstract them ...
3
votes
2answers
114 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/...
2
votes
1answer
77 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 ...
7
votes
4answers
328 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 ...
1
vote
2answers
54 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 ...
1
vote
1answer
74 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 ...
0
votes
4answers
279 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 ...
1
vote
0answers
161 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 ...