# Endpoints vs types

**URL:** <https://discuss.jsonapi.org/t/endpoints-vs-types/1265>\
**Category:** Uncategorized\
**Created:** [April 13, 2018, 2:47pm UTC](https://discuss.jsonapi.org/t/endpoints-vs-types/1265 "2018-04-13T14:47:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomaxxl](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Thomaxxl](https://discuss.jsonapi.org/u/Thomaxxl)\
**Post date:** [April 13, 2018, 2:47pm UTC](https://discuss.jsonapi.org/t/endpoints-vs-types/1265/1 "2018-04-13T14:47:59Z")

</div>

should it be possible to infer the endpoint from the type?  
eg. /article for { “type” : “article” }, or can i use /articles for { “type” : “article” }

There’s this line in the spec:

“A server MUST return 409 Conflict when processing a POST request in which the resource object’s type is not among the type(s) that constitute the collection represented by the endpoint.”

Which seems to me a single endpoint may even support multiple types ?

---

<div class="post-metadata">

**Author:** ![michaelhibay](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/michaelhibay/32/405_2.png) [@michaelhibay](https://discuss.jsonapi.org/u/michaelhibay)\
**Post date:** [May 18, 2018, 2:48pm UTC](https://discuss.jsonapi.org/t/endpoints-vs-types/1265/2 "2018-05-18T14:48:37Z")

</div>

To your first question, no. Self link and self link only is used for this. Platform conventions like Ember.js may exist which will allow this kind of inference, but it is not from a {json:api} perspective.

Polymorphism is supported in the spec, and even unrelated json:api types can be in the same collections. This is why it’s important you don’t try to infer any information from coincidental likeness in deployment and documents.

---

<div class="post-metadata">

**Author:** ![Thomaxxl](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Thomaxxl](https://discuss.jsonapi.org/u/Thomaxxl)\
**Post date:** [May 18, 2018, 3:07pm UTC](https://discuss.jsonapi.org/t/endpoints-vs-types/1265/3 "2018-05-18T15:07:46Z")

</div>

Thanks a lot.  
Can you reference where exactly this is specified in the spec please?

---

<div class="post-metadata">

**Author:** ![michaelhibay](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/michaelhibay/32/405_2.png) [@michaelhibay](https://discuss.jsonapi.org/u/michaelhibay)\
**Post date:** [May 18, 2018, 3:40pm UTC](https://discuss.jsonapi.org/t/endpoints-vs-types/1265/4 "2018-05-18T15:40:16Z")

</div>

It’s an area where the spec can be improved. The best is essentially proof by counter example. In the member names section the part “To enable an easy mapping” introduces the casual relationship between type and URL, and requires an understanding of the context - this is an ember convention - included by one of the {json:api} authors (Yehuda) who happens to be the author of ember as well. Sadly, this and a few other conventions portrayed as requirements cause a bunch of problems for people learning the spec who don’t use ember.

The rest of the conclusion stems from the opacity requirements of URLs in HTTP, and the polymorphic support you have already linked.

If your server implementation can’t support obfuscating resource collection root URLs, I would strongly argue the implementation is not fully compliant, and is likely making other assumptions which will break fully compliant libraries.
