Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35086 closed enhancement (duplicate)

Use short CURIEs instead of full URIs

Reported by: rmccue's profile rmccue Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: Cc:

Description

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. 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": "..."
            }
        ]
    }
}

Originally https://github.com/WP-API/WP-API/issues/1488

Change History (1)

#1 @danielbachhuber
9 years ago

  • Keywords needs-patch removed
  • Milestone 4.5 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #34729.

I am incapable of using a computer.

Note: See TracTickets for help on using tickets.