Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
384 views
in Technique[技术] by (71.8m points)

Square API: Object version does not match latest database version

I'm trying to use the following Square API endpoint to update an item, but I'm getting some errors. Here is the item that I'm trying to update.

{
  "type": "ITEM",
  "id": "7HXK6NVBDKSOK64CCAYZJ2KW",
  "updated_at": "2020-08-08T21:43:41.849Z",
  "version": 1596923021849,
  "is_deleted": false,
  "present_at_all_locations": false,
  "present_at_location_ids": [
    "1JZ5JTPBW0EXY"
  ],
  "item_data": {
    "name": "Hummus Plate",
    "description": "Olives, feta, tomatoes, tzatziki and warm pita.",
    "visibility": "PRIVATE",
    "category_id": "ARB5LTTDUSER6T66ZWYO65FL",
    "variations": [
      {
        "type": "ITEM_VARIATION",
        "id": "HBIHPLROOJUUNUSW3BZUDQ5J",
        "updated_at": "2020-08-08T21:40:14.581Z",
        "version": 1596922814581,
        "is_deleted": false,
        "present_at_all_locations": false,
        "present_at_location_ids": [
          "1JZ5JTPBW0EXY"
        ],
        "item_variation_data": {
          "item_id": "7HXK6NVBDKSOK64CCAYZJ2KW",
          "name": "Regular",
          "ordinal": 0,
          "pricing_type": "FIXED_PRICING",
          "price_money": {
            "amount": 1000,
            "currency": "USD"
          }
        }
      }
    ],
    "product_type": "REGULAR",
    "skip_modifier_screen": true,
    "ecom_available": false,
    "ecom_visibility": "UNINDEXED"
  }
}

Here the body content.

{
  "batches": [{
    "objects": [{
      "type": "ITEM_VARIATION",
      "id": "T6KKCATDIU2VV4BDBMVGML4W",
      "item_variation_data": {
        "item_id": "FNWWGFTBQWFAYK6JGBD3LDLD",
        "pricing_type": "FIXED_PRICING",
        "price_money": {
          "amount": 150,
          "currency": "USD"
        }
      }
    }]
  }],
  "idempotency_key": "61994762-3a6s-4b75-sf81-fdfaf"
}

Here is the error I'm getting:

**{
    "errors": [
        {
            "category": "INVALID_REQUEST_ERROR",
            "code": "VERSION_MISMATCH",
            "detail": "Object version does not match latest database version.",
            "field": "version"
        }
    ]
}**

enter image description here

I'm not sure what I'm doing wrong, but I appreciate any help I can get. Thank you in advance!

question from:https://stackoverflow.com/questions/65877026/square-api-object-version-does-not-match-latest-database-version

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...