Sample code for 30+ languages & platforms
Visual FoxPro

Etsy: Find a Shop's Active Listings

See more Etsy Examples

Finds all active Listings associated with a Shop.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loHttp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lnListing_id
LOCAL lcState
LOCAL lnUser_id
LOCAL lnCategory_id
LOCAL lcTitle
LOCAL lcDescription
LOCAL lnCreation_tsz
LOCAL lnEnding_tsz
LOCAL lnOriginal_creation_tsz
LOCAL lnLast_modified_tsz
LOCAL lcPrice
LOCAL lcCurrency_code
LOCAL lnQuantity
LOCAL lnShop_section_id
LOCAL lcFeatured_rank
LOCAL lnState_tsz
LOCAL lcUrl
LOCAL lnViews
LOCAL lnNum_favorers
LOCAL lcShipping_template_id
LOCAL lnProcessing_min
LOCAL lnProcessing_max
LOCAL lcWho_made
LOCAL lcIs_supply
LOCAL lcWhen_made
LOCAL lcItem_weight
LOCAL lcItem_weight_unit
LOCAL lcItem_length
LOCAL lcItem_width
LOCAL lcItem_height
LOCAL lcItem_dimensions_unit
LOCAL lnIs_private
LOCAL lcRecipient
LOCAL lcOccasion
LOCAL lcStyle
LOCAL lnNon_taxable
LOCAL lnIs_customizable
LOCAL lnIs_digital
LOCAL lcFile_data
LOCAL lnShould_auto_renew
LOCAL lcLanguage
LOCAL lnHas_variations
LOCAL lnTaxonomy_id
LOCAL lnUsed_manufacturer
LOCAL j
LOCAL lnCount_j
LOCAL lcStrVal
LOCAL lnIntVal
LOCAL lnCount
LOCAL lcParamsLimit
LOCAL lnParamsOffset
LOCAL lcParamsPage
LOCAL lcParamsShop_id
LOCAL lcParamsKeywords
LOCAL lcParamsSort_on
LOCAL lcParamsSort_order
LOCAL lcParamsMin_price
LOCAL lcParamsMax_price
LOCAL lcParamsColor
LOCAL lnParamsColor_accuracy
LOCAL lcParamsTags
LOCAL lcParamsCategory
LOCAL lcParamsTranslate_keywords
LOCAL lnParamsInclude_private
LOCAL lcV_type
LOCAL lnPaginationEffective_limit
LOCAL lnPaginationEffective_offset
LOCAL lnPaginationNext_offset
LOCAL lnPaginationEffective_page
LOCAL lnPaginationNext_page
LOCAL i
LOCAL lnCount_i

lnSuccess = 0

* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loHttp = CreateObject('Chilkat.Http')

* 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

loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://openapi.etsy.com/v2/shops/shop_id/listings/active?api_key=MY_ETSY_KEYSTRING&limit=2",loSbResponseBody)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loSbResponseBody
    CANCEL
ENDIF

loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loHttp.LastHeader
    ? "Failed."
    RELEASE loHttp
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

* 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

lnCount = loJResp.IntOf("count")
lcParamsLimit = loJResp.StringOf("params.limit")
lnParamsOffset = loJResp.IntOf("params.offset")
lcParamsPage = loJResp.StringOf("params.page")
lcParamsShop_id = loJResp.StringOf("params.shop_id")
lcParamsKeywords = loJResp.StringOf("params.keywords")
lcParamsSort_on = loJResp.StringOf("params.sort_on")
lcParamsSort_order = loJResp.StringOf("params.sort_order")
lcParamsMin_price = loJResp.StringOf("params.min_price")
lcParamsMax_price = loJResp.StringOf("params.max_price")
lcParamsColor = loJResp.StringOf("params.color")
lnParamsColor_accuracy = loJResp.IntOf("params.color_accuracy")
lcParamsTags = loJResp.StringOf("params.tags")
lcParamsCategory = loJResp.StringOf("params.category")
lcParamsTranslate_keywords = loJResp.StringOf("params.translate_keywords")
lnParamsInclude_private = loJResp.IntOf("params.include_private")
lcV_type = loJResp.StringOf("type")
lnPaginationEffective_limit = loJResp.IntOf("pagination.effective_limit")
lnPaginationEffective_offset = loJResp.IntOf("pagination.effective_offset")
lnPaginationNext_offset = loJResp.IntOf("pagination.next_offset")
lnPaginationEffective_page = loJResp.IntOf("pagination.effective_page")
lnPaginationNext_page = loJResp.IntOf("pagination.next_page")
i = 0
lnCount_i = loJResp.SizeOfArray("results")
DO WHILE i < lnCount_i
    loJResp.I = i
    lnListing_id = loJResp.IntOf("results[i].listing_id")
    lcState = loJResp.StringOf("results[i].state")
    lnUser_id = loJResp.IntOf("results[i].user_id")
    lnCategory_id = loJResp.IntOf("results[i].category_id")
    lcTitle = loJResp.StringOf("results[i].title")
    lcDescription = loJResp.StringOf("results[i].description")
    lnCreation_tsz = loJResp.IntOf("results[i].creation_tsz")
    lnEnding_tsz = loJResp.IntOf("results[i].ending_tsz")
    lnOriginal_creation_tsz = loJResp.IntOf("results[i].original_creation_tsz")
    lnLast_modified_tsz = loJResp.IntOf("results[i].last_modified_tsz")
    lcPrice = loJResp.StringOf("results[i].price")
    lcCurrency_code = loJResp.StringOf("results[i].currency_code")
    lnQuantity = loJResp.IntOf("results[i].quantity")
    lnShop_section_id = loJResp.IntOf("results[i].shop_section_id")
    lcFeatured_rank = loJResp.StringOf("results[i].featured_rank")
    lnState_tsz = loJResp.IntOf("results[i].state_tsz")
    lcUrl = loJResp.StringOf("results[i].url")
    lnViews = loJResp.IntOf("results[i].views")
    lnNum_favorers = loJResp.IntOf("results[i].num_favorers")
    lcShipping_template_id = loJResp.StringOf("results[i].shipping_template_id")
    lnProcessing_min = loJResp.IntOf("results[i].processing_min")
    lnProcessing_max = loJResp.IntOf("results[i].processing_max")
    lcWho_made = loJResp.StringOf("results[i].who_made")
    lcIs_supply = loJResp.StringOf("results[i].is_supply")
    lcWhen_made = loJResp.StringOf("results[i].when_made")
    lcItem_weight = loJResp.StringOf("results[i].item_weight")
    lcItem_weight_unit = loJResp.StringOf("results[i].item_weight_unit")
    lcItem_length = loJResp.StringOf("results[i].item_length")
    lcItem_width = loJResp.StringOf("results[i].item_width")
    lcItem_height = loJResp.StringOf("results[i].item_height")
    lcItem_dimensions_unit = loJResp.StringOf("results[i].item_dimensions_unit")
    lnIs_private = loJResp.BoolOf("results[i].is_private")
    lcRecipient = loJResp.StringOf("results[i].recipient")
    lcOccasion = loJResp.StringOf("results[i].occasion")
    lcStyle = loJResp.StringOf("results[i].style")
    lnNon_taxable = loJResp.BoolOf("results[i].non_taxable")
    lnIs_customizable = loJResp.BoolOf("results[i].is_customizable")
    lnIs_digital = loJResp.BoolOf("results[i].is_digital")
    lcFile_data = loJResp.StringOf("results[i].file_data")
    lnShould_auto_renew = loJResp.BoolOf("results[i].should_auto_renew")
    lcLanguage = loJResp.StringOf("results[i].language")
    lnHas_variations = loJResp.BoolOf("results[i].has_variations")
    lnTaxonomy_id = loJResp.IntOf("results[i].taxonomy_id")
    lnUsed_manufacturer = loJResp.BoolOf("results[i].used_manufacturer")
    j = 0
    lnCount_j = loJResp.SizeOfArray("results[i].sku")
    DO WHILE j < lnCount_j
        loJResp.J = j
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("results[i].tags")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcStrVal = loJResp.StringOf("results[i].tags[j]")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("results[i].category_path")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcStrVal = loJResp.StringOf("results[i].category_path[j]")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("results[i].category_path_ids")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lnIntVal = loJResp.IntOf("results[i].category_path_ids[j]")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("results[i].materials")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcStrVal = loJResp.StringOf("results[i].materials[j]")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("results[i].taxonomy_path")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcStrVal = loJResp.StringOf("results[i].taxonomy_path[j]")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("results[i].style")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcStrVal = loJResp.StringOf("results[i].style[j]")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp