-1

I am trying to submit an item to an API, the request goes through but comes back with an incorrect item construction returned by the API.

The code works compiles and runs without a problem, unfortunately the item constructed is incorrect. API I am using: https://www.clover.com/api_docs/#!/inventory/CreateItem

If the above link does not work, navigate to Inventory -> Items -> Create an Inventory Item.

I have played around with what I am sending to the server but my problem is with the tags argument of the API. No matter what I set the "tags" field to, the returned item never has a tags field. I also have a UI that I can see all the item's properties. "tags" is always null.

Here is what I am feeding the API:

{
    "name":"test_item_with_label",
    "sku":"1234",
    "code":"959",
    "price":1698,
    "tags":[
        {
            "id":"Z1JC35RHV6PFP", 
            "name":"Sewing",
            "showInReporting":false
        }
    ],
    "priceType":"FIXED",
    "defaultTaxRates":true,
    "hidden":false,
    "revenue":true
}

This is the item's properties after the request:

{
    "id": "FCMS6MSAFYK1E", 
    "hidden": false, 
    "name": "test_item_with_label", 
    "code": "959", 
    "sku": "1234", 
    "price": 1698, 
    "priceType": "FIXED", 
    "defaultTaxRates": true, 
    "isRevenue": true, 
    "modifiedTime": 1564272103000
}

I want the item to be constructed correctly through the API with tags.

This is the available tags for reference.

  "elements": [ {
      "id": "Z1JC35RHV6PFP", 
      "name": "Sewing", 
      "showInReporting": false
    }, {
      "id": "STBVZXTVHDYK6", 
      "name": "Compass Industries", 
      "showInReporting": false
    }, {
      "id": "SSWR290EAK8RM", 
      "name": "Savor Jerky", 
      "showInReporting": false
    }, {
      "id": "GCENM7Y4RBJE2", 
      "name": "Triple K", 
      "showInReporting": false
    }, {
      "id": "E9H3YC70T4D6W", 
      "name": "Sabre/Security Equipment Co.", 
      "showInReporting": false
    }, {
      "id": "4ANVQMMFK7MNR", 
      "name": "Lansky Sharpeners", 
      "showInReporting": false
    }, {
      "id": "1H66V1ZK7Y84Y", 
      "name": "Nebo/ True Utility", 
      "showInReporting": false
    }, {
      "id": "0PZ5R8VV61QDJ", 
      "name": "Victorinox Swiss Army", 
      "showInReporting": false
    }]
  • `tags` is an expandable field, are you adding it to the expand field contents? Are you using their GUI or are you sending the request some other way? – Raul Sauco Jul 28 '19 at 00:34
  • Since you're not creating the tags on the fly, you should just be referring to them by id, so the value should be a simple array of ids, e.g. `"tags":["Z1JC35RHV6PFP","1H66V1ZK7Y84Y","SSWR290EAK8RM"]` – Andreas Jul 28 '19 at 00:35
  • @RaulSauco I am doing it by Java library "OkHttp". – Cody Alexander Jul 28 '19 at 00:39
  • @Andreas Your method results in: java.lang.RuntimeException: Response came back with error code: 400 – Cody Alexander Jul 28 '19 at 00:42

1 Answers1

0

Found the answer!

Leaving it here in case anyone else runs into this problem with the Clover PoS API.

Basically their API is wrong! It says you can feed all those arguments in the docs, but you first must create the item THEN come back and tag the item with the correct tag by ID.

Answer found here: https://community.clover.com/questions/1822/can-somebody-tell-me-the-use-of-v3merchantsmidtag.html