To add additional structured data to new APIs, the Reading Infrastructure team would like the ability to include labels for related entities included in wbgetentities responses to avoid having to make a second request for that information.
Current behavior:
A request like https://commons.wikimedia.org/w/api.php?action=wbgetentities&languages=en&formatversion=2&ids=M41837276&format=json returns:
{
"entities": {
"M41837276": {
"pageid": 41837276,
"ns": 6,
"title": "File:Pluto-01 Stern 03 Pluto Color TXT.jpg",
"lastrevid": 349086472,
"modified": "2019-05-07T13:02:06Z",
"type": "mediainfo",
"id": "M41837276",
"labels": {
"en": {
"language": "en",
"value": "High-resolution MVIC image of Pluto in enhanced color to bring out differences in surface composition."
}
},
"descriptions": {},
"statements": {
"P180": [
{
"mainsnak": {
"snaktype": "value",
"property": "P180",
"hash": "37091d3741ed1d6b19bf23f5947366650883be7d",
"datavalue": {
"value": {
"entity-type": "item",
"numeric-id": 339,
"id": "Q339"
},
"type": "wikibase-entityid"
}
},
"type": "statement",
"id": "M41837276$31a303cd-44a6-e116-09ab-fb02d71f2aef",
"rank": "preferred"
}
]
}
}
},
"success": 1
}Desired behavior:
A parameter that would alter the response to include labels of related entities (P180 and Q339 in this example):
{
"entities": {
"M41837276": {
"pageid": 41837276,
"ns": 6,
"title": "File:Pluto-01 Stern 03 Pluto Color TXT.jpg",
"lastrevid": 349086472,
"modified": "2019-05-07T13:02:06Z",
"type": "mediainfo",
"id": "M41837276",
"labels": {
"en": {
"language": "en",
"value": "High-resolution MVIC image of Pluto in enhanced color to bring out differences in surface composition."
}
},
"descriptions": {},
"statements": {
"P180": {
"labels": {
"en": {
"language": "en",
"value": "depicts"
}
},
"values": [
{
"mainsnak": {
"snaktype": "value",
"property": "P180",
"hash": "37091d3741ed1d6b19bf23f5947366650883be7d",
"datavalue": {
"value": {
"entity-type": "item",
"numeric-id": 339,
"id": "Q339",
"labels": {
"en": {
"language": "en",
"value": "Pluto"
}
}
},
"type": "wikibase-entityid"
}
},
"type": "statement",
"id": "M41837276$31a303cd-44a6-e116-09ab-fb02d71f2aef",
"rank": "preferred"
}
]
}
}
}
},
"success": 1
}Open to suggestions about structure of the response or other ways to achieve this.