I'm using a shopcart system (shoptrader) for my online store. I'm not able to change all data by the import functions provided and changing some functions by Shoptrader will cost extra. Not a very big problem but we have FWH !!!
and so maybe I can do stuff with FWH and Swagger API that seems to be provided by Shoptrader.
Before I spend time in looking what Swagger can do for me, I have some starters questions :
I have a API code to connect, but I don't know whitch databases I can connect to...
I was abble to connect AND retrieve some data from the linkbar in Google. This was the result from the product database:
[{"uprid":"730","productId":730,"stockId":-1,"referenceId":0,"isBundle":0,"bundledProducts":[],"status":1,"quantity":"0","ean":"","sku":"","model":"KLEUR_P","hsCode":null,"name":"","price":"0.0000","taxClassId":"4","taxRate":"0.0000","isPhysical":"1","isDigital":"0","isQuotation":"0","url":"artikelen-zonder-categorie\/5f68953c837de","urlAbs":"https:\/\/www.maveco-webshop.be\/artikelen-zonder-categorie\/5f68953c837de","attributesString":"","backOrder":0,"onHome":0,"layover":1,"configurationAllowCheckout":1,"configurationStockCheck":0,"attributes":[],"description":"","addonInstagramEnabled":"0","addonInstagram":"0","addonOcsEnabled":"0","dropship":"0","dateAdded":"2020-09-21 13:57:43","lastModified":"2020-09-21 13:57:43","descriptions":{"description":"","extra":"","intro":""},"images":["","","","","","","","","","","",""],"image_alt":["","","","","","","","","","","",""],"discounts":{"name":"0","groupDiscount":"0.00","groupDiscountCategory":"0.00","groupDiscountProduct":"0.00"},"category":{"id":"888888","name":"Artikelen zonder categorie","categoryIds":"888888","cPath":"888888"},"quantities":{"quantity":"0","physicalQuantity":"0","minimumQuantity":"0","externalQuantity":"0","quantityStep":"1","trackQuantity":"1"},"prices":{"basePrice":"0.0000","normalPrice":"0.0000","price":"0.0000","specialPrice":"0.0000","purchasePrice":"0.0000"},"manufacturer":{"id":0,"name":"","image":""},"dimensions":{"type":"0","width":"0.00","height":"0.00","area":"0.00","weight":"0.00"},"reviews":{"count":0,"avg":0},"addons":{"multicatalog":{"enabled":0},"layover":{"enabled":1}}}]
I was not able at this time to change any values in the database (the API code is write and read anabled, but I think I can get this to work next days...
My questions :
Is there some FWH code that is working in retrieving this kind information ?
There are 2 lines of code in the online Swagger software tool :
cUrl :
curl -X PATCH "http://swagger.shoptrader.com/api/v2/cu ... 0850a54624" -H "accept: application/json" -H "token: c5ce13c97e79b8d54ca40e75ea43c41282cb25e469c4babb8ad4400850a54624" -H "Content-Type: application/json" -d "{\"firstName\":\"Marco\"}"
and
Request Url :
http://swagger.shoptrader.com/api/v2/cu ... 0850a54624
What can I do with the cUrl code ?
The Request Url will give info when copied into a link bar in Chrome.
Swagger API and FWH
- Marc Venken
- Posts: 727
- Joined: Tue Jun 14, 2016 7:51 am
Swagger API and FWH
Marc Venken
Using: FWH 20.08 with Harbour
Using: FWH 20.08 with Harbour
Re: Swagger API and FWH
Marc, ... Not a very big problem but we have FWH !!!
and we have mod harbour
Best regards,
Otto
and we have mod harbour
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
- Marc Venken
- Posts: 727
- Joined: Tue Jun 14, 2016 7:51 am
Re: Swagger API and FWH
I'm trying again to connect and use API
This code from the forum is actualy returning data ! (Adress, GPS coordinates...)
This code also gives data, but I thing the text of the webshop (very large text) :roll:
And here is a link to a sample screen in php from my webshop provider...
https://www.shoptrader.nl/partners/shoptrader-api/
AT time, I want to change some product data by API and not always by shop-import functions
Can somebody guide me for a starter function ?
This code from the forum is actualy returning data ! (Adress, GPS coordinates...)
Code: Select all
function api()
local cGoogleURL := "https://nominatim.openstreetmap.org/search?format=json&q="
local cAddress := "Hofstraat 5,Opglabbeek"
local aReturn, i, cTxt := ""
// aReturn := hb_jsonDecode( WebPageContents( cGoogleURL + cAddress) ) // *** Change this ***
aReturn := WebPageContents( cGoogleURL + cAddress)
hb_jsondecode( aReturn, @aReturn )
if !empty(aReturn)
for i:=1 to len(aReturn)
cTxt += aReturn[i,"display_name"] + e"\r\n"
cTxt += aReturn[i,"lat"]+" "+aReturn[i,"lon"] + e"\r\n" + e"\r\n"
next
else
cTxt:="not found"
endif
MsgInfo(cTxt)
return nil
This code also gives data, but I thing the text of the webshop (very large text) :roll:
Code: Select all
function api1()
//local cGoogleURL := "http://maps.googleapis.com/maps/api/geocode/json?address="
//local cGoogleURL := "swagger.shoptrader.com/api/v2/products/500?search=prid"
//local cGoogleURL := "http://maveco-webshop.be/products/500?search=prid"
local cGoogleURL := "http://maveco-webshop.be/products/"
local cAddress := "search="
local cSensor := "500"
local cKey := "&key=MYKEY"
//curl -X GET "http://swagger.shoptrader.com/api/v2/products/1491?search=prid" -H "accept: application/json"
// http://swagger.shoptrader.com/api/v2/products/1491?search=prid
MsgInfo( WebPageContents( cGoogleURL + cAddress + cSensor + cKey ) )
return nil
https://www.shoptrader.nl/partners/shoptrader-api/
AT time, I want to change some product data by API and not always by shop-import functions
Can somebody guide me for a starter function ?
Marc Venken
Using: FWH 20.08 with Harbour
Using: FWH 20.08 with Harbour