Update Item Note

misebalmisebal Member Posts: 5
hi there

I am trying to use Item end point to update Note and qot , both in the same call

I am using PUT and this string

<Item>
    <Note>
        <note>note string here</note>
        <isPublic>true</isPublic>
    </Note>
    <ItemShops>
        <ItemShop>
            <itemShopID>34406</itemShopID>
            <qoh>4</qoh>
        </ItemShop>
    </ItemShops>
</Item>

I have observed that I need 2 api calls made as to update it

am I correct in this assumption ?


as a second question , I have seen a difference between interface and api item search

for example
Inventory->Items->Advanced Search  having  Items w/ Inventory checked  list 6766 items

and this api call

https://api.lightspeedapp.com/API/Account/{accountID}/Item?offset=0&load_relations=[""ItemShops""]&ItemShops.qoh=>, 1" returns only    <Items count="2395" offset="1000" limit="100">

why this difference ?



regards

Sebastian




8 comments

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator
    edited September 2018
    @misebal

    You can update the qoh and the Notes in one call, you just need to ensure you include only what you need. Make a request only with the Notes object with the relevant data and then next to that another request with the ItemShops object and it will work

    Here's an example request:

    { 
       
         "Note": {
             "note": "Something"
         },
         "ItemShops": {
             "ItemShop": {
                     "itemShopID": 1,
                     "shopID": 1,
                     "qoh": 50
                 }
                 
             
         }
        }
    

    This could be for a number of reasons, it's probably a difference between the filters set on the UI of the Account and the ones on the API call. Could you private message me your account ID and I will investigate for you

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • misebalmisebal Member Posts: 5
    hi Adrian

    thank you for your response , BUT this is not working anymore

    used 2 api calls to same api end point , one XML and one JSON payload

    JSON was exactly the same :

    {
     "Note": {
      "note": "STR-FLR-FXTR"
     },
     "ItemShops": {
      "ItemShop": {
       "itemShopID": 3215,
       "shopID": 1,
       "qoh": 10
      }
     }
    }

    HTTP response was 200 , but the interface didn't change anything



  • gregaricangregarican Member Posts: 706 
    This didn't work for me either, when I tested it. The PUT request did update the item note, but the item quantity on hand wasn't updated. Here's a capture of the request/response below.

    Content-Type: text/plain
    cache-control: no-cache
    Postman-Token: e6be6674-6fe7-4d93-ac67-34eae301fce0
    Authorization: Bearer {AccessToken}
    User-Agent: PostmanRuntime/7.1.1
    Accept: */*
    Host: api.merchantos.com
    cookie: __cfduid=db226f08af7bd70432115fe0872508a6f1518446657
    accept-encoding: gzip, deflate
    content-length: 138
    Connection: close

    "Note": { 
    "note": "This is a newly-update updated note." 
    },
    "ItemShops": {
    "itemShopID": 164,
    "shopID": 1,
    "qoh": 1
    }
    }
    HTTP/1.1 200 OK
    Date: Mon, 01 Oct 2018 15:13:31 GMT
    Content-Type: application/json
    Content-Length: 3545
    Connection: close
    x-frame-options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    X-LS-Acct-Id: 164019
    X-LS-OAuth-Client-Id: 64577
    X-LS-API-Bucket-Level: 10/100
    X-LS-Shard-Id: 18
    X-LS-API-Drip-Rate: 5
    X-LS-Master-System: true
    X-LS-Master-Account: true
    X-LS-Master-Catalog: false
    Vary: Accept-Encoding
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Server: cloudflare
    CF-RAY: 462fdfa3aa2d5510-ORD

    @{"@attributes":{"count":"1"},"Item":{"itemID":"55","systemSku":"210000000055","defaultCost":"100","avgCost":"100","discountable":"true","tax":"true","archived":"false","itemType":"default","serialized":"false","description":"Samsung 40\" tv (Sample API Upload).","modelYear":"0","upc":"","ean":"","customSku":"12341234","manufacturerSku":"43214321","createTime":"2018-02-16T12:54:18+00:00","timeStamp":"2018-10-01T15:13:30+00:00","publishToEcom":"true","categoryID":"36","taxClassID":"1","departmentID":"0","itemMatrixID":"0","manufacturerID":"0","seasonID":"0","defaultVendorID":"200","Note":{"note":"This is a newly-update updated note.","isPublic":"false","timeStamp":"2018-10-01T15:13:30+00:00"},"ItemShops":{"ItemShop":[{"itemShopID":"164","qoh":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-02-16T20:31:38+00:00","itemID":"55","shopID":"1"},{"itemShopID":"165","qoh":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-02-16T20:31:38+00:00","itemID":"55","shopID":"2"},{"itemShopID":"1408","qoh":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-04-30T15:26:23+00:00","itemID":"55","shopID":"3"},{"itemShopID":"1919","qoh":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-04-30T15:29:46+00:00","itemID":"55","shopID":"4"},{"itemShopID":"2430","qoh":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-04-30T15:32:04+00:00","itemID":"55","shopID":"5"},{"itemShopID":"163","qoh":"0","backorder":"0","componentQoh":"0","componentBackorder":"0","reorderPoint":"0","reorderLevel":"0","timeStamp":"2018-02-16T20:31:38+00:00","itemID":"55","shopID":"0"}]},"CustomFieldValues":{"CustomFieldValue":[{"customFieldValueID":"430","customFieldID":"13","name":"Stone 2","type":"single_choice","value":{"customFieldChoiceID":"194","value":"","name":"Agate","canBeDeleted":"false","customFieldID":"13"}},{"customFieldValueID":"431","customFieldID":"15","name":"Stone 2 Attributes","type":"text","value":"These are the Accent Stone 1 Attributes."},{"customFieldValueID":"432","customFieldID":"5","name":"Includes","type":"multi_choice","value":{"customFieldChoiceID":"60","value":"","name":"Box","canBeDeleted":"false","customFieldID":"5"}},{"customFieldValueID":"433","customFieldID":"5","name":"Includes","type":"multi_choice","value":{"customFieldChoiceID":"64","value":"","name":"Warranty Card","canBeDeleted":"false","customFieldID":"5"}},{"customFieldValueID":"434","customFieldID":"17","name":"Stone 3 Attributes","type":"text","value":""},{"customFieldValueID":"435","customFieldID":"19","name":"Stone 4 Attributes","type":"text","value":""},{"customFieldValueID":"436","customFieldID":"24","name":"Accessory Dimensions","type":"text","value":""},{"customFieldValueID":"437","customFieldID":"29","name":"Year","type":"string","value":""},{"customFieldValueID":"438","customFieldID":"26","name":"Condition","type":"text","value":""},{"customFieldValueID":"439","customFieldID":"9","name":"Main Stone Attributes","type":"text","value":""}]},"Prices":{"ItemPrice":[{"amount":"220","useTypeID":"1","useType":"Default"},{"amount":"550","useTypeID":"2","useType":"MSRP"},{"amount":"220","useTypeID":"3","useType":"Online"}]},"Tags":{"@attributes":{"count":"4"},"tag":["tag1","tag2","tag3","webstore"]}}}
  • misebalmisebal Member Posts: 5
    hi Adrian

    it seems it is working well now

    payload as XML

    <Item>
        <Note>
            <note>STR-FLR-FXTR yy</note>
            <isPublic>true</isPublic>
        </Note>
        <ItemShops>
            <ItemShop>
                <itemShopID>3215</itemShopID>
                <shopID>1</shopID>
                <qoh>20</qoh>
            </ItemShop>
        </ItemShops>
    </Item>

    get http 200 and Inventory interface updates accordingly

    thank you for your support

    Seba

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator
    No worries @misebal! Glad to hear!

    @gregarican are you still experiencing issues?

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • gregaricangregarican Member Posts: 706 
    I haven't tried it again, as I don't utilize the API for updating shop on-hands. But I will try it in a minute just in case I run across the need. And will update this thread. Thanks!
  • gregaricangregarican Member Posts: 706 
    It worked. My JSON didn't enclose the individual ItemShop in an ItemShops element. So this JSON below worked just fine. Thanks for the follow up!

    "ItemShops": {
    "ItemShop": {
    "itemShopID": 4411,
    "shopID": 1,
    "qoh": 1
    }
    }
    }
  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator
    Ahh, that happens! Not to worry, glad to see things worked out :)

    Adrian Samuel

    Software Developer

    Lightspeed HQ

Sign In or Register to comment.