[wp-trac] [WordPress Trac] #37182: Collections are not compatible to HAL standard
WordPress Trac
noreply at wordpress.org
Sun Jun 26 12:49:59 UTC 2016
#37182: Collections are not compatible to HAL standard
--------------------------+-----------------------------
Reporter: maennchen | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The HAL specification is quite clear on the definition of an HAL resource:
''Its root object MUST be a Resource Object.''
The current API does clearly violate the standard for all collections.
If an API complies with the standard, the root would be an object, which
contains links to the elements and mostly also embeds them.
Problems because of the violation of the standard:
- The API is not consumable for standard HAL clients. If the API complies
with the standard, no dedicated client libraries have to be written for
wordpress. All HAL clients can be used instead.
Advantages by using the standard:
- Additional Information on the collection can be saved inside of the
collection. This way things like totals, page counts etc. can be delivered
easily. (No custom Headers, like they are used for X-WP-Total)
- Links for the next, previous, first and last page can be added to the
collection. That way the client doesn't has to generate the url's himself.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37182>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list