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
4
votes
3answers
3k views

Integration Testing: Testing Service to Service

I'm looking for some advice on testing strategies for service to service communication. I have one service (service A) that makes a call to another service (B) - which is a rest API. Both services ...
1
vote
2answers
89 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
38 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 ...
0
votes
1answer
92 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
1answer
2k views

Break up django monolith into microservices

We currently have a big Django web application: all data is centrally managed by the webapp, via models backed by Postgres. We want to offer access to the data in a more decentralized way, and the ...
46
votes
4answers
24k 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 ...
0
votes
1answer
301 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 ...
5
votes
4answers
281 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" : "...
1
vote
2answers
344 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 ...
2
votes
4answers
711 views

Why can't clients query the DB directly using SQL?

Given that a lot of modern web applications just consume JSON data from the sever, what is the point in having a REST api at all instead of just using SQL's query language? Nowadays people are ...
5
votes
3answers
3k views

Is it okay to use static classes while creating a wrapper for REST API?

I am consuming a web service in C# using REST APIs. So, I have created a wrapper classes for each endpoint. It seems like a good idea to implement the wrapper using statics. This makes code look much ...
0
votes
1answer
41 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 ...
2
votes
1answer
132 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
255 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 ...
33
votes
6answers
42k views

Should an HTTP API always return a body?

Is there some sort of standard regarding HTTP API responses? After reading this discourse thread I started to wonder. We are developing our public HTTP JSON API at my work, and we do not return ...
1
vote
3answers
184 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 ...
8
votes
4answers
9k views

Too many REST API calls on a page?

A web app designed with highly modular, small components (in this case using AngularJS directives but could just as easily be WebComponents, ReactJS components, or any other technology). Components ...
1
vote
0answers
64 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 ...
-2
votes
1answer
90 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
415 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 ...
28
votes
4answers
43k views

RESTful API. Should I be returning the object that was created / updated?

I'm designing a RESTful web service using WebApi and was wondering what HTTP responses and response bodies to return when updating / creating objects. For example I can use the POST method to send ...
0
votes
1answer
121 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 ...
54
votes
7answers
45k views

RESTFul: state changing actions

I'am planning to build RESTfull API but there are some architectural questions that are creating some problems in my head. Adding backend bussiness logic to clients is option that I would like to ...
2
votes
2answers
423 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 ...
36
votes
2answers
5k views

What is the proper way to do REST?

Everybody nowadays does SOA, even if some don't actually understand what is all about. So they do it wrong. Using that as an analogy I know what REST is (or at least I think I do) and want to do some ...
2
votes
4answers
161 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 ...
9
votes
2answers
13k views

REST or a message queue in a multi-tier heterogeneous system?

I'm designing a REST API for a three-tier system like: Client application -> Front-end API cloud server -> user's home API server (Home). Home is a home device, and is supposed to maintain connection ...
0
votes
1answer
53 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
95 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 ...
10
votes
4answers
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
186 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 ...
2
votes
2answers
8k views

How do I integrate hibernate and REST web service in java?

I am going to develop which will be web application as well as mobile (android / iOS / windows) application. The database in this application will be managed by Hibernate. Also as it is cross platform ...
1
vote
3answers
54 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:...
0
votes
2answers
78 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
5answers
399 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
1answer
280 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
125 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
1answer
458 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
64 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
302 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
4k views

Making all angular services extend a single base service

In Typescript/Angular 6 (2+), is it considered a good practice to have a base abstract http service from which derives all the application services? for example: //import the angular Http ...etc ...
1
vote
2answers
198 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
125 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 ...
0
votes
2answers
401 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
1answer
380 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 ...
5
votes
3answers
4k views

Is it OK to use email as an identifier in a RESTful URI?

I'm working with a team building a RESTful web service, and our current implementation utilizes the user's email as a unique identifier for the user resource, yielding URIs like the following: https:/...
0
votes
2answers
40 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 ...
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 ...
74
votes
3answers
84k 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?
4
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 ...