connorshea created this task.
connorshea added projects: Wikibase REST API, Wikidata.
Restricted Application added a subscriber: Aklapper.

TASK DESCRIPTION
  **Steps to replicate the issue** (include links if applicable):
  
  - View the REST API Swagger docs at 
https://doc.wikimedia.org/Wikibase/master/js/rest-api/
  - See the format defined in the docs for creating a new statement with the 
`POST /entities/items/{item_id}/statements` endpoint.
  - Try to post the first JSON blob below to an item on the beta Wikidata site.
  - See that it errors with `{ "code": "invalid-statement-data", "message": 
"Invalid statement data provided" }`, despite having all the components that 
are declared in the Swagger docs.
  
  This is what I tried POSTing to the endpoint, which failed:
  
    {
      "statement": {
        "mainsnak": {
          "snaktype": "value",
          "property": "P625",
          "datatype": "string",
          "datavalue": {
            "type": "string",
            "value": "test data"
          }
        }
      },
      "bot": true,
      "tags": [],
      "comment": "foo"
    }
  
  This is what the endpoint *actually* wanted:
  
    {
      "statement": {
        "mainsnak": {
          "snaktype": "value",
          "property": "P625",
          "datatype": "string",
          "datavalue": {
            "type": "string",
            "value": "test data"
          }
        },
        "type": "statement"
      },
      "bot": true,
      "tags": [],
      "comment": "foo"
    }
  
  The only difference is the `"type": "statement"` line, which the Swagger docs 
do not mention/include. I only figured this out after going into the Wikibase 
codebase and browsing the unit tests. 😅
  
  **What happens?**:
  
  An error about an invalid statement is returned and the Swagger docs make no 
mention of a `type` attribute in the statement JSON.
  
  **What should have happened instead?**:
  
  The Swagger docs for the statements POST endpoint should include the required 
`type` key.
  
  **Software version** (skip for WMF-hosted wikis like Wikipedia): Beta 
Wikidata site
  
  **Other information** (browser name/version, screenshots, etc.):
  
  If the same `type` attribute should be used on the PUT endpoint(s) for 
statements, those should be updated as well.

TASK DETAIL
  https://phabricator.wikimedia.org/T315164

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: connorshea
Cc: connorshea, Aklapper, Astuthiodit_1, karapayneWMDE, Invadibot, maantietaja, 
ItamarWMDE, Akuckartz, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, 
LawExplorer, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, aude, 
Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org

Reply via email to