2

Wikidata entities have claims, inside which are property IDs with their snaks. But how do I get the name for a particular property ID?

3

Ok, I admit it might have been a little bit obvious, maybe. You just use

https://www.wikidata.org/w/api.php?action=wbgetentities&ids=<property-id>&languages=<lang>&props=labels&format=json

I know, the action is wbgetentities, but it does work! You get a JSON response like this:

{
    "entities": {
        "P463": {
            "type": "property",
            "datatype": "wikibase-item",
            "id": "P463",
            "labels": {
                "en": {
                    "language": "en",
                    "value": "member of"
                }
            }
        }
    },
    "success": 1
}

This works because, oddly enough, properties themselves are entities in Wikidata.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.