User:Addshore/API Break September 2015

From Wikidata
Jump to: navigation, search

We have some breaking API changes that will soon be deployed to wikidata.org.

The breaks mainly concern the XML output although the JSON will also change slightly.

Below you can fine details about them!

Details[edit]

The breaking changes[edit]

  • XML output aliases are now grouped by language
  • XML output may no longer give elements when they are empty
  • XML any claim, qualifier, reference or snak elements that had an '_idx' element will no longer have it
  • ALL output may now give empty elements, ie. labels when an entity has none

Sample XML changes[edit]

Sample JSON changes[edit]

Before:

{
        "entities": {
                "q42": {
                        "id": "q42",
                        "revision": 31186,
                        "timestamp": "20120716140702",
                        "labels": {
                                "en": {
                                        "language": "en",
                                        "value": "Death Star"
                                },
                                "nn": {
                                        "language": "nn",
                                        "value": "Dødsstjerna"
                                }
                        },
                        "sitelinks": {
                                "enwiki": {
                                        "site": "enwiki",
                                        "title": "Death Star"
                                }
                        }
                }
        },
        "success": 1
}

After:

{
        "entities": {
                "q42": {
                        "id": "q42",
                        "revision": 31186,
                        "timestamp": "20120716140702",
                        "labels": {
                                "en": {
                                        "language": "en",
                                        "value": "Death Star"
                                },
                                "nn": {
                                        "language": "nn",
                                        "value": "Dødsstjerna"
                                }
                        },
                        "descriptions": {},
                        "aliases": {},
                        "sitelinks": {
                                "enwiki": {
                                        "site": "enwiki",
                                        "title": "Death Star"
                                }
                        },
            "claims": {}
                }
        },
        "success": 1
}

Finally[edit]

As well as an API change you may also notice that the JSON dumps may increase in size, although the format will not change.

This will be due to the JSON format including empty parts where previously they were removed.

If you have any questions regarding these breaking changes please ask!

·addshore· talk to me! 11:51, 27 August 2015 (UTC)