[wp-trac] [WordPress Trac] #34729: Use short CURIEs instead of full URIs

WordPress Trac noreply at wordpress.org
Wed Nov 18 19:20:49 UTC 2015


#34729: Use short CURIEs instead of full URIs
-------------------------+-----------------------------
 Reporter:  rmccue       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:
 Severity:  normal       |   Keywords:  needs-patch
  Focuses:               |
-------------------------+-----------------------------
 Originally https://github.com/WP-API/WP-API/issues/1488

 One small annoyance in the API right now is that link relations are full
 URIs. In JavaScript, this means that while you have  `_links.self` and
 `_links.author`, you have to do `_links["http://v2.wp-api.org/term"]`.
 This is a bit ugly, and can be confusing.

 We should instead switch to [CURIEs](https://en.wikipedia.org/wiki/CURIE).
 These are an abbreviated form of the full URI that's easier to work with,
 but can be expanded out to the full URI if needed. They look like this:

 {{{
 {
     "_links": {
         "curies": [
             {
                 "name": "wp",
                 "href": "http://v2.wp-api.org/{rel}",
                 "templated": true
             }
         ],

         "wp:term": [
             {
                 "taxonomy": "category",
                 "href": "..."
             },
             {
                 "taxonomy": "post_tag",
                 "href": "..."
             }
         ]
     }
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34729>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list