Patrick Allaert
Patrick Allaert

Reputation: 1752

RESTful API design: Is providing a specific sub-URI for a specific resource's properties something one should encourage/avoid?

Designing an API as RESTful as possible, I wonder if it is ok to divide a resource with specific sub-URIs.

Let's have the following URIs:

I am about to consider the "is active" status as its own resource:

Any pro's or con's for doing so?

Upvotes: 1

Views: 131

Answers (1)

Eric Stein
Eric Stein

Reputation: 13682

What you're talking about is called a "micro-resource". It's useful for doing partial updates in an idempotent manner. It's not popular in more well-known APIs, but it's certainly a valid design approach.

Upvotes: 1

Related Questions