Hi Michael,

As the author of some MW client library, I cannot find the doc, either. Neither 
have I looked into lexicographical data, but I had some trials-and-fails on 
Wikibase entity/properties, and perhaps they can help ^_^

For Wikibase items, I think the essential part of the problem is how to compose 
"data=" parameter of the request. Basically you need to send a partial of 
serialized Wikibase Entity (see 
https://www.mediawiki.org/wiki/Wikibase/DataModel/JSON) as data parameter. Just 
put in the names/aliases/claims that you want to append/update, send the 
request, and it's done.

The tricky part is, when you want to remove a claim/qualifier or an alias, you 
need to specify "remove" attribute, along with some identifiable attributes 
(language, id, etc.) like this

{
    "descriptions": {
        "zh": {
            "language": "zh",
            "remove": ""
        }
    },
    "aliases": {
        "en": [
            {
                "language": "en",
                "value": "alias 1",
                "remove": ""
            }
        ]
    },
    "sitelinks": {
        "testwiki": {
            "site": "testwiki",
            "remove": ""
        }
    }
}

When you are removing a claim/qualifier, you need to identify them by snak id, 
like this.

{
    "claims": {
        "P95433": [
            {
                "id": "Q212134$49E9F6B8-9D73-43A8-B45C-0D74DBA92B16",
                "remove": ""
            }
        ]
    }
}

You can actually combine all these components above in a single request, to 
change multiple traits of a Wikibase item. However, you may prefer wbset* 
actions (e.g. wbsetclaim) sometimes, because they generates user-friendly edit 
summary on what has been changed, at the expense of only being able to edit 1 
aspect of the Wikibase item in 1 request.

If it's possible, perhaps you can refer to my C# code for composing data 
parameter for wbeditentity request: 
https://github.com/CXuesong/WikiClientLibrary/blob/master/WikiClientLibrary.Wikibase/Entity.Editing.cs#L23:34

Hope that helps.

Thanks,
Xinyan


-----Original Message-----
From: Wikidata-tech <[email protected]> On Behalf Of 
Michael F. Sch?nitzer
Sent: Wednesday, April 1, 2020 8:15 AM
To: [email protected]
Subject: [Wikidata-tech] Wikidata API documentation

Hello,

Is there any documentation to "wbeditentity", except from the few examples on 
the API-document-page?
Any documentation about the format/grammar of the data?

And is there any API-documentation for lexicographical data at al?
The few bits on the source-code generated page aren't sufficient.

Cheers,
 M

--
Michael F. Schönitzer
Prochintalstr. 2
80993 München
Mail: [email protected]
Jabber: [email protected]
Tel: 089/37918949 - Mobil: 017657895702

_______________________________________________
Wikidata-tech mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech

Reply via email to