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

What is a proper response status code to POST when parent resource is not found?

I've the following endpoint: a/{id}/b and want to create a b with sending POST request to it. If a with given {id} is not found should I response with 404 NOT_FOUND or maybe with 409 CONFLICT? It ...
9
votes
3answers
365 views

Is it bad practice for an API object definition to contain 3rd party reference Id's as properties?

Like this: Campaign: type: object properties: id: type: string description: "A GUID identifier" referenceId: type: string description: "A consumers identifier they have used to ...
9
votes
3answers
1k views

In REST parlance what is the difference between a resource and a representation?

My understanding of REST that is enables modelling service operations as representation of state and transition from one state to another making use of HTTP. I have always understood resources as ...
9
votes
2answers
309 views

Adding to a finite set of options; an API breaking change?

Take an HTTP API endpoint which spits out the following response model: { "type": "Dog", "name": "Jessi", ... } The type field has been described in the documentation as being one of Dog,...
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 ...
9
votes
2answers
6k views

Can a REST API return multiple resources as one single compound resource?

I'm in the progress of creating a REST API and currently, I'm encountering the following problem: Foo is the first resource. CRUD operations can be applied via the /foo/ URI. Bar is the second ...
9
votes
4answers
10k views

Why REST Api do not follow the Facade design pattern

In comparing REST [api] structure with a OO model, I see these similarities: Both: Are data oriented REST = Resources OO = Objects Surround operation around data REST = surround VERBS (Get, ...
9
votes
2answers
2k views

Enterprise patterns for JWT authentication for REST-based application?

The JWT specification describes only the payload and how it is sent, but leaves authentication protocol open, which allows the flexibility, but quite unfortunately, flexibility can lead to ...
9
votes
3answers
4k views

Is REST only limited to optimistic concurrency control?

Context Due to the statelessness of the REST architectural style involving that each requests stands completely alone, leading server to never store any informations about client. Thus, pessimistic ...
9
votes
3answers
6k views

Creating an entity relationship in REST: May I create the parent by posting to a child id?

We are currently designing a REST API to access classical customer data. One of the elements in the API are the assets of an user. The assets are added under a given service. The backend API will ...
9
votes
2answers
3k 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 ...
9
votes
2answers
2k views

RESTful reference representations - semantic link vs uri

We're designing a RESTful API to open up our customer's account information. We have representations that contain references to other resources related to the current resource. This is from a number ...
9
votes
3answers
2k views

In a loosely coupled microservices architecture, how do you keep track of your dependencies?

A popular high level architecture choice in modern program is a REST-based microservices system. This has several advantages such as loose coupling, easy re-use, limited restriction on technologies ...
9
votes
3answers
887 views

Should one generally develop a client library for REST services to help prevent API breakages?

We have a project where UI code will be developed by the same team but in a different language (Python/Django) from the services layer (REST/Java). The code for each layer exits in different code ...
8
votes
5answers
885 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 ...
8
votes
4answers
30k views

MVC and RESTful API service

MVC is pretty straightforward. There is a Model, a Controller and a View. When we create a website, it all come together as 'client sends REST keyword request to server -> the server matches the ...
8
votes
6answers
1k views

What was SOAP invented for?

This question is inspired by this one. What was the initial goal of inventing SOAP? Why was it invented when we had old kind HTTP and REST?
8
votes
2answers
594 views

What does “HATEOAS” have to do with Application State?

HATEOAS is an acronym for "Hypermedia As The Engine Of Application State". What is the "Engine of Application State" referring to, and particularly - how is "hypermedia" the engine of it? As far as I ...
8
votes
4answers
6k views

Is it a good practice to make API response list of values as dictionary?

I have an API endpoint that returns some statistics. Currently the response looks like: Option 1: { "stats": [ { "name": "some-stats-key1", ...
8
votes
5answers
4k views

How to design a complex REST API considering DB performance?

I've been following some tutorials on how to design REST APIs, but I still have some big questions marks. All these tutorials show resources with relatively simple hierarchies, and I would like to ...
8
votes
5answers
528 views

Consequences of not doing a REST API the “right” way?

I'll ask this question this way - what are the software engineering concerns for not implementing my REST API the "right" way? What do you mean the "right" way? Well, allow me to explain my ...
8
votes
3answers
690 views

What is the right HTTP method for upvoting?

From a RESTful point of view, what is the most appropriate HTTP method for the action of upvoting a forum post (like on StackExchange)? I would say POST for voting and DELETE for canceling vote, but ...
8
votes
3answers
2k views

What are the benefits of a RESTful web service?

Academic task… First we were told to generate a set of static .html files showing election results in various administrative divisions. Then we were told to "modernize" this by using Django templates. ...
8
votes
3answers
9k views

Documenting a REST interface with a flowchart

Does anybody have suggestions on creating a flowchart representation of a REST-style web interface? In the interest of supplying thorough documentation to co-developers, I've been toying around in dia ...
8
votes
2answers
6k views

Can REST API be used as business layer?

I am using PHP Codeigniter MVC design pattern and I had this project with some sort of specific business processes In my application I will be dealing with 2 existing REST APIs: Google Trello I ...
8
votes
2answers
2k views

REST vs RPC for mobile development

As many know, mobile development is skyrocketing these days and, I believe, it affects what we code. To be specific, I am interested in developing web services for a mobile application. I see two ...
8
votes
3answers
3k views

REST API authorization strategies

There are a lot of questions on here that deal with the mechanics of authentication and authorization of RESTful APIs but none of them appear to go in to details of how to implement secure services at ...
8
votes
3answers
12k views

REST API vs directly DB calls in Desktop Application

I am currently planing an application that will be used in a company. It is required to build a Desktop Application. At the moment they are not sure if the application should be available on mobile or ...
8
votes
2answers
4k views

Rest design - Multiple calls vs returning all data in one call

I am trying to build a rest API for an android app. Suppose I have a users table with (id, name, email) and a songs table with (id, song_name, album) and a rich join association between them as ...
8
votes
2answers
4k views

Should I specify the userId in the REST URL structure?

Basically, one feature of my app is to retrieve the logged user's friends. Actually, I hesitate between both kind of endpoints: GET /api/users/friends GET /api/users/:userId/friends Using 1, ...
8
votes
4answers
16k views

Always return single objects in an array for REST API JSON payloads?

For a REST API that I am working on, I want to return JSON in a consistent layout: { "Data" : { "Id" : 123, "Email" : "charlie@somewhere.com" "Firstname" : "Charlie", "Surname" :...
8
votes
2answers
399 views

“REST Vs GraphQL” is it a correct comparison?

I saw in many sites that compare REST with GraphQL. after investigating this concern (actually my concern) that, "is it a correct comparison?", I being more confused. Since the REST has a different ...
8
votes
2answers
15k 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 ...
8
votes
1answer
1k views

By the book REST vs Too Many Requests

From Roy Fielding's comment on his own article decrying fake REST apis: A truly RESTful API looks like hypertext. Every addressable unit of information carries an address, either explicitly (e.g.,...
8
votes
3answers
2k views

Proper Response to HTTP Request When Too Much Data is Requested

I'm building an API for an ad serving platform that will allow you to request tracker data for ad campaigns. Campaigns often exceed hundreds of millions of requests, which means there will be many ...
8
votes
2answers
5k views

“Invalid operation” status code in a HATEOAS REST API

In a HATEOAS API links are returned which represent possible state transitions. A conforming client should just be retrieving and following those links, but if a non-conforming client is constructing ...
8
votes
1answer
14k views

Base64 in Json: Is it a Good Idea for Rest API?

I am developing a Rest API, and I am asking myself: Is it a good Idea to put base64 encoded data in Json, e.g. for file uploads? What if the base64 contains some of {,},: characters and breaks the ...
8
votes
2answers
1k views

Partitioning REST API resources into areas based on business domains

In a major application REST API that covers several related domains, does it make more sense to split resources into 'areas' based on the business domain they belong to or is it better to to maintain ...
8
votes
5answers
1k views

Rest API Design - Work with IDs or Literal Strings?

When designing a RESTful Web Service should the API be designed to work ID for Strings for values passed back and forth between the server? Here's an example: Let's say I have an Employee resource, ...
8
votes
1answer
1k views

Paging Strategies : Page Token vs Skip/Start Index

I am seeing that more and more new APIs use page tokens to let the user move between the pages of results containing a lot of items. However from an API designer point of view I'm not clear on what ...
8
votes
4answers
10k 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 ...
8
votes
2answers
17k views

HTTP Response Header for a unique Request ID for REST service

For our REST service I want to send back a unique request ID with every response; useful for debugging internal projects but also for offering support to any third parties who might use the service in ...
8
votes
2answers
1k views

Grouping and nesting of REST APIs

My question is around best practice of aggregating or grouping REST APIs. I have a scenario where there are many different vendors, data sources, etc. and I think grouping REST APIs would make a lot ...
8
votes
2answers
935 views

Is this solution RESTful and secure?

Our product registers new players on our service, and we've chosen to host it on Azure (we're using .NET) and we wanted it to be stateless (for scalability) and relatively secure. Since this is the ...
8
votes
1answer
3k views

Token-based authentication using access and refresh tokens

I am implementing a token-based authentication system for a REST API using a short-lived access token and a long-lived refresh token. This is an abstract overview of the relevant API endpoints (HTTPS ...
8
votes
3answers
1k views

Best solution to authorize that a user is only allowed to modify/act with their own resources in a REST API

Background: Currently in the process of building out a REST API, using node w/express and it is consumed by a mobile app and eventually a (modern browser based) website. I'm trying to identify the ...
8
votes
1answer
6k views

How to translate SQL query into REST API requests?

Let's say I have a machine-readable description (such as in WADL, Swagger or RAML) of a REST API that provides interface to a database. My users submit queries about underlying database in form of ...
7
votes
3answers
9k views

POST and PUT requests – is it just the convention?

I've read quite a few articles on the difference between POST and PUT and in when the two should be used. But there are still few things confusing me ( hopefully questions will make some sense ): 1) ...
7
votes
3answers
11k 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. ...
7
votes
2answers
4k views

Best practice to handle POST with array of objects if at least one object raise an Exception

I want to POST an array of objects and make an insertion in database concerning each of them. What is the best practice if one object does not conform and raise an Exception? (cancel all transactions ...