Integrate json repsonse as input for woocommerce

Hello there,

I am trying to load products into woocommerce with the use of postman. I have made an API call and i got a JSON response with about 4500 products which look like this:

[
    {
        "itemcode": "0318C001",
        "title": "Canon 0318C001 inktcartridge 1 stuk(s) Origineel Hoog (XL) rendement Zwart",
        "longtitle": "Canon 0318C001 inktcartridge 1 stuk(s) Origineel Hoog (XL) rendement Zwart",
        "description": "Canon 0318C001 inktcartridge 1 stuk(s) Origineel Hoog (XL) r",
        "brandcode": "P3",
        "brand": "Canon",
        "groupcode": "A13",
        "group": "Canon Cartridge",
        "statusgroupcode": "10009",
        "statusgroup": "New",
        "price": 13.004,
        "chargeprice": 0,
        "totalprice": 13.004,
        "suggestprice": 18.59,
        "barcode": "4549292032826",
        "status": "A",
        "hasflyeroffer": 0,
        "hasspecialoffer": 0,
        "deliverydate": "2023-09-02T00:00:00+02:00",
        "stockfree": 0,
        "backorder": 0,
        "externalstock": 1,
        "categoryid1": 21,
        "categoryname1": "Printers",
        "categoryid2": 377,
        "categoryname2": "Inktcartridges",
        "icecatproductid": 29627554,
        "productimage": "https://productimages.nl/media/image/low/a9318850c82328085aa3cad96b7e5c6f4acfc4fcf7c9a704269130838cddb060.jpg",
        "productvideo": "",
        "longdescription": "Deze zwarte pigmentinkt met hoog rendement levert tot 1,6x meer afdrukken op dan het standaardequivalent. De pigmentzwarte inkt wordt gebruikt voor het afdrukken van documenten en zorgt voor haarscherpe tekst met een grote levensduur. Met de inkttank van 22 ml kun je tot 500 pagina's A4-kleurendocumenten afdrukken.",
        "warrantyinfo": "1 jaar via Complies",
        "bolcommissionpercentage": 5,
        "bolcommissionfixedamount": 0.48
    },

I want to post this information to Woocommerce so it creates new products from this output (not just this one product but all products from the JSON). I need to change some fields to match woocommerce’s input like the itemcode from the JSON needs to be set as SKU in Woocommerce, the regular price in woocommerce must be the suggestprice from the JSON and the stock in woocommerce needs to be a calculation of stockfree and externalstock from the JSON…

Is this possible in postman? How can i achieve to use the JSON response as input on another tab and how can i “map the fields” to match woocommerce’s input…

I hope someone can help me out or point me in the right direction…

Thanks in advance,

Warm regards,

Robert

This type of activity is covered in the Postman Learning Centre.

If you are new to Postman, then I would suggest a visit to the Learning Centre.

Overview | Postman Learning Center

Including the Postman Training links under “Other Resources”.

image

I would recommend the “Galaxy APIs 101” course first as it gets you used to the application features.

Then the “Galaxy Testing and Automation” course which teaches you how to assert the responses. It includes defining and using variables from responses.

Well i did the galaxy training, it didnt cover my needs to the fullest but it got me started, i will make another post where i got stuck…

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.