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
(Visual Basic 6.0) MercadoLibre - Search Orders from a BuyerSearch for orders from a buyer. For more information, see https://developers.mercadolibre.com.ar/es_ar/gestiona-ventas#Como-filtrar
' This example assumes the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. Dim http As New ChilkatHttp ' First get our previously obtained OAuth2 access token. Dim jsonToken As New ChilkatJsonObject Dim success As Long success = jsonToken.LoadFile("qa_data/tokens/mercadolibre.json") ' Implements the following CURL command: ' curl -X GET https://api.mercadolibre.com/orders/search?buyer=$BUYER_ID&access_token=$ACCESS_TOKEN ' Use the following online tool to generate HTTP code from a CURL command ' Convert a cURL Command to HTTP Source Code success = http.SetUrlVar("access_token",jsonToken.StringOf("access_token")) ' Use an actual buyer ID here.. success = http.SetUrlVar("buyer_id","577815702") Dim sbResponseBody As New ChilkatStringBuilder success = http.QuickGetSb("https://api.mercadolibre.com/orders/search?buyer={$buyer_id}&access_token={$access_token}",sbResponseBody) If (success = 0) Then Debug.Print http.LastErrorText Debug.Print "Response Header:" Debug.Print http.LastHeader Debug.Print "----" Debug.Print "Response Body:" Debug.Print sbResponseBody.GetAsString() Debug.Print "Failed." Exit Sub End If Dim jResp As New ChilkatJsonObject success = jResp.LoadSb(sbResponseBody) jResp.EmitCompact = 0 Debug.Print "Response Body:" Debug.Print jResp.Emit() Dim respStatusCode As Long respStatusCode = http.LastStatus Debug.Print "Response Status Code = " & respStatusCode If (respStatusCode >= 400) Then Debug.Print "Response Header:" Debug.Print http.LastHeader Debug.Print "----" Debug.Print "Response Body:" Debug.Print sbResponseBody.GetAsString() Debug.Print "Failed." Exit Sub End If ' Sample JSON response: ' (Sample code for parsing the JSON response is shown below) ' { ' "query": "2032217210", ' "results": [ ' { ' "seller": { ' "phone": { ' "number": "11971427863", ' "extension": "", ' "area_code": null, ' "verified": false ' }, ' "alternative_phone": { ' "number": "", ' "extension": "", ' "area_code": "" ' }, ' "nickname": "VENDASDKMB", ' "last_name": "Cheracomo", ' "id": 239432672, ' "first_name": "Demétrio", ' "email": "dcherac.8m6k0q+2-ogiydgmrsge3tenby@mail.mercadolivre.com" ' }, ' "payments": [ ' { ' "reason": "Kit Com 03 Adesivo Spray 3m 75 Cola Silk Sublimação 300g", ' "status_code": null, ' "total_paid_amount": 129.95, ' "operation_type": "regular_payment", ' "transaction_amount": 129.95, ' "date_approved": "2019-05-22T03:51:07.000-04:00", ' "collector": { ' "id": 239432672 ' }, ' "coupon_id": null, ' "installments": 1, ' "authorization_code": "008877", ' "taxes_amount": 0, ' "id": 4792155710, ' "date_last_modified": "2019-05-22T03:51:07.000-04:00", ' "coupon_amount": 0, ' "available_actions": [ ' "refund" ' ], ' "shipping_cost": 0, ' "installment_amount": 129.95, ' "date_created": "2019-05-22T03:51:05.000-04:00", ' "activation_uri": null, ' "overpaid_amount": 0, ' "card_id": 203453778, ' "status_detail": "accredited", ' "issuer_id": "24", ' "payment_method_id": "master", ' "payment_type": "credit_card", ' "deferred_period": null, ' "atm_transfer_reference": { ' "transaction_id": "135292", ' "company_id": null ' }, ' "site_id": "MLB", ' "payer_id": 89660613, ' "marketplace_fee": 14.290000000000001, ' "order_id": 2032217210, ' "currency_id": "BRL", ' "status": "approved", ' "transaction_order_id": null ' } ' ], ' "fulfilled": true, ' "buying_mode": "buy_equals_pay", ' "taxes": { ' "amount": null, ' "currency_id": null ' }, ' "order_request": { ' "change": null, ' "return": null ' }, ' "expiration_date": "2019-06-19T03:51:07.000-04:00", ' "feedback": { ' "sale": null, ' "purchase": null ' }, ' "shipping": { ' "id": 27968238880 ' }, ' "date_closed": "2019-05-22T03:51:07.000-04:00", ' "id": 2032217210, ' "manufacturing_ending_date": null, ' "hidden_for_seller": false, ' "order_items": [ ' { ' "item": { ' "seller_custom_field": null, ' "condition": "new", ' "category_id": "MLB33383", ' "variation_id": null, ' "variation_attributes": [ ' ], ' "seller_sku": null, ' "warranty": "Garantia de 1 ano fabricante", ' "id": "MLB1054990648", ' "title": "Kit Com 03 Adesivo Spray 3m 75 Cola Silk Sublimação 300g" ' }, ' "quantity": 1, ' "differential_pricing_id": null, ' "sale_fee": 14.29, ' "listing_type_id": "gold_special", ' "base_currency_id": null, ' "unit_price": 129.95, ' "full_unit_price": 129.95, ' "base_exchange_rate": null, ' "currency_id": "BRL", ' "manufacturing_days": null ' } ' ], ' "date_last_updated": "2020-02-14T02:55:49.811Z", ' "last_updated": "2019-05-28T15:16:04.000-04:00", ' "comments": null, ' "pack_id": null, ' "coupon": { ' "amount": 0, ' "id": null ' }, ' "shipping_cost": 0, ' "date_created": "2019-05-22T03:51:05.000-04:00", ' "application_id": "7092", ' "pickup_id": null, ' "status_detail": null, ' "tags": [ ' "delivered", ' "paid" ' ], ' "buyer": { ' "billing_info": { ' "doc_number": "02183212950", ' "doc_type": "CPF" ' }, ' "phone": { ' "number": "99962663", ' "extension": "", ' "area_code": "41", ' "verified": false ' }, ' "alternative_phone": { ' "number": "30576339", ' "extension": "", ' "area_code": "41" ' }, ' "nickname": "S.VICTORHUGO", ' "last_name": "Schemberger", ' "id": 89660613, ' "first_name": "Victor Hugo", ' "email": "vschemb.y14cdz+2-ogiydgmrsge3tenbz@mail.mercadolivre.com" ' }, ' "total_amount": 129.95, ' "paid_amount": 129.95, ' "mediations": [ ' ], ' "currency_id": "BRL", ' "status": "paid" ' } ' ], ' "sort": { ' "id": "date_asc", ' "name": "Date ascending" ' }, ' "available_sorts": [ ' { ' "id": "date_desc", ' "name": "Date descending" ' } ' ], ' "filters": [ ' ], ' "paging": { ' "total": 1, ' "offset": 0, ' "limit": 50 ' }, ' "display": "complete" ' } ' Sample code for parsing the JSON response... ' Use the following online tool to generate parsing code from sample JSON: ' Generate Parsing Code from JSON Dim date_closed As New DtObj Dim date_last_updated As New DtObj Dim date_created As New DtObj Dim date_approved As New DtObj Dim date_last_modified As New DtObj Dim sellerPhoneNumber As String Dim sellerPhoneExtension As String Dim sellerPhoneArea_code As String Dim sellerPhoneVerified As Long Dim sellerAlternative_phoneNumber As String Dim sellerAlternative_phoneExtension As String Dim sellerAlternative_phoneArea_code As String Dim sellerNickname As String Dim sellerLast_name As String Dim sellerId As Long Dim sellerFirst_name As String Dim sellerEmail As String Dim fulfilled As Long Dim buying_mode As String Dim taxesAmount As String Dim taxesCurrency_id As String Dim order_requestChange As String Dim order_requestReturn As String Dim expiration_date As String Dim feedbackSale As String Dim feedbackPurchase As String Dim shippingId As Long Dim id As Long Dim manufacturing_ending_date As String Dim hidden_for_seller As Long Dim last_updated As String Dim comments As String Dim pack_id As String Dim couponAmount As Long Dim couponId As String Dim shipping_cost As Long Dim application_id As String Dim pickup_id As String Dim status_detail As String Dim buyerBilling_infoDoc_number As String Dim buyerBilling_infoDoc_type As String Dim buyerPhoneNumber As String Dim buyerPhoneExtension As String Dim buyerPhoneArea_code As String Dim buyerPhoneVerified As Long Dim buyerAlternative_phoneNumber As String Dim buyerAlternative_phoneExtension As String Dim buyerAlternative_phoneArea_code As String Dim buyerNickname As String Dim buyerLast_name As String Dim buyerId As Long Dim buyerFirst_name As String Dim buyerEmail As String Dim total_amount As String Dim paid_amount As String Dim currency_id As String Dim status As String Dim j As Long Dim count_j As Long Dim reason As String Dim status_code As String Dim total_paid_amount As String Dim operation_type As String Dim transaction_amount As String Dim collectorId As Long Dim coupon_id As String Dim installments As Long Dim authorization_code As String Dim taxes_amount As Long Dim coupon_amount As Long Dim installment_amount As String Dim activation_uri As String Dim overpaid_amount As Long Dim card_id As Long Dim issuer_id As String Dim payment_method_id As String Dim payment_type As String Dim deferred_period As String Dim atm_transfer_referenceTransaction_id As String Dim atm_transfer_referenceCompany_id As String Dim site_id As String Dim payer_id As Long Dim marketplace_fee As String Dim order_id As Long Dim transaction_order_id As String Dim k As Long Dim count_k As Long Dim strVal As String Dim itemSeller_custom_field As String Dim itemCondition As String Dim itemCategory_id As String Dim itemVariation_id As String Dim itemSeller_sku As String Dim itemWarranty As String Dim itemId As String Dim itemTitle As String Dim quantity As Long Dim differential_pricing_id As String Dim sale_fee As String Dim listing_type_id As String Dim base_currency_id As String Dim unit_price As String Dim full_unit_price As String Dim base_exchange_rate As String Dim manufacturing_days As String Dim id_str As String Dim name As String Dim query As String query = jResp.StringOf("query") Dim sortId As String sortId = jResp.StringOf("sort.id") Dim sortName As String sortName = jResp.StringOf("sort.name") Dim pagingTotal As Long pagingTotal = jResp.IntOf("paging.total") Dim pagingOffset As Long pagingOffset = jResp.IntOf("paging.offset") Dim pagingLimit As Long pagingLimit = jResp.IntOf("paging.limit") Dim display As String display = jResp.StringOf("display") Dim i As Long i = 0 Dim count_i As Long count_i = jResp.SizeOfArray("results") Do While i < count_i jResp.I = i sellerPhoneNumber = jResp.StringOf("results[i].seller.phone.number") sellerPhoneExtension = jResp.StringOf("results[i].seller.phone.extension") sellerPhoneArea_code = jResp.StringOf("results[i].seller.phone.area_code") sellerPhoneVerified = jResp.BoolOf("results[i].seller.phone.verified") sellerAlternative_phoneNumber = jResp.StringOf("results[i].seller.alternative_phone.number") sellerAlternative_phoneExtension = jResp.StringOf("results[i].seller.alternative_phone.extension") sellerAlternative_phoneArea_code = jResp.StringOf("results[i].seller.alternative_phone.area_code") sellerNickname = jResp.StringOf("results[i].seller.nickname") sellerLast_name = jResp.StringOf("results[i].seller.last_name") sellerId = jResp.IntOf("results[i].seller.id") sellerFirst_name = jResp.StringOf("results[i].seller.first_name") sellerEmail = jResp.StringOf("results[i].seller.email") fulfilled = jResp.BoolOf("results[i].fulfilled") buying_mode = jResp.StringOf("results[i].buying_mode") taxesAmount = jResp.StringOf("results[i].taxes.amount") taxesCurrency_id = jResp.StringOf("results[i].taxes.currency_id") order_requestChange = jResp.StringOf("results[i].order_request.change") order_requestReturn = jResp.StringOf("results[i].order_request.return") expiration_date = jResp.StringOf("results[i].expiration_date") feedbackSale = jResp.StringOf("results[i].feedback.sale") feedbackPurchase = jResp.StringOf("results[i].feedback.purchase") shippingId = jResp.IntOf("results[i].shipping.id") success = jResp.DtOf("results[i].date_closed",0,date_closed) id = jResp.IntOf("results[i].id") manufacturing_ending_date = jResp.StringOf("results[i].manufacturing_ending_date") hidden_for_seller = jResp.BoolOf("results[i].hidden_for_seller") success = jResp.DtOf("results[i].date_last_updated",0,date_last_updated) last_updated = jResp.StringOf("results[i].last_updated") comments = jResp.StringOf("results[i].comments") pack_id = jResp.StringOf("results[i].pack_id") couponAmount = jResp.IntOf("results[i].coupon.amount") couponId = jResp.StringOf("results[i].coupon.id") shipping_cost = jResp.IntOf("results[i].shipping_cost") success = jResp.DtOf("results[i].date_created",0,date_created) application_id = jResp.StringOf("results[i].application_id") pickup_id = jResp.StringOf("results[i].pickup_id") status_detail = jResp.StringOf("results[i].status_detail") buyerBilling_infoDoc_number = jResp.StringOf("results[i].buyer.billing_info.doc_number") buyerBilling_infoDoc_type = jResp.StringOf("results[i].buyer.billing_info.doc_type") buyerPhoneNumber = jResp.StringOf("results[i].buyer.phone.number") buyerPhoneExtension = jResp.StringOf("results[i].buyer.phone.extension") buyerPhoneArea_code = jResp.StringOf("results[i].buyer.phone.area_code") buyerPhoneVerified = jResp.BoolOf("results[i].buyer.phone.verified") buyerAlternative_phoneNumber = jResp.StringOf("results[i].buyer.alternative_phone.number") buyerAlternative_phoneExtension = jResp.StringOf("results[i].buyer.alternative_phone.extension") buyerAlternative_phoneArea_code = jResp.StringOf("results[i].buyer.alternative_phone.area_code") buyerNickname = jResp.StringOf("results[i].buyer.nickname") buyerLast_name = jResp.StringOf("results[i].buyer.last_name") buyerId = jResp.IntOf("results[i].buyer.id") buyerFirst_name = jResp.StringOf("results[i].buyer.first_name") buyerEmail = jResp.StringOf("results[i].buyer.email") total_amount = jResp.StringOf("results[i].total_amount") paid_amount = jResp.StringOf("results[i].paid_amount") currency_id = jResp.StringOf("results[i].currency_id") status = jResp.StringOf("results[i].status") j = 0 count_j = jResp.SizeOfArray("results[i].payments") Do While j < count_j jResp.J = j reason = jResp.StringOf("results[i].payments[j].reason") status_code = jResp.StringOf("results[i].payments[j].status_code") total_paid_amount = jResp.StringOf("results[i].payments[j].total_paid_amount") operation_type = jResp.StringOf("results[i].payments[j].operation_type") transaction_amount = jResp.StringOf("results[i].payments[j].transaction_amount") success = jResp.DtOf("results[i].payments[j].date_approved",0,date_approved) collectorId = jResp.IntOf("results[i].payments[j].collector.id") coupon_id = jResp.StringOf("results[i].payments[j].coupon_id") installments = jResp.IntOf("results[i].payments[j].installments") authorization_code = jResp.StringOf("results[i].payments[j].authorization_code") taxes_amount = jResp.IntOf("results[i].payments[j].taxes_amount") id = jResp.IntOf("results[i].payments[j].id") success = jResp.DtOf("results[i].payments[j].date_last_modified",0,date_last_modified) coupon_amount = jResp.IntOf("results[i].payments[j].coupon_amount") shipping_cost = jResp.IntOf("results[i].payments[j].shipping_cost") installment_amount = jResp.StringOf("results[i].payments[j].installment_amount") success = jResp.DtOf("results[i].payments[j].date_created",0,date_created) activation_uri = jResp.StringOf("results[i].payments[j].activation_uri") overpaid_amount = jResp.IntOf("results[i].payments[j].overpaid_amount") card_id = jResp.IntOf("results[i].payments[j].card_id") status_detail = jResp.StringOf("results[i].payments[j].status_detail") issuer_id = jResp.StringOf("results[i].payments[j].issuer_id") payment_method_id = jResp.StringOf("results[i].payments[j].payment_method_id") payment_type = jResp.StringOf("results[i].payments[j].payment_type") deferred_period = jResp.StringOf("results[i].payments[j].deferred_period") atm_transfer_referenceTransaction_id = jResp.StringOf("results[i].payments[j].atm_transfer_reference.transaction_id") atm_transfer_referenceCompany_id = jResp.StringOf("results[i].payments[j].atm_transfer_reference.company_id") site_id = jResp.StringOf("results[i].payments[j].site_id") payer_id = jResp.IntOf("results[i].payments[j].payer_id") marketplace_fee = jResp.StringOf("results[i].payments[j].marketplace_fee") order_id = jResp.IntOf("results[i].payments[j].order_id") currency_id = jResp.StringOf("results[i].payments[j].currency_id") status = jResp.StringOf("results[i].payments[j].status") transaction_order_id = jResp.StringOf("results[i].payments[j].transaction_order_id") k = 0 count_k = jResp.SizeOfArray("results[i].payments[j].available_actions") Do While k < count_k jResp.K = k strVal = jResp.StringOf("results[i].payments[j].available_actions[k]") k = k + 1 Loop j = j + 1 Loop j = 0 count_j = jResp.SizeOfArray("results[i].order_items") Do While j < count_j jResp.J = j itemSeller_custom_field = jResp.StringOf("results[i].order_items[j].item.seller_custom_field") itemCondition = jResp.StringOf("results[i].order_items[j].item.condition") itemCategory_id = jResp.StringOf("results[i].order_items[j].item.category_id") itemVariation_id = jResp.StringOf("results[i].order_items[j].item.variation_id") itemSeller_sku = jResp.StringOf("results[i].order_items[j].item.seller_sku") itemWarranty = jResp.StringOf("results[i].order_items[j].item.warranty") itemId = jResp.StringOf("results[i].order_items[j].item.id") itemTitle = jResp.StringOf("results[i].order_items[j].item.title") quantity = jResp.IntOf("results[i].order_items[j].quantity") differential_pricing_id = jResp.StringOf("results[i].order_items[j].differential_pricing_id") sale_fee = jResp.StringOf("results[i].order_items[j].sale_fee") listing_type_id = jResp.StringOf("results[i].order_items[j].listing_type_id") base_currency_id = jResp.StringOf("results[i].order_items[j].base_currency_id") unit_price = jResp.StringOf("results[i].order_items[j].unit_price") full_unit_price = jResp.StringOf("results[i].order_items[j].full_unit_price") base_exchange_rate = jResp.StringOf("results[i].order_items[j].base_exchange_rate") currency_id = jResp.StringOf("results[i].order_items[j].currency_id") manufacturing_days = jResp.StringOf("results[i].order_items[j].manufacturing_days") k = 0 count_k = jResp.SizeOfArray("results[i].order_items[j].item.variation_attributes") Do While k < count_k jResp.K = k k = k + 1 Loop j = j + 1 Loop j = 0 count_j = jResp.SizeOfArray("results[i].tags") Do While j < count_j jResp.J = j strVal = jResp.StringOf("results[i].tags[j]") j = j + 1 Loop j = 0 count_j = jResp.SizeOfArray("results[i].mediations") Do While j < count_j jResp.J = j j = j + 1 Loop i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("available_sorts") Do While i < count_i jResp.I = i id_str = jResp.StringOf("available_sorts[i].id") name = jResp.StringOf("available_sorts[i].name") i = i + 1 Loop i = 0 count_i = jResp.SizeOfArray("filters") Do While i < count_i jResp.I = i i = i + 1 Loop |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.