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.

1
vote
4answers
65 views

Difference between REST & HTTP REST implementations

REST principles are described here: https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2 https://en.wikipedia.org/wiki/Representational_state_transfer#...
1
vote
1answer
42 views

Is GraphQL REST compliant (almost)?

I am writing an article about traditional REST vs GraphQL. However, after doing some research about REST (not just a specific implementation of REST), I started to see that GraphQL actually abides to ...
0
votes
2answers
37 views

How do job queues return results to UI?

I am working on an app that will run queries and return results to UI. However, these queries can take a long time to finish so I should not wait for the result. As far as I know, people use task ...
1
vote
1answer
51 views

Communication in a microservices architecture with flask and REST

Components involved: Mobile Client Microservices API Gateway Each microservice is a Flask application exposing a RESTful API. When a request is made by the mobile client, it is sent to the API ...
2
votes
0answers
24 views

Handling field masks on the statically typed client

Let's say I have a REST API, that has the ability to provide field mask (i.e. the API can return M out of N attributes where M is a subset of N). If a statically typed client (example: one that's ...
1
vote
0answers
13 views

Listing all sub-resources without parent scope

Let's say I have User resource which has Address sub-resource (let's forget about why this is a resource instead of attribute). To get a user's address, I can do GET /users/{id}/address Now I want to ...
0
votes
0answers
38 views

Any solution for scheduling a “high volume traffic” mode on API?

I have been wondering if there is any way to design and develop a mechanism for a REST API for scheduling some sort of "high volume" traffic so it does not conflict with normal rate-limiting. This ...
1
vote
2answers
75 views

API design - indicate that results were truncated

For reasons, my search endpoint returns a maximum of 50 results. I'm struggling with how best to tell the caller that their results were limited to 50. The best I've come up with is returning some ...
0
votes
0answers
31 views

How to properly structure a REST API for other sites to use that has user accounts?

I need to build a REST/HTTP API that has user accounts that other sites can use. It is my understanding that it is incorrect for the other sites(that use our API) to use a password field to allow ...
1
vote
5answers
154 views

Correct usage of HTTP VERBS in custom REST implementation

I have a server-side service (using ASP.NET Core) that should provide a REST API to various clients. Behind the service, I use a SQL server for data storage. The controller has the following route ...
-1
votes
0answers
31 views

Can API authorization relay on api contract?

an example: user authenticated with token, some property in contract must be witihin the set user is allowed to send, like order type 1, 2, or 3. User sends 4 which is also possible, but not for him, ...
0
votes
1answer
60 views

Best route naming convention when a RESTful GET needs to be a POST

I have a REST API that has been built on top (in front of) a legacy system, to allow 3rd parties of various platforms to interact with the system. Most of the time, I can define a resource and create ...
0
votes
0answers
21 views

Service Design - Data-orientation vs. Role/Goal-orientation

For a simple web application, I am designing web services to expose the application functionality (mostly data storage / retrieval, but also data processing). As the application is not too complex, I ...
0
votes
1answer
49 views

Point-to-Point integration vs ESB

We have a system which has been in development for 10+ years and still continues. It is built as an SOA and use SOAP. We have a new client, internally within our company, who wants to integrate with ...
-3
votes
1answer
82 views

Correct response for API, 404 or {response: “not found” } [closed]

I'm not sure on the correct procedure for returning a status code for a GET request in a RESTful API request. Lets say I make a get request to get a users details from the server. However that user ...
1
vote
2answers
189 views

Why should I follow the standard REST API best practices/guidelines?

I found the standard REST API best practices to be very confusing, because you need to know all the HTTP methods such as GET/POST/PUT/DELETE/PATCH etc. Not only that, while calling an API, you might ...
-1
votes
0answers
42 views

Using Websockets with RESTful API

I've seen many apps use two separate servers to handle traffic. These services have a RESTful HTTP api server AND a websocket gateway. I guess I'm not sure how the websocket gateway interacts with ...
0
votes
1answer
33 views

What to include in a (Batch) POST/PATCH results/errors for results for pragmatic REST API

This is really a question about "best" or "practical" practices, and would be interested if anyone else has had a similar need as myself, and how they handled it. I have a REST(ish) API that we have ...
3
votes
1answer
121 views

Best practice for REST result payload when field may have single or multiple values

I Have a REST API endpoint where the caller can supply some optional filters for the results. GET api/inventory For example, an object member of a GET request may look like the following { "...
1
vote
2answers
83 views

Security Issues with RESTful Authentication & Session Management

I'm trying to implement authentication and session management for a microservice. In order to do the process RESTfully, I understand that I'll need to use some kind of token-based authentication to ...
1
vote
3answers
180 views

How can I represent something like “latest news” in REST api?

Can't figure out how. 1) Resource identification. How do I identify the resource? Something like this? /latest_news/<id> That doesn't seem right. 2) Now suppose you have a URL for the ...
1
vote
0answers
36 views

How to define REST endpoint for subresource of not saved resource

I have REST API for my SPA application. My domain model has Order entity, it has Commission property which calculated on backend, it is number value For get Order entity SPA calls this endpoint, this ...
-3
votes
1answer
53 views

Monitoring my REST API service

I have a REST API. I want to monitor it -- that it's always up. That's the canonical way to ping it? Especially when all of its calls require an API key. Should I create an empty open end point ...
4
votes
5answers
383 views

Should we tailor APIs to the customer, or ask the customer to use the existing one?

I am a sole developer and I recently wrote a new web application in the form of a API with Swagger and front-end. This was customers could use the API on their own, usually forscripting. It is ...
0
votes
1answer
99 views

REST API with 1000 query templates?

How do I manage maybe 1000 SQL-queries in a Golang REST API? My SQL experience is at the upper basic level using Postgresql. I am today using a tool that you can use plain SQL as well as sort of ORM ...
0
votes
0answers
41 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
142 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
49 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
94 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 ...
1
vote
2answers
144 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
48 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
169 views

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
101 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
73 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 ...
5
votes
4answers
176 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" : "...
0
votes
1answer
257 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
106 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
364 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
122 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
236 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
53 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
64 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
58 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
42 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
534 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
83 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
131 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 /...
-1
votes
2answers
38 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
602 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 ...