Topic on Talk:Wikibase/API

$serialization does not have the correct number of parts

2
Shisma (talkcontribs)

I'm trying to make a statement with a property that does not exist yet.

  let claim = {
   type: "statement",
   mainsnak: {
       snaktype: "value",
       property: 'P370',
       datavalue: {
         type: "string",
         value: 'foo',
       }
   },
   id: "Q4115189", // ← do I have to use a guid here? A guid of what?
   rank: "normal"
  }

but the answer is $serialization does not have the correct number of parts. What am I doing wrong? What is a part?

Addshore (talkcontribs)

Yes, the ID here is the GUID. Q4115189 doesn't have enough parts to be a GUID (a bit before and after a $).

You can use wbcreateclaim to create a statement without needing to create the JSON https://www.wikidata.org/w/api.php?action=help&modules=wbcreateclaim

If you want to use wbsetclaim then you have to create your own valid GUID locally before submitting.

Reply to "$serialization does not have the correct number of parts"