Implementation

The v2 API implements the JSON API v1.0 specification. This section shows how to interact with the API, and the next section gives the details of the resources available through the API.

Resources

Resources are identified by a plural noun. The list of resources, available at https://browsercompat.herokuapp.com/api/v2, include:

  • browsers - A brand of web client with one of more versions
  • versions - A specific release of a browser
  • features - A web technology
  • supports - Support details of a version for a feature
  • specifications - A document specifying a web technology
  • maturities - The state of a specification in the standardization process
  • sections - A section of a specification
  • references - The link from a section to a feature
  • changesets - A collection of one or more data changes
  • users - API users
  • historical_browsers - A change to a browser resource
  • historical_versions - A change to a version resource
  • historical_features - A change to a feature resource
  • historical_supports - A change to a support resource
  • historical_specifications - A change to a specification resource
  • historical_maturities - A change to a maturity resource
  • historical_sections - A change to a section resource

There is also a view that combines related resources:

  • view_features - A feature combined with related resources.

List

To request a paginated list of a resource, GET the resource by name:

GET /api/v2/browsers HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json

A sample response is:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/browsers",
        "next": "https://browsercompat.org/api/v2/browsers?page=2",
        "prev": null
    },
    "data": [
        {
            "type": "browsers",
            "id": "1",
            "attributes": {
                "slug": "android",
                "name": {
                    "en": "Android Browser"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "1"
                        },
                        {
                            "type": "versions",
                            "id": "2"
                        },
                        {
                            "type": "versions",
                            "id": "3"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "1"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "1"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/1"
            }
        },
        {
            "type": "browsers",
            "id": "2",
            "attributes": {
                "slug": "android_webview",
                "name": {
                    "en": "Android Webview"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "4"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "2"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "2"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/2"
            }
        },
        {
            "type": "browsers",
            "id": "3",
            "attributes": {
                "slug": "blackberry",
                "name": {
                    "en": "BlackBerry Browser"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "5"
                        },
                        {
                            "type": "versions",
                            "id": "6"
                        },
                        {
                            "type": "versions",
                            "id": "7"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "3"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "3"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/3"
            }
        },
        {
            "type": "browsers",
            "id": "4",
            "attributes": {
                "slug": "chrome_desktop",
                "name": {
                    "en": "Chrome for Desktop"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "8"
                        },
                        {
                            "type": "versions",
                            "id": "9"
                        },
                        {
                            "type": "versions",
                            "id": "10"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "4"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "4"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/4"
            }
        },
        {
            "type": "browsers",
            "id": "5",
            "attributes": {
                "slug": "chrome_for_android",
                "name": {
                    "en": "Chrome for Android"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "11"
                        },
                        {
                            "type": "versions",
                            "id": "12"
                        },
                        {
                            "type": "versions",
                            "id": "13"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "5"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "5"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/5"
            }
        },
        {
            "type": "browsers",
            "id": "6",
            "attributes": {
                "slug": "firefox_android",
                "name": {
                    "en": "Firefox for Android"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "14"
                        },
                        {
                            "type": "versions",
                            "id": "15"
                        },
                        {
                            "type": "versions",
                            "id": "16"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "6"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "6"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/6"
            }
        },
        {
            "type": "browsers",
            "id": "7",
            "attributes": {
                "slug": "firefox_desktop",
                "name": {
                    "en": "Firefox for Desktop"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "17"
                        },
                        {
                            "type": "versions",
                            "id": "18"
                        },
                        {
                            "type": "versions",
                            "id": "19"
                        },
                        {
                            "type": "versions",
                            "id": "20"
                        },
                        {
                            "type": "versions",
                            "id": "21"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "7"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "7"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/7"
            }
        },
        {
            "type": "browsers",
            "id": "8",
            "attributes": {
                "slug": "firefox_os",
                "name": {
                    "en": "Firefox OS"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "22"
                        },
                        {
                            "type": "versions",
                            "id": "23"
                        },
                        {
                            "type": "versions",
                            "id": "24"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "8"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "8"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/8"
            }
        },
        {
            "type": "browsers",
            "id": "9",
            "attributes": {
                "slug": "ie_desktop",
                "name": {
                    "en": "Internet Explorer for Desktop"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "25"
                        },
                        {
                            "type": "versions",
                            "id": "26"
                        },
                        {
                            "type": "versions",
                            "id": "27"
                        },
                        {
                            "type": "versions",
                            "id": "28"
                        },
                        {
                            "type": "versions",
                            "id": "29"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "9"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "9"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/9"
            }
        },
        {
            "type": "browsers",
            "id": "10",
            "attributes": {
                "slug": "ie_mobile",
                "name": {
                    "en": "Internet Explorer Mobile"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "30"
                        },
                        {
                            "type": "versions",
                            "id": "31"
                        },
                        {
                            "type": "versions",
                            "id": "32"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "10"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "10"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/10"
            }
        }
    ],
    "meta": {
        "count": 15
    }
}

Retrieve by ID

To request a single resource, GET by name and ID.

Note: bug 1230306 proposes switching IDs to UUIDs.

Here’s an example:

GET /api/v2/browsers/7 HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json

A sample response is:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/browsers/7"
    },
    "data": {
        "type": "browsers",
        "id": "7",
        "attributes": {
            "slug": "firefox_desktop",
            "name": {
                "en": "Firefox for Desktop"
            },
            "note": null
        },
        "relationships": {
            "versions": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/7/relationships/versions",
                    "related": "https://browsercompat.org/api/v2/browsers/7/versions"
                },
                "data": [
                    {
                        "type": "versions",
                        "id": "17"
                    },
                    {
                        "type": "versions",
                        "id": "18"
                    },
                    {
                        "type": "versions",
                        "id": "19"
                    },
                    {
                        "type": "versions",
                        "id": "20"
                    },
                    {
                        "type": "versions",
                        "id": "21"
                    }
                ]
            },
            "history_current": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/7/relationships/history_current",
                    "related": "https://browsercompat.org/api/v2/browsers/7/history_current"
                },
                "data": {
                    "type": "historical_browsers",
                    "id": "7"
                }
            },
            "history": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/7/relationships/history",
                    "related": "https://browsercompat.org/api/v2/browsers/7/history"
                },
                "data": [
                    {
                        "type": "historical_browsers",
                        "id": "7"
                    }
                ]
            }
        }
    }
}

Filter by attribute

Note: bug 1078699 proposes an alternate URL format for retrieving by slug.

Resources can be filtered by an attribute value, using a filter query string:

GET /api/v2/browsers?filter[slug]=firefox_desktop HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json

The response includes the desired browser, in list format:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/browsers?filter[slug]=firefox_desktop",
        "next": null,
        "prev": null
    },
    "data": [
        {
            "type": "browsers",
            "id": "7",
            "attributes": {
                "slug": "firefox_desktop",
                "name": {
                    "en": "Firefox for Desktop"
                },
                "note": null
            },
            "relationships": {
                "versions": {
                    "data": [
                        {
                            "type": "versions",
                            "id": "17"
                        },
                        {
                            "type": "versions",
                            "id": "18"
                        },
                        {
                            "type": "versions",
                            "id": "19"
                        },
                        {
                            "type": "versions",
                            "id": "20"
                        },
                        {
                            "type": "versions",
                            "id": "21"
                        }
                    ]
                },
                "history_current": {
                    "data": {
                        "type": "historical_browsers",
                        "id": "7"
                    }
                },
                "history": {
                    "data": [
                        {
                            "type": "historical_browsers",
                            "id": "7"
                        }
                    ]
                }
            },
            "links": {
                "self": "https://browsercompat.org/api/v2/browsers/7"
            }
        }
    ],
    "meta": {
        "count": 1
    }
}

Fetch Relationships

Alternatively, just the data for a relationship can be retrieved using the “self” link of related resources:

GET /api/v2/browsers/7/relationships/versions HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json

The response just includes the types and IDs of the related resources:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/browsers/7/relationships/versions",
        "related": "https://browsercompat.org/api/v2/browsers/7/versions"
    },
    "data": [
        {
            "type": "versions",
            "id": "17"
        },
        {
            "type": "versions",
            "id": "18"
        },
        {
            "type": "versions",
            "id": "19"
        },
        {
            "type": "versions",
            "id": "20"
        },
        {
            "type": "versions",
            "id": "21"
        }
    ]
}

Create a Single Resource

To create a new resource, POST to the resource list as an authenticated user. The POST body must include at least the required attributes. Some items (such as the history_current ID) will be picked by the server, and will be ignored if included.

Here is an example creating a browser with minimal data:

POST /api/v2/browsers HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 206
Content-Type: application/vnd.api+json
{
    "data": {
        "type": "browsers",
        "attributes": {
            "slug": "amazon-silk-mobile",
            "name": {
                "en": "Amazon Silk Mobile"
            }
        }
    }
}

A sample response is:

HTTP/1.1 201 CREATED
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/browsers"
    },
    "data": {
        "type": "browsers",
        "id": "16",
        "attributes": {
            "slug": "amazon-silk-mobile",
            "name": {
                "en": "Amazon Silk Mobile"
            },
            "note": null
        },
        "relationships": {
            "versions": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/relationships/versions",
                    "related": "https://browsercompat.org/api/v2/browsers/versions"
                },
                "data": []
            },
            "history_current": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/relationships/history_current",
                    "related": "https://browsercompat.org/api/v2/browsers/history_current"
                },
                "data": {
                    "type": "historical_browsers",
                    "id": "16"
                }
            },
            "history": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/relationships/history",
                    "related": "https://browsercompat.org/api/v2/browsers/history"
                },
                "data": [
                    {
                        "type": "historical_browsers",
                        "id": "16"
                    }
                ]
            }
        }
    }
}

Create Multiple Resources

When creating several resources, the changes can be associated by first creating a changeset:

POST /api/v2/changesets HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 115
Content-Type: application/vnd.api+json
{
    "data": {
        "type": "changesets",
        "attributes": {
            "closed": false
        }
    }
}

A sample response is:

HTTP/1.1 201 CREATED
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/changesets"
    },
    "data": {
        "type": "changesets",
        "id": "4",
        "attributes": {
            "created": "2016-01-08T22:22:22.292921Z",
            "modified": "2016-01-08T22:22:33.916387Z",
            "closed": false,
            "target_resource_type": null,
            "target_resource_id": null
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/user",
                    "related": "https://browsercompat.org/api/v2/changesets/user"
                },
                "data": {
                    "type": "users",
                    "id": "1"
                }
            },
            "historical_browsers": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_browsers",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_browsers"
                },
                "data": []
            },
            "historical_features": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_features",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_features"
                },
                "data": []
            },
            "historical_maturities": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_maturities",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_maturities"
                },
                "data": []
            },
            "historical_references": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_references",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_references"
                },
                "data": []
            },
            "historical_sections": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_sections",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_sections"
                },
                "data": []
            },
            "historical_specifications": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_specifications",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_specifications"
                },
                "data": []
            },
            "historical_supports": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_supports",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_supports"
                },
                "data": []
            },
            "historical_versions": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/relationships/historical_versions",
                    "related": "https://browsercompat.org/api/v2/changesets/historical_versions"
                },
                "data": []
            }
        }
    }
}

The changeset can then be specified as a query parameter:

POST /api/v2/browsers?use_changeset=4 HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 298
Content-Type: application/vnd.api+json
{
    "data": {
        "type": "browsers",
        "attributes": {
            "slug": "nintendo-ds",
            "name": {
                "en": "Nintendo DS Browser",
                "ja": "\u30cb\u30f3\u30c6\u30f3\u30c9\u30fc\uff24\uff33\u30d6\u30e9\u30a6\u30b6"
            }
        }
    }
}

A sample response is:

HTTP/1.1 201 CREATED
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/browsers?use_changeset=4"
    },
    "data": {
        "type": "browsers",
        "id": "18",
        "attributes": {
            "slug": "nintendo-ds",
            "name": {
                "en": "Nintendo DS Browser",
                "ja": "ニンテンドーDSブラウザ"
            },
            "note": null
        },
        "relationships": {
            "versions": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/relationships/versions",
                    "related": "https://browsercompat.org/api/v2/browsers/versions"
                },
                "data": []
            },
            "history_current": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/relationships/history_current",
                    "related": "https://browsercompat.org/api/v2/browsers/history_current"
                },
                "data": {
                    "type": "historical_browsers",
                    "id": "18"
                }
            },
            "history": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/relationships/history",
                    "related": "https://browsercompat.org/api/v2/browsers/history"
                },
                "data": [
                    {
                        "type": "historical_browsers",
                        "id": "18"
                    }
                ]
            }
        }
    }
}

Finally, close the changeset, which is now associated with the historical resources:

PATCH /api/v2/changesets/4 HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 114
Content-Type: application/vnd.api+json
{
    "data": {
        "type": "changesets",
        "attributes": {
            "closed": true
        }
    }
}

The response includes relationships to the items created in the changeset:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/changesets/4"
    },
    "data": {
        "type": "changesets",
        "id": "4",
        "attributes": {
            "created": "2016-01-08T22:22:46.419281Z",
            "modified": "2016-01-08T22:22:54.978989Z",
            "closed": true,
            "target_resource_type": null,
            "target_resource_id": null
        },
        "relationships": {
            "user": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/user",
                    "related": "https://browsercompat.org/api/v2/changesets/4/user"
                },
                "data": {
                    "type": "users",
                    "id": "1"
                }
            },
            "historical_browsers": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_browsers",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_browsers"
                },
                "data": [
                    {
                        "type": "historical_browsers",
                        "id": "18"
                    }
                ]
            },
            "historical_features": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_features",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_features"
                },
                "data": []
            },
            "historical_maturities": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_maturities",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_maturities"
                },
                "data": []
            },
            "historical_references": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_references",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_references"
                },
                "data": []
            },
            "historical_sections": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_sections",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_sections"
                },
                "data": []
            },
            "historical_specifications": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_specifications",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_specifications"
                },
                "data": []
            },
            "historical_supports": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_supports",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_supports"
                },
                "data": []
            },
            "historical_versions": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/changesets/4/relationships/historical_versions",
                    "related": "https://browsercompat.org/api/v2/changesets/4/historical_versions"
                },
                "data": []
            }
        }
    }
}

Update a resource

To update a resource with new data, PATCH the instance with the new data. Omitted items with keep their old values. For each resource, there are some items that can not be changed (for example, the id or the history relationship IDs), and will be ignored if included in the update request. A successful update will return a 200 OK, add a new ID to the history relationship, and update the history_current relationship.

Here’s an example of updating a browser:

PATCH /api/v2/browsers/9 HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 167
Content-Type: application/vnd.api+json
{
    "data": {
        "type": "browsers",
        "id": "9",
        "attributes": {
            "name": {
                "en": "IE"
            }
        }
    }
}

With this response:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/browsers/9"
    },
    "data": {
        "type": "browsers",
        "id": "9",
        "attributes": {
            "slug": "ie_desktop",
            "name": {
                "en": "IE"
            },
            "note": null
        },
        "relationships": {
            "versions": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/9/relationships/versions",
                    "related": "https://browsercompat.org/api/v2/browsers/9/versions"
                },
                "data": [
                    {
                        "type": "versions",
                        "id": "25"
                    },
                    {
                        "type": "versions",
                        "id": "26"
                    },
                    {
                        "type": "versions",
                        "id": "27"
                    },
                    {
                        "type": "versions",
                        "id": "28"
                    },
                    {
                        "type": "versions",
                        "id": "29"
                    }
                ]
            },
            "history_current": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/9/relationships/history_current",
                    "related": "https://browsercompat.org/api/v2/browsers/9/history_current"
                },
                "data": {
                    "type": "historical_browsers",
                    "id": "20"
                }
            },
            "history": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/browsers/9/relationships/history",
                    "related": "https://browsercompat.org/api/v2/browsers/9/history"
                },
                "data": [
                    {
                        "type": "historical_browsers",
                        "id": "20"
                    },
                    {
                        "type": "historical_browsers",
                        "id": "19"
                    },
                    {
                        "type": "historical_browsers",
                        "id": "9"
                    }
                ]
            }
        }
    }
}

Update a one-to-many relationship

Some relationships are one-to-many, and the relationship appears on both sides. For example, a specification has one maturity, but a maturity can be related to several specifications. To update these relationships, PATCH the “to-one” relationship (maturity) on the “many” resource (specification):

PATCH /api/v2/specifications/7 HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 250
Content-Type: application/vnd.api+json
{
    "data": {
        "type": "specifications",
        "relationships": {
            "maturity": {
                "data": {
                    "type": "maturities",
                    "id": "5"
                }
            }
        }
    }
}

A sample response is:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/specifications/7"
    },
    "data": {
        "type": "specifications",
        "id": "7",
        "attributes": {
            "slug": "css3-ruby",
            "mdn_key": "CSS3 Ruby",
            "name": {
                "en": "CSS Ruby Layout Module Level 1"
            },
            "uri": {
                "en": "http://dev.w3.org/csswg/css-ruby/"
            }
        },
        "relationships": {
            "maturity": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/specifications/7/relationships/maturity",
                    "related": "https://browsercompat.org/api/v2/specifications/7/maturity"
                },
                "data": {
                    "type": "maturities",
                    "id": "5"
                }
            },
            "sections": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/specifications/7/relationships/sections",
                    "related": "https://browsercompat.org/api/v2/specifications/7/sections"
                },
                "data": []
            },
            "history_current": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/specifications/7/relationships/history_current",
                    "related": "https://browsercompat.org/api/v2/specifications/7/history_current"
                },
                "data": {
                    "type": "historical_specifications",
                    "id": "8"
                }
            },
            "history": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/specifications/7/relationships/history",
                    "related": "https://browsercompat.org/api/v2/specifications/7/history"
                },
                "data": [
                    {
                        "type": "historical_specifications",
                        "id": "8"
                    },
                    {
                        "type": "historical_specifications",
                        "id": "7"
                    }
                ]
            }
        }
    }
}

Update the order of a one-to-many relationship

For some one-to-many relationships, the order of the to-many relationships matters (for example, version order with respect to browsers, and child features with respect to the parent feature). To change the order, update the order of the relationships on the “one” resource, either by updating the resource or the relationship:

PATCH /api/v2/features/2/relationships/children HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 624
Content-Type: application/vnd.api+json
{
    "data": [
        {
            "type": "features",
            "id": "3"
        },
        {
            "type": "features",
            "id": "4"
        },
        {
            "type": "features",
            "id": "5"
        },
        {
            "type": "features",
            "id": "7"
        },
        {
            "type": "features",
            "id": "8"
        },
        {
            "type": "features",
            "id": "13"
        },
        {
            "type": "features",
            "id": "9"
        },
        {
            "type": "features",
            "id": "10"
        }
    ]
}

A sample response is:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/features/2/relationships/children",
        "related": "https://browsercompat.org/api/v2/features/2/children"
    },
    "data": [
        {
            "type": "features",
            "id": "3"
        },
        {
            "type": "features",
            "id": "4"
        },
        {
            "type": "features",
            "id": "5"
        },
        {
            "type": "features",
            "id": "7"
        },
        {
            "type": "features",
            "id": "8"
        },
        {
            "type": "features",
            "id": "13"
        },
        {
            "type": "features",
            "id": "9"
        },
        {
            "type": "features",
            "id": "10"
        }
    ]
}

Revert to previous revision

To revert an instance to a previous revision, set the history_current relationship to the history ID of the previous revision. This resets the content and creates a new history object for the change:

PATCH /api/v2/features/12 HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 281
Content-Type: application/vnd.api+json
{
    "data": {
        "type": "features",
        "id": "12",
        "relationships": {
            "history_current": {
                "data": {
                    "type": "historical_features",
                    "id": "12"
                }
            }
        }
    }
}

A sample response is:

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://browsercompat.org/api/v2/features/12"
    },
    "data": {
        "type": "features",
        "id": "12",
        "attributes": {
            "slug": "web-css-transform-three-value-syntax",
            "mdn_uri": null,
            "experimental": false,
            "standardized": true,
            "stable": true,
            "obsolete": false,
            "name": {
                "en": "Three-value syntax",
                "es": "Sintaxis con tres valores",
                "ja": "3-値構文"
            }
        },
        "relationships": {
            "parent": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/features/12/relationships/parent",
                    "related": "https://browsercompat.org/api/v2/features/12/parent"
                },
                "data": {
                    "type": "features",
                    "id": "10"
                }
            },
            "children": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/features/12/relationships/children",
                    "related": "https://browsercompat.org/api/v2/features/12/children"
                },
                "data": []
            },
            "references": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/features/12/relationships/references",
                    "related": "https://browsercompat.org/api/v2/features/12/references"
                },
                "data": []
            },
            "supports": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/features/12/relationships/supports",
                    "related": "https://browsercompat.org/api/v2/features/12/supports"
                },
                "data": [
                    {
                        "type": "supports",
                        "id": "20"
                    },
                    {
                        "type": "supports",
                        "id": "21"
                    },
                    {
                        "type": "supports",
                        "id": "22"
                    },
                    {
                        "type": "supports",
                        "id": "23"
                    },
                    {
                        "type": "supports",
                        "id": "24"
                    },
                    {
                        "type": "supports",
                        "id": "25"
                    },
                    {
                        "type": "supports",
                        "id": "26"
                    }
                ]
            },
            "history_current": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/features/12/relationships/history_current",
                    "related": "https://browsercompat.org/api/v2/features/12/history_current"
                },
                "data": {
                    "type": "historical_features",
                    "id": "24"
                }
            },
            "history": {
                "links": {
                    "self": "https://browsercompat.org/api/v2/features/12/relationships/history",
                    "related": "https://browsercompat.org/api/v2/features/12/history"
                },
                "data": [
                    {
                        "type": "historical_features",
                        "id": "24"
                    },
                    {
                        "type": "historical_features",
                        "id": "16"
                    },
                    {
                        "type": "historical_features",
                        "id": "12"
                    }
                ]
            }
        }
    }
}

Delete a resource

To delete a resource:

DELETE /api/v1/versions/49 HTTP/1.1
Host: browsercompat.org
Accept: application/vnd.api+json
Authorization: Bearer xxQLNiTUFjRL5En8nBWzSDc5tLWkV2
Content-Length: 0

The response has no body:

HTTP/1.1 204 NO CONTENT

Revert a deletion

Reverting deletions is not currently possible, and is tracked in bug 1159349.