DataFlex
DataFlex
Etsy: Find a Shop's Active Listings
See more Etsy Examples
Finds all active Listings associated with a Shop.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
Integer iListing_id
String sState
Integer iUser_id
Integer iCategory_id
String sTitle
String sDescription
Integer iCreation_tsz
Integer iEnding_tsz
Integer iOriginal_creation_tsz
Integer iLast_modified_tsz
String sPrice
String sCurrency_code
Integer iQuantity
Integer iShop_section_id
String sFeatured_rank
Integer iState_tsz
String sUrl
Integer iViews
Integer iNum_favorers
String sShipping_template_id
Integer iProcessing_min
Integer iProcessing_max
String sWho_made
String sIs_supply
String sWhen_made
String sItem_weight
String sItem_weight_unit
String sItem_length
String sItem_width
String sItem_height
String sItem_dimensions_unit
Boolean iIs_private
String sRecipient
String sOccasion
String sStyle
Boolean iNon_taxable
Boolean iIs_customizable
Boolean iIs_digital
String sFile_data
Boolean iShould_auto_renew
String sLanguage
Boolean iHas_variations
Integer iTaxonomy_id
Boolean iUsed_manufacturer
Integer j
Integer iCount_j
String sStrVal
Integer iIntVal
Integer iCount
String sParamsLimit
Integer iParamsOffset
String sParamsPage
String sParamsShop_id
String sParamsKeywords
String sParamsSort_on
String sParamsSort_order
String sParamsMin_price
String sParamsMax_price
String sParamsColor
Integer iParamsColor_accuracy
String sParamsTags
String sParamsCategory
String sParamsTranslate_keywords
Integer iParamsInclude_private
String sV_type
Integer iPaginationEffective_limit
Integer iPaginationEffective_offset
Integer iPaginationNext_offset
Integer iPaginationEffective_page
Integer iPaginationNext_page
Integer i
Integer iCount_i
String sTemp1
Move False To iSuccess
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// Implements the following CURL command:
// curl -X GET \
// https://openapi.etsy.com/v2/shops/shop_id/listings/active?api_key=MY_ETSY_KEYSTRING&limit=2
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://openapi.etsy.com/v2/shops/shop_id/listings/active?api_key=MY_ETSY_KEYSTRING&limit=2" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "count": 176,
// "results": [
// {
// "listing_id": 720138253,
// "state": "active",
// "user_id": 17132443,
// "category_id": 68890894,
// "title": "Star face, Galaxy wall mask, Weird wall mask, Crazy art sculpture, Original Wall Mask, Wire art sculpture, Wall art sculpture, 3D art",
// "description": "The crazy hair says it all. This galaxy face is something every art lover should possess in their collection. The two crazy eyes are so lovable and so in tune with the nose. The thin decorative black lines emphasize the facial characteristics and the white dots around the face all lead to this gorgeous crazy hair, made of thick metal wire. This unique star face is made of terracotta, ceramic elements, and sand plaster than it was glued to a wooden board, painted in dark blue. There is a hook on the back for easy hanging. The awesome art piece is perfect for your personal collection or a gift for someone very special.\n\nThe night sky can always be an artist\u2019s inspiration: the countless stars and the vastness can acquire different images and shapes. In this case, this incredible face, filled with numerous stars, emerges from the sky for me. \n \nTagged: 99heads\n\nThe following materials are used: \n\nTerracotta, ceramic elements, ceramic glaze, ceramic paint, wood, metal wire, glass, sand plaster.\n\nSize:\nHeight: (hair included): 30 cm (11 3\/4")\nWidth: 36cm (14 1\/4 )\nDepth: 6 cm ( 2 1\/2")",
// "creation_tsz": 1562700678,
// "ending_tsz": 1573331478,
// "original_creation_tsz": 1562700678,
// "last_modified_tsz": 1562704479,
// "price": "160.00",
// "currency_code": "USD",
// "quantity": 1,
// "sku": [
// ],
// "tags": [
// "Crazy art sculpture",
// "Wall Ceramic mask",
// "Abstract face",
// "3D sculpture",
// "Wall art Sculpture",
// "wire art sculpture",
// "wired art",
// "modern ceramics",
// "wall mask",
// "star face",
// "galaxy art",
// "galaxy wall mask",
// "galaxy sculpture"
// ],
// "category_path": [
// "Art",
// "Mixed Media"
// ],
// "category_path_ids": [
// 68887312,
// 68890894
// ],
// "materials": [
// "Terracotta",
// "ceramic elements",
// "ceramic glaze",
// "ceramic paint",
// "wood",
// "metal wire",
// "glass",
// "sand plaster"
// ],
// "shop_section_id": 24002839,
// "featured_rank": null,
// "state_tsz": 1562700678,
// "url": "https:\/\/www.etsy.com\/listing\/720138253\/star-face-galaxy-wall-mask-weird-wall?utm_source=chilkattest&utm_medium=api&utm_campaign=api",
// "views": 7,
// "num_favorers": 1,
// "shipping_template_id": null,
// "processing_min": 1,
// "processing_max": 2,
// "who_made": "i_did",
// "is_supply": "false",
// "when_made": "2010_2019",
// "item_weight": null,
// "item_weight_unit": "g",
// "item_length": null,
// "item_width": null,
// "item_height": null,
// "item_dimensions_unit": "mm",
// "is_private": false,
// "recipient": null,
// "occasion": null,
// "style": null,
// "non_taxable": false,
// "is_customizable": true,
// "is_digital": false,
// "file_data": "",
// "should_auto_renew": false,
// "language": "en-US",
// "has_variations": false,
// "taxonomy_id": 101,
// "taxonomy_path": [
// "Art & Collectibles",
// "Mixed Media & Collage",
// "Other Assemblage"
// ],
// "used_manufacturer": false
// },
// {
// "listing_id": 643852266,
// "state": "active",
// "user_id": 17132443,
// "category_id": 68890894,
// "title": "Art gift for couple, Weird art figures, Ceramic Wall Figurines, Colorful sculptures, 3D wall art, Mixed Media Sculpture by 99heads",
// "description": "The faces of the sculptures are made of white clay elements and ceramic glazes. Their bodies are wooden and painted with acrylic paints. Each sculpture has got a hook on the back for you to hang it on the desired place and in the desired arrangement. These two look amazing next to each other on the wall... they look like good buddies. They are indeed very good friends that want to make your home more comfortable for you and your family or be a surprise gift for someone special :)\n\nMaterials:\nWhite clay, ceramic elements, wood, glass.\n\nTagged by 99heads\n\nSize:\n\nBlue Figure:\nHeight 62cm, width 10cm, depth 3cm\n(Height 24 1\/4" width 4", depth 1 1\/4")\n\nRed Figure:\nHeight 61,5cm, width 9cm, depth 3cm\n(Height 24" width 3 1\/2", depth 1 1\/4")\n\nIf you're interested in having only one of them:\n\nBlue figure:\nhttps:\/\/www.etsy.com\/listing\/609986541\/abstract-ceramic-modern-ceramic-doll\n\nRed figure:\nhttps:\/\/www.etsy.com\/listing\/596145976\/abstract-doll-figure-colorful-sculpture",
// "creation_tsz": 1562699323,
// "ending_tsz": 1573330123,
// "original_creation_tsz": 1541802400,
// "last_modified_tsz": 1562699323,
// "price": "230.00",
// "currency_code": "USD",
// "quantity": 1,
// "sku": [
// ],
// "tags": [
// "ceramic home decor",
// "wall art ceramic",
// "abstract ceramic",
// "ceramic wall art",
// "ceramic sculpture",
// "3d wall art",
// "Ceramic doll",
// "wall art sculpture",
// "wall sculpture",
// "weird art figures",
// "Art gift for couple",
// "colorful sculpture",
// "Fun wall hanging art"
// ],
// "category_path": [
// "Art",
// "Mixed Media"
// ],
// "category_path_ids": [
// 68887312,
// 68890894
// ],
// "materials": [
// "white clay",
// "ceramic elements",
// "glass",
// "ceramic glazes",
// "wood"
// ],
// "shop_section_id": 24002915,
// "featured_rank": null,
// "state_tsz": 1541802400,
// "url": "https:\/\/www.etsy.com\/listing\/643852266\/art-gift-for-couple-weird-art-figures?utm_source=chilkattest&utm_medium=api&utm_campaign=api",
// "views": 143,
// "num_favorers": 16,
// "shipping_template_id": null,
// "processing_min": 1,
// "processing_max": 2,
// "who_made": "i_did",
// "is_supply": "false",
// "when_made": "2010_2019",
// "item_weight": null,
// "item_weight_unit": "g",
// "item_length": null,
// "item_width": null,
// "item_height": null,
// "item_dimensions_unit": "mm",
// "is_private": false,
// "recipient": null,
// "occasion": null,
// "style": [
// "Abstract"
// ],
// "non_taxable": false,
// "is_customizable": true,
// "is_digital": false,
// "file_data": "",
// "should_auto_renew": false,
// "language": "en-US",
// "has_variations": false,
// "taxonomy_id": 101,
// "taxonomy_path": [
// "Art & Collectibles",
// "Mixed Media & Collage",
// "Other Assemblage"
// ],
// "used_manufacturer": false
// }
// ],
// "params": {
// "limit": "2",
// "offset": 0,
// "page": null,
// "shop_id": "6634711",
// "keywords": null,
// "sort_on": "created",
// "sort_order": "down",
// "min_price": null,
// "max_price": null,
// "color": null,
// "color_accuracy": 0,
// "tags": null,
// "category": null,
// "translate_keywords": "false",
// "include_private": 0
// },
// "type": "Listing",
// "pagination": {
// "effective_limit": 2,
// "effective_offset": 0,
// "next_offset": 2,
// "effective_page": 1,
// "next_page": 2
// }
// }
// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
Get ComIntOf Of hoJResp "count" To iCount
Get ComStringOf Of hoJResp "params.limit" To sParamsLimit
Get ComIntOf Of hoJResp "params.offset" To iParamsOffset
Get ComStringOf Of hoJResp "params.page" To sParamsPage
Get ComStringOf Of hoJResp "params.shop_id" To sParamsShop_id
Get ComStringOf Of hoJResp "params.keywords" To sParamsKeywords
Get ComStringOf Of hoJResp "params.sort_on" To sParamsSort_on
Get ComStringOf Of hoJResp "params.sort_order" To sParamsSort_order
Get ComStringOf Of hoJResp "params.min_price" To sParamsMin_price
Get ComStringOf Of hoJResp "params.max_price" To sParamsMax_price
Get ComStringOf Of hoJResp "params.color" To sParamsColor
Get ComIntOf Of hoJResp "params.color_accuracy" To iParamsColor_accuracy
Get ComStringOf Of hoJResp "params.tags" To sParamsTags
Get ComStringOf Of hoJResp "params.category" To sParamsCategory
Get ComStringOf Of hoJResp "params.translate_keywords" To sParamsTranslate_keywords
Get ComIntOf Of hoJResp "params.include_private" To iParamsInclude_private
Get ComStringOf Of hoJResp "type" To sV_type
Get ComIntOf Of hoJResp "pagination.effective_limit" To iPaginationEffective_limit
Get ComIntOf Of hoJResp "pagination.effective_offset" To iPaginationEffective_offset
Get ComIntOf Of hoJResp "pagination.next_offset" To iPaginationNext_offset
Get ComIntOf Of hoJResp "pagination.effective_page" To iPaginationEffective_page
Get ComIntOf Of hoJResp "pagination.next_page" To iPaginationNext_page
Move 0 To i
Get ComSizeOfArray Of hoJResp "results" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComIntOf Of hoJResp "results[i].listing_id" To iListing_id
Get ComStringOf Of hoJResp "results[i].state" To sState
Get ComIntOf Of hoJResp "results[i].user_id" To iUser_id
Get ComIntOf Of hoJResp "results[i].category_id" To iCategory_id
Get ComStringOf Of hoJResp "results[i].title" To sTitle
Get ComStringOf Of hoJResp "results[i].description" To sDescription
Get ComIntOf Of hoJResp "results[i].creation_tsz" To iCreation_tsz
Get ComIntOf Of hoJResp "results[i].ending_tsz" To iEnding_tsz
Get ComIntOf Of hoJResp "results[i].original_creation_tsz" To iOriginal_creation_tsz
Get ComIntOf Of hoJResp "results[i].last_modified_tsz" To iLast_modified_tsz
Get ComStringOf Of hoJResp "results[i].price" To sPrice
Get ComStringOf Of hoJResp "results[i].currency_code" To sCurrency_code
Get ComIntOf Of hoJResp "results[i].quantity" To iQuantity
Get ComIntOf Of hoJResp "results[i].shop_section_id" To iShop_section_id
Get ComStringOf Of hoJResp "results[i].featured_rank" To sFeatured_rank
Get ComIntOf Of hoJResp "results[i].state_tsz" To iState_tsz
Get ComStringOf Of hoJResp "results[i].url" To sUrl
Get ComIntOf Of hoJResp "results[i].views" To iViews
Get ComIntOf Of hoJResp "results[i].num_favorers" To iNum_favorers
Get ComStringOf Of hoJResp "results[i].shipping_template_id" To sShipping_template_id
Get ComIntOf Of hoJResp "results[i].processing_min" To iProcessing_min
Get ComIntOf Of hoJResp "results[i].processing_max" To iProcessing_max
Get ComStringOf Of hoJResp "results[i].who_made" To sWho_made
Get ComStringOf Of hoJResp "results[i].is_supply" To sIs_supply
Get ComStringOf Of hoJResp "results[i].when_made" To sWhen_made
Get ComStringOf Of hoJResp "results[i].item_weight" To sItem_weight
Get ComStringOf Of hoJResp "results[i].item_weight_unit" To sItem_weight_unit
Get ComStringOf Of hoJResp "results[i].item_length" To sItem_length
Get ComStringOf Of hoJResp "results[i].item_width" To sItem_width
Get ComStringOf Of hoJResp "results[i].item_height" To sItem_height
Get ComStringOf Of hoJResp "results[i].item_dimensions_unit" To sItem_dimensions_unit
Get ComBoolOf Of hoJResp "results[i].is_private" To iIs_private
Get ComStringOf Of hoJResp "results[i].recipient" To sRecipient
Get ComStringOf Of hoJResp "results[i].occasion" To sOccasion
Get ComStringOf Of hoJResp "results[i].style" To sStyle
Get ComBoolOf Of hoJResp "results[i].non_taxable" To iNon_taxable
Get ComBoolOf Of hoJResp "results[i].is_customizable" To iIs_customizable
Get ComBoolOf Of hoJResp "results[i].is_digital" To iIs_digital
Get ComStringOf Of hoJResp "results[i].file_data" To sFile_data
Get ComBoolOf Of hoJResp "results[i].should_auto_renew" To iShould_auto_renew
Get ComStringOf Of hoJResp "results[i].language" To sLanguage
Get ComBoolOf Of hoJResp "results[i].has_variations" To iHas_variations
Get ComIntOf Of hoJResp "results[i].taxonomy_id" To iTaxonomy_id
Get ComBoolOf Of hoJResp "results[i].used_manufacturer" To iUsed_manufacturer
Move 0 To j
Get ComSizeOfArray Of hoJResp "results[i].sku" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "results[i].tags" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "results[i].tags[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "results[i].category_path" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "results[i].category_path[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "results[i].category_path_ids" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComIntOf Of hoJResp "results[i].category_path_ids[j]" To iIntVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "results[i].materials" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "results[i].materials[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "results[i].taxonomy_path" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "results[i].taxonomy_path[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "results[i].style" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "results[i].style[j]" To sStrVal
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure