I am trying to use the wwJsonSerializer to POST to the Shopify API to update inventory quantities. I have been told my request is being sent with the body as URL-encoded params. instead of making a POST to "/admin/api/2019-10/inventory_levels/set.json" with a JSON request body, not URL params.
I am not sure what needs to be changed. Here is what I am doing:
lcUrl = gcStoreURL + "/admin/api/2019-10/inventory_levels/set.json"
loLevel = Createobject("EMPTY") AddProperty(loLevel, "location_id", Int(tnLocationID)) AddProperty(loLevel, "inventory_item_id",Int(tnInvItemID)) AddProperty(loLevel, "available",tnAvailable)
lcJson = loSer.Serialize(loLevel) lcUrl = lcUrl + lcJson
loHttp = Createobject("wwHttp")
loHttp.Post(lcUrl, gcApiKey, gcPwdKey )
I believe I was able to solve this by using loHttp.AddPostKey(lcJson)
But now I have a problem that it is sending the post with cookies.
Is there a way to prevent cookies being sent?
WinInet automatically caches cookies that are collected from a given site and automatically sends them on subsequent requests.
You can use the INTERNET_FLAG_NO_COOKIES
flag to not send cookies or store cookies on return:
#INCLUDE wconnect.h
lcUrl = "..."
loHttp = CREATEOBJECT("wwhttp")
loHttp.nHttpServiceFlags = INTERNET_FLAG_NO_COOKIES
lcResult = loHttp.Get(lcUrl)
+++ Rick ---