fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

@ardalis It is good advice about designing resources. It would be nice though if folks could stop creating "REST API" strawmen to knock down.

@ardalis I don't feel like it had any tips on how the dtos should be structured - but more a general argument for using dto.

But isn't that kind of thinking old news? (I'm not talking about the article date.

I haven't worked a place where new projects didn't naturally utilise dtos, without anyone having to make an argument for it.

@mortentoudahl the argument or trade off is between custom dto per endpoint or per client need vs REST resource representations, IME. Article makes a good case for framing that trade off.

@ardalis I had never heard of a dto API (although I use the term dto regularly). I can't tell if what I'm writing would be termed DTO or REST by the author on first read.

@ardalis let me state that as a question. Can. REST API return a DTO? What makes it not REST if I return a DTO?

@TimPurdum Yes anything being passed around over http is a DTO. I think the distinction being made is whether the DTO represents the current state of a resource or not. REST would suggest it should, but sometimes some ad hoc data from one or more resources is needed by a client, and it can be efficient and effective to expose less “RESTful” endpoints that return the non-resource DTOs.