Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of the term Resource instead of Route or URL Template #445

Open
lukepuplett opened this issue Jul 19, 2019 · 1 comment
Open

Use of the term Resource instead of Route or URL Template #445

lukepuplett opened this issue Jul 19, 2019 · 1 comment

Comments

@lukepuplett
Copy link

lukepuplett commented Jul 19, 2019

Hello

I like API Blueprint a lot, its so much better than any other API spec language or format because its much more aligned with the REST style. However, its still not quite there, and today I realised what is largely wrong with it.

The term Resource is incorrectly used. Consider that a URL is a URI which uniquely identifies a resource. The whole URL is a resource, such that ://api.net/things?a=1 could be pointing to a summary page of stock prices and ://api.net/things?a=2 could be a photo of a goat.

Therefore the terminology below is misleading or possible just wrong. What this actually is defining is a route or URL template. In some senses, the resources don't exist yet. Resources are born out of the mapping of a URL to code that handles and emits data to the wire.

In my above example, [/things?{id}] would be defined as a single resource. I think this leads to incorrect training of people's mental models of REST and brings about limited designs.

Often I think about a great REST API as being like a great website, driven by links and forms and the processing rules of the HTML media-type, but you'd not design a website in API Blueprint. Why not? If you can answer that then you'll be on your way to improving API Blueprint to be able to design great APIs and maybe great websites.

Thanks, Luke

From docs...

Resource
Within the questions resource group, we have a resource called "Question Collection". This resource allows you to view a list of questions. The heading specifies the URI used to access the resource inside of square brackets at the end of the heading.

Question Collection [/questions]

@lukepuplett
Copy link
Author

lukepuplett commented Jul 19, 2019

By the way, this came to me as I was writing the description underneath a "Resource" declaration heading. I often struggle to write these descriptions, then in a moment of clarity I thought that this thing isn't a resource at all, its a gateway to a whole load of different resources that serve different purposes depending upon the parameters supplied and the HTTP method in use.

My Business [/my-business/dialog?{id,businessType,skip,take}]

Provides resources for ….

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant