Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JarrResp
integer li_RespStatusCode
oleobject loo_Json
integer li_ItemId
string ls_Name
integer li_Price
string ls_Description
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")
loo_QueryParams.UpdateInt("list",10)
loo_Resp = loo_Http.QuickRequestParams("GET","https://api.simplekart.com/items",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_QueryParams
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JarrResp = create oleobject
// Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0
li_rc = loo_JarrResp.ConnectToNewObject("Chilkat.JsonArray")
loo_JarrResp.LoadSb(loo_SbResponseBody)
loo_JarrResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JarrResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JarrResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// [
// {
// "itemId": 1657,
// "name": "Smart WiFi Router",
// "price": 2096,
// "description": "Wifi router/wireless router. One of routers for wireless internet, wireless routers for home. Dual band router and gigabit router. Ideal as internet router also gaming router. Long range coverage with high speed. Compatible with all 802.11ac devices and below. 5ghz router/5g router Frequency Range: 2.4GHz and 5GHz; Interface Available: 4 x 10/100/1000Mbps LAN Ports, 1 10/100/1000Mbps WAN Port, 1 USB 2.0 Ports; Protocols Supported: Supports IPv4 and IPv6; System Requirement: Microsoft Windows 98SE NT 2000 XP Vista, or Windows 7 Windows 8/8.1/10, MAC OS NetWare UNIX or Linux; Wireless Standards: IEEE 802.11ac/n/a 5GHz, IEEE 802.11b/g/n 2.4GH"
// },
// {
// "itemId": 1658,
// "name": "VR Gaming Headset",
// "price": 79990,
// "description": "VR Gaming Headset puts you at the center of virtual reality's most pulse-pounding, PC-powered gameplay. See the action unfold all around you through our sharpest lenses and next-generation optics. Lose yourself in the experience with a comfortable, improved design that lets you start playing faster and keep playing longer. Insight tracking gives you the power to move throughout your playspace in any direction. No external sensors. No complicated setup. Just hands-on action and interaction with our updated Oculus Touch controllers right out of the box. Step into the game and the future of PC VR."
// },
// {
// "itemId": 1659,
// "name": "Classic Loop Top Shaker Bottle, 20-Ounce",
// "price": 578,
// "description": "Easy to maintain proper nutrition and hydration on-the-go.The wide mouth makes it easy to add scoops of powdered mixes, meal ingredients, and liquids, and embossed markings show both ounces and milliliters for easy measuring anywhere (note that markings on the 20-ounce capacity shaker cup only go up to 12 ounces). Bottle contents and liquids are securely contained thanks to a tightly threaded screw-on lid that creates a leakproof seal, and a flip cap that snaps securely shut for shaking and transportation."
// },
// {
// "itemId": 1660,
// "name": "4-Port USB 2.0 Hub",
// "price": 505,
// "description": "Easily add up to 4 devices with the USB 2.0 Hub. Particularly great for recent notebooks that provide a limited number of USB ports. Achieve full 480 Mbps on each port, or daisy-chain multiple hubs to a maximum of 127 devices.Fully backwards compatible with the USB 1.1 products."
// },
// {
// "itemId": 1661,
// "name": "Wipes Flushable Wet Wipes Dispenser, Mint Chill, 48 Count (Pack of 3)",
// "price": 938,
// "description": "For a superior clean that’s fresh, gentle, and effective, choose Wipes with the CleaningRipples Texture. Wipes are 100 percent flushable, remove odor causing bacteria and offer a large, dual layer wipe to clean better than when using dry toilet paper alone."
// },
// {
// "itemId": 1662,
// "name": "Cordless Vacuum Cleaner",
// "price": 41893,
// "description": "Twice the suction of any cord-free vacuum. Cord-free cleaning, made easier. Intelligently optimizes suction and run time, to deep clean everywhere. With fade-free battery power and a battery-saving trigger. And real-time reporting on the LCD screen to give you control of your clean. The Dynamic Load Sensor (DLS) system automatically changes the motor speed between carpets and hard floors. For deep cleaning across floor types."
// },
// {
// "itemId": 1663,
// "name": "Hair Dryer",
// "price": 1400,
// "description": "Hair dryer is engineered to protect hair from extreme heat damage, with the fastest drying+ and controlled styling to help increase smoothness by 75%, increase shine by up to 132% and decrease frizz and flyaways by up to 61%."
// },
// {
// "itemId": 1664,
// "name": "Business Z27n G2 27 inch LED LCD Monitor",
// "price": 24485,
// "description": "Be a productive powerhouse with the sleek QHD HP Z27n G2 27-inch Display. This virtually seamless display is factory-tested for reliability and longevity with integrated color calibration, uninterrupted multi-screen tiling, and expansive device connections, including USB-C™. Multi-screen productivity with no disruptions Streamline multi-tasking on multiple displays with a 3-sided micro-edge bezel, and daisy chain up to 2 displays per workstation with DisplayPort™."
// },
// {
// "itemId": 1665,
// "name": "Smart Watch",
// "price": 1805,
// "description": "Built-in Multi-Sports Mode, record your Running, Cycling, Football, Swimming, Table Tennis, Badminton, Climbing, recording your daily sports data."
// },
// {
// "itemId": 1666,
// "name": "Learning Thermostat, 3rd Gen, Smart Thermostat",
// "price": 15746,
// "description": "Learning Thermostat is a smart thermostat that learns what temperatures you like, turns itself down when you’re away and connects to your phone. It has a big, sharp display. And it’s proven to help save energy. In independent studies, the Thermostat saved an average of 10% to 12% on heating bills and 15% on cooling bills."
// },
// {
// "itemId": 16247,
// "name": "Postman Merch",
// "price": 15,
// "description": "Official T-shirt for the Postman community."
// }
// ]
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
i = 0
li_Count_i = loo_JarrResp.Size
do while i < li_Count_i
loo_Json = loo_JarrResp.ObjectAt(i)
li_ItemId = loo_Json.IntOf("itemId")
ls_Name = loo_Json.StringOf("name")
li_Price = loo_Json.IntOf("price")
ls_Description = loo_Json.StringOf("description")
destroy loo_Json
i = i + 1
loop
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JarrResp
Curl Command
curl -G -d "list=10"
https://api.simplekart.com/items
Postman Collection Item JSON
{
"name": "Get items from the database",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/items?list=10",
"host": [
"{{baseUrl}}"
],
"path": [
"items"
],
"query": [
{
"key": "list",
"value": "10",
"description": "Number of items to be displayed"
}
]
},
"description": "Pull a list of items from item database"
},
"response": [
{
"name": "OK - Successful pull of items",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/items?list=10",
"host": [
"{{baseUrl}}"
],
"path": [
"items"
],
"query": [
{
"key": "list",
"value": "10"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "[\n {\n \"itemId\": 1657,\n \"name\": \"Smart WiFi Router\",\n \"price\": 2096,\n \"description\": \"Wifi router/wireless router. One of routers for wireless internet, wireless routers for home. Dual band router and gigabit router. Ideal as internet router also gaming router. Long range coverage with high speed. Compatible with all 802.11ac devices and below. 5ghz router/5g router Frequency Range: 2.4GHz and 5GHz; Interface Available: 4 x 10/100/1000Mbps LAN Ports, 1 10/100/1000Mbps WAN Port, 1 USB 2.0 Ports; Protocols Supported: Supports IPv4 and IPv6; System Requirement: Microsoft Windows 98SE NT 2000 XP Vista, or Windows 7 Windows 8/8.1/10, MAC OS NetWare UNIX or Linux; Wireless Standards: IEEE 802.11ac/n/a 5GHz, IEEE 802.11b/g/n 2.4GH\"\n },\n {\n \"itemId\": 1658,\n \"name\": \"VR Gaming Headset\",\n \"price\": 79990,\n \"description\": \"VR Gaming Headset puts you at the center of virtual reality's most pulse-pounding, PC-powered gameplay. See the action unfold all around you through our sharpest lenses and next-generation optics. Lose yourself in the experience with a comfortable, improved design that lets you start playing faster and keep playing longer. Insight tracking gives you the power to move throughout your playspace in any direction. No external sensors. No complicated setup. Just hands-on action and interaction with our updated Oculus Touch controllers right out of the box. Step into the game and the future of PC VR.\"\n },\n {\n \"itemId\": 1659,\n \"name\": \"Classic Loop Top Shaker Bottle, 20-Ounce\",\n \"price\": 578,\n \"description\": \"Easy to maintain proper nutrition and hydration on-the-go.The wide mouth makes it easy to add scoops of powdered mixes, meal ingredients, and liquids, and embossed markings show both ounces and milliliters for easy measuring anywhere (note that markings on the 20-ounce capacity shaker cup only go up to 12 ounces). Bottle contents and liquids are securely contained thanks to a tightly threaded screw-on lid that creates a leakproof seal, and a flip cap that snaps securely shut for shaking and transportation.\"\n },\n {\n \"itemId\": 1660,\n \"name\": \"4-Port USB 2.0 Hub\",\n \"price\": 505,\n \"description\": \"Easily add up to 4 devices with the USB 2.0 Hub. Particularly great for recent notebooks that provide a limited number of USB ports. Achieve full 480 Mbps on each port, or daisy-chain multiple hubs to a maximum of 127 devices.Fully backwards compatible with the USB 1.1 products.\"\n },\n {\n \"itemId\": 1661,\n \"name\": \"Wipes Flushable Wet Wipes Dispenser, Mint Chill, 48 Count (Pack of 3)\",\n \"price\": 938,\n \"description\": \"For a superior clean that’s fresh, gentle, and effective, choose Wipes with the CleaningRipples Texture. Wipes are 100 percent flushable, remove odor causing bacteria and offer a large, dual layer wipe to clean better than when using dry toilet paper alone.\"\n },\n {\n \"itemId\": 1662,\n \"name\": \"Cordless Vacuum Cleaner\",\n \"price\": 41893,\n \"description\": \"Twice the suction of any cord-free vacuum. Cord-free cleaning, made easier. Intelligently optimizes suction and run time, to deep clean everywhere. With fade-free battery power and a battery-saving trigger. And real-time reporting on the LCD screen to give you control of your clean. The Dynamic Load Sensor (DLS) system automatically changes the motor speed between carpets and hard floors. For deep cleaning across floor types.\"\n },\n {\n \"itemId\": 1663,\n \"name\": \"Hair Dryer\",\n \"price\": 1400,\n \"description\": \"Hair dryer is engineered to protect hair from extreme heat damage, with the fastest drying+ and controlled styling to help increase smoothness by 75%, increase shine by up to 132% and decrease frizz and flyaways by up to 61%.\"\n },\n {\n \"itemId\": 1664,\n \"name\": \"Business Z27n G2 27 inch LED LCD Monitor\",\n \"price\": 24485,\n \"description\": \"Be a productive powerhouse with the sleek QHD HP Z27n G2 27-inch Display. This virtually seamless display is factory-tested for reliability and longevity with integrated color calibration, uninterrupted multi-screen tiling, and expansive device connections, including USB-C™. Multi-screen productivity with no disruptions Streamline multi-tasking on multiple displays with a 3-sided micro-edge bezel, and daisy chain up to 2 displays per workstation with DisplayPort™.\"\n },\n {\n \"itemId\": 1665,\n \"name\": \"Smart Watch\",\n \"price\": 1805,\n \"description\": \"Built-in Multi-Sports Mode, record your Running, Cycling, Football, Swimming, Table Tennis, Badminton, Climbing, recording your daily sports data.\"\n },\n {\n \"itemId\": 1666,\n \"name\": \"Learning Thermostat, 3rd Gen, Smart Thermostat\",\n \"price\": 15746,\n \"description\": \"Learning Thermostat is a smart thermostat that learns what temperatures you like, turns itself down when you’re away and connects to your phone. It has a big, sharp display. And it’s proven to help save energy. In independent studies, the Thermostat saved an average of 10% to 12% on heating bills and 15% on cooling bills.\"\n },\n {\n \"itemId\": 16247,\n \"name\": \"Postman Merch\",\n \"price\": 15,\n \"description\": \"Official T-shirt for the Postman community.\"\n }\n]"
}
]
}