Topic on Talk:Wikibase/API

Change values from one property to another on the same item

4
Jura1 (talkcontribs)

At d:Q3107406#P161, I like to retrieve all statements with d:Property:P161 and then add them with property d:Property:P5030. Once done, delete all P161. Ideally in just 1 or 2 edits, and 2 or 3 api requests. I could do 1200 edits with Quickstatements, but I'd rather not.

Matěj Suchánek (talkcontribs)

It's possible with a single API request via wbeditentity. The data= will look like:

{'claims':[
    {'id': '<the id of the claim to remove>', 'remove': ''},
    {<data of the claim>},
    [...]
]}

<data of the claim> is JSON of each claim, where you have to replace all P161 to P5030 and remove 'id' key.

Example:

Jura1 (talkcontribs)

Thanks. I will give it a try. I got a test working: .

It would slightly easier if the api sandbox had a json input box (even with formatting).

Jura1 (talkcontribs)

found that too. Thanks it worked.

Users who edit animated films would probably like a tool that could do that to move all claims from cast to voice actor.