ResourceTypes and how you use them?


#1

Hi,

I am currently trying to see how the community is using resource-types in their API definition, or if they even use it and if not why?

Any comments are very welcome!

Cheers,
Christian


#2

I’ve found resource-types to be very useful for composing traits and also for resource/schema associations.

Check this API definition I’ve worked on: http://schemas.unbounce.net/raml/?raml=http://api.unbounce.com/raml/v0.4/api.raml

Not sure how I would have done that without resource types… lots of copy/pasting?


#3

We are using RAML extensively for Talent App Store. RAML is awesome.

For our core APIs (http://talentappstore.github.io/tas-core-apis/) we have not found the need for resource types yet though we do use traits.

It seems to me that resource types may be more useful in business style APIs where there are multiple ways to access resources? e.g.:

GET /widgets/byColor/{color}
GET /widgets/bySize/{size}
GET /widgets/byWeight/{weight}

In this case there are lots of ways to reach the same resource - a set of widgets. From what I know of resource types they would be useful to avoid duplication here.


#4

Awesome, thank you guys - hope to get more of these brilliant examples of how to use them correctly.