Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Swift 3,4,5...) Etsy: Find a Shop's Active ListingsFinds all active Listings associated with a Shop. For more information, see https://www.etsy.com/developers/documentation/reference/listing
func chilkatTest() { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. let http = CkoHttp()! var success: Bool // 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 let sbResponseBody = CkoStringBuilder()! success = http.quickGetSb("https://openapi.etsy.com/v2/shops/shop_id/listings/active?api_key=MY_ETSY_KEYSTRING&limit=2", sbContent: sbResponseBody) if success == false { print("\(http.lastErrorText!)") return } let jResp = CkoJsonObject()! jResp.loadSb(sbResponseBody) jResp.emitCompact = false print("Response Body:") print("\(jResp.emit()!)") var respStatusCode: Int = http.lastStatus.intValue print("Response Status Code = \(respStatusCode)") if respStatusCode >= 400 { print("Response Header:") print("\(http.lastHeader!)") print("Failed.") return } // 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 var listing_id: Int var state: String? var user_id: Int var category_id: Int var title: String? var description: String? var creation_tsz: Int var ending_tsz: Int var original_creation_tsz: Int var last_modified_tsz: Int var price: String? var currency_code: String? var quantity: Int var shop_section_id: Int var featured_rank: String? var state_tsz: Int var url: String? var views: Int var num_favorers: Int var shipping_template_id: String? var processing_min: Int var processing_max: Int var who_made: String? var is_supply: String? var when_made: String? var item_weight: String? var item_weight_unit: String? var item_length: String? var item_width: String? var item_height: String? var item_dimensions_unit: String? var is_private: Bool var recipient: String? var occasion: String? var style: String? var non_taxable: Bool var is_customizable: Bool var is_digital: Bool var file_data: String? var should_auto_renew: Bool var language: String? var has_variations: Bool var taxonomy_id: Int var used_manufacturer: Bool var j: Int var count_j: Int var strVal: String? var intVal: Int var count: Int = jResp.int(of: "count").intValue var paramsLimit: String? = jResp.string(of: "params.limit") var paramsOffset: Int = jResp.int(of: "params.offset").intValue var paramsPage: String? = jResp.string(of: "params.page") var paramsShop_id: String? = jResp.string(of: "params.shop_id") var paramsKeywords: String? = jResp.string(of: "params.keywords") var paramsSort_on: String? = jResp.string(of: "params.sort_on") var paramsSort_order: String? = jResp.string(of: "params.sort_order") var paramsMin_price: String? = jResp.string(of: "params.min_price") var paramsMax_price: String? = jResp.string(of: "params.max_price") var paramsColor: String? = jResp.string(of: "params.color") var paramsColor_accuracy: Int = jResp.int(of: "params.color_accuracy").intValue var paramsTags: String? = jResp.string(of: "params.tags") var paramsCategory: String? = jResp.string(of: "params.category") var paramsTranslate_keywords: String? = jResp.string(of: "params.translate_keywords") var paramsInclude_private: Int = jResp.int(of: "params.include_private").intValue var v_type: String? = jResp.string(of: "type") var paginationEffective_limit: Int = jResp.int(of: "pagination.effective_limit").intValue var paginationEffective_offset: Int = jResp.int(of: "pagination.effective_offset").intValue var paginationNext_offset: Int = jResp.int(of: "pagination.next_offset").intValue var paginationEffective_page: Int = jResp.int(of: "pagination.effective_page").intValue var paginationNext_page: Int = jResp.int(of: "pagination.next_page").intValue var i: Int = 0 var count_i: Int = jResp.size(ofArray: "results").intValue while i < count_i { jResp.i = i listing_id = jResp.int(of: "results[i].listing_id").intValue state = jResp.string(of: "results[i].state") user_id = jResp.int(of: "results[i].user_id").intValue category_id = jResp.int(of: "results[i].category_id").intValue title = jResp.string(of: "results[i].title") description = jResp.string(of: "results[i].description") creation_tsz = jResp.int(of: "results[i].creation_tsz").intValue ending_tsz = jResp.int(of: "results[i].ending_tsz").intValue original_creation_tsz = jResp.int(of: "results[i].original_creation_tsz").intValue last_modified_tsz = jResp.int(of: "results[i].last_modified_tsz").intValue price = jResp.string(of: "results[i].price") currency_code = jResp.string(of: "results[i].currency_code") quantity = jResp.int(of: "results[i].quantity").intValue shop_section_id = jResp.int(of: "results[i].shop_section_id").intValue featured_rank = jResp.string(of: "results[i].featured_rank") state_tsz = jResp.int(of: "results[i].state_tsz").intValue url = jResp.string(of: "results[i].url") views = jResp.int(of: "results[i].views").intValue num_favorers = jResp.int(of: "results[i].num_favorers").intValue shipping_template_id = jResp.string(of: "results[i].shipping_template_id") processing_min = jResp.int(of: "results[i].processing_min").intValue processing_max = jResp.int(of: "results[i].processing_max").intValue who_made = jResp.string(of: "results[i].who_made") is_supply = jResp.string(of: "results[i].is_supply") when_made = jResp.string(of: "results[i].when_made") item_weight = jResp.string(of: "results[i].item_weight") item_weight_unit = jResp.string(of: "results[i].item_weight_unit") item_length = jResp.string(of: "results[i].item_length") item_width = jResp.string(of: "results[i].item_width") item_height = jResp.string(of: "results[i].item_height") item_dimensions_unit = jResp.string(of: "results[i].item_dimensions_unit") is_private = jResp.bool(of: "results[i].is_private") recipient = jResp.string(of: "results[i].recipient") occasion = jResp.string(of: "results[i].occasion") style = jResp.string(of: "results[i].style") non_taxable = jResp.bool(of: "results[i].non_taxable") is_customizable = jResp.bool(of: "results[i].is_customizable") is_digital = jResp.bool(of: "results[i].is_digital") file_data = jResp.string(of: "results[i].file_data") should_auto_renew = jResp.bool(of: "results[i].should_auto_renew") language = jResp.string(of: "results[i].language") has_variations = jResp.bool(of: "results[i].has_variations") taxonomy_id = jResp.int(of: "results[i].taxonomy_id").intValue used_manufacturer = jResp.bool(of: "results[i].used_manufacturer") j = 0 count_j = jResp.size(ofArray: "results[i].sku").intValue while j < count_j { jResp.j = j j = j + 1 } j = 0 count_j = jResp.size(ofArray: "results[i].tags").intValue while j < count_j { jResp.j = j strVal = jResp.string(of: "results[i].tags[j]") j = j + 1 } j = 0 count_j = jResp.size(ofArray: "results[i].category_path").intValue while j < count_j { jResp.j = j strVal = jResp.string(of: "results[i].category_path[j]") j = j + 1 } j = 0 count_j = jResp.size(ofArray: "results[i].category_path_ids").intValue while j < count_j { jResp.j = j intVal = jResp.int(of: "results[i].category_path_ids[j]").intValue j = j + 1 } j = 0 count_j = jResp.size(ofArray: "results[i].materials").intValue while j < count_j { jResp.j = j strVal = jResp.string(of: "results[i].materials[j]") j = j + 1 } j = 0 count_j = jResp.size(ofArray: "results[i].taxonomy_path").intValue while j < count_j { jResp.j = j strVal = jResp.string(of: "results[i].taxonomy_path[j]") j = j + 1 } j = 0 count_j = jResp.size(ofArray: "results[i].style").intValue while j < count_j { jResp.j = j strVal = jResp.string(of: "results[i].style[j]") j = j + 1 } i = i + 1 } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.