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
(AutoIt) 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. $oHttp = ObjCreate("Chilkat.Http") ; First get our previously obtained OAuth2 access token. $oJsonToken = ObjCreate("Chilkat.JsonObject") Local $bSuccess = $oJsonToken.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 $oHttp.SetUrlVar("access_token",$oJsonToken.StringOf("access_token")) ; Use an actual buyer ID here.. $oHttp.SetUrlVar("buyer_id","577815702") $oSbResponseBody = ObjCreate("Chilkat.StringBuilder") $bSuccess = $oHttp.QuickGetSb("https://api.mercadolibre.com/orders/search?buyer={$buyer_id}&access_token={$access_token}",$oSbResponseBody) If ($bSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) ConsoleWrite("Response Header:" & @CRLF) ConsoleWrite($oHttp.LastHeader & @CRLF) ConsoleWrite("----" & @CRLF) ConsoleWrite("Response Body:" & @CRLF) ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF) ConsoleWrite("Failed." & @CRLF) Exit EndIf $oJResp = ObjCreate("Chilkat.JsonObject") $oJResp.LoadSb($oSbResponseBody) $oJResp.EmitCompact = False ConsoleWrite("Response Body:" & @CRLF) ConsoleWrite($oJResp.Emit() & @CRLF) Local $iRespStatusCode = $oHttp.LastStatus ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF) If ($iRespStatusCode >= 400) Then ConsoleWrite("Response Header:" & @CRLF) ConsoleWrite($oHttp.LastHeader & @CRLF) ConsoleWrite("----" & @CRLF) ConsoleWrite("Response Body:" & @CRLF) ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF) ConsoleWrite("Failed." & @CRLF) Exit EndIf ; 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 $oDate_closed = ObjCreate("Chilkat.DtObj") $oDate_last_updated = ObjCreate("Chilkat.DtObj") $oDate_created = ObjCreate("Chilkat.DtObj") $oDate_approved = ObjCreate("Chilkat.DtObj") $oDate_last_modified = ObjCreate("Chilkat.DtObj") Local $sellerPhoneNumber Local $sellerPhoneExtension Local $sellerPhoneArea_code Local $bSellerPhoneVerified Local $sellerAlternative_phoneNumber Local $sellerAlternative_phoneExtension Local $sellerAlternative_phoneArea_code Local $sellerNickname Local $sellerLast_name Local $iSellerId Local $sellerFirst_name Local $sellerEmail Local $bFulfilled Local $sBuying_mode Local $sTaxesAmount Local $sTaxesCurrency_id Local $sOrder_requestChange Local $sOrder_requestReturn Local $sExpiration_date Local $sFeedbackSale Local $sFeedbackPurchase Local $iShippingId Local $id Local $sManufacturing_ending_date Local $bHidden_for_seller Local $sLast_updated Local $sComments Local $sPack_id Local $iCouponAmount Local $sCouponId Local $iShipping_cost Local $sApplication_id Local $sPickup_id Local $status_detail Local $sBuyerBilling_infoDoc_number Local $sBuyerBilling_infoDoc_type Local $sBuyerPhoneNumber Local $sBuyerPhoneExtension Local $sBuyerPhoneArea_code Local $buyerPhoneVerified Local $sBuyerAlternative_phoneNumber Local $sBuyerAlternative_phoneExtension Local $sBuyerAlternative_phoneArea_code Local $sBuyerNickname Local $sBuyerLast_name Local $iBuyerId Local $sBuyerFirst_name Local $sBuyerEmail Local $sTotal_amount Local $sPaid_amount Local $sCurrency_id Local $status Local $iJ Local $iCount_j Local $sReason Local $status_code Local $sTotal_paid_amount Local $sOperation_type Local $sTransaction_amount Local $iCollectorId Local $sCoupon_id Local $installments Local $sAuthorization_code Local $iTaxes_amount Local $iCoupon_amount Local $sInstallment_amount Local $sActivation_uri Local $iOverpaid_amount Local $iCard_id Local $sIssuer_id Local $sPayment_method_id Local $sPayment_type Local $sDeferred_period Local $sAtm_transfer_referenceTransaction_id Local $sAtm_transfer_referenceCompany_id Local $site_id Local $iPayer_id Local $sMarketplace_fee Local $iOrder_id Local $sTransaction_order_id Local $iK Local $iCount_k Local $strVal Local $sItemSeller_custom_field Local $sItemCondition Local $sItemCategory_id Local $sItemVariation_id Local $sItemSeller_sku Local $sItemWarranty Local $sItemId Local $sItemTitle Local $iQuantity Local $sDifferential_pricing_id Local $sale_fee Local $sListing_type_id Local $sBase_currency_id Local $sUnit_price Local $sFull_unit_price Local $sBase_exchange_rate Local $sManufacturing_days Local $sId_str Local $sName Local $sQuery = $oJResp.StringOf("query") Local $sortId = $oJResp.StringOf("sort.id") Local $sortName = $oJResp.StringOf("sort.name") Local $iPagingTotal = $oJResp.IntOf("paging.total") Local $iPagingOffset = $oJResp.IntOf("paging.offset") Local $iPagingLimit = $oJResp.IntOf("paging.limit") Local $sDisplay = $oJResp.StringOf("display") Local $i = 0 Local $iCount_i = $oJResp.SizeOfArray("results") While $i < $iCount_i $oJResp.I = $i $sellerPhoneNumber = $oJResp.StringOf("results[i].seller.phone.number") $sellerPhoneExtension = $oJResp.StringOf("results[i].seller.phone.extension") $sellerPhoneArea_code = $oJResp.StringOf("results[i].seller.phone.area_code") $bSellerPhoneVerified = $oJResp.BoolOf("results[i].seller.phone.verified") $sellerAlternative_phoneNumber = $oJResp.StringOf("results[i].seller.alternative_phone.number") $sellerAlternative_phoneExtension = $oJResp.StringOf("results[i].seller.alternative_phone.extension") $sellerAlternative_phoneArea_code = $oJResp.StringOf("results[i].seller.alternative_phone.area_code") $sellerNickname = $oJResp.StringOf("results[i].seller.nickname") $sellerLast_name = $oJResp.StringOf("results[i].seller.last_name") $iSellerId = $oJResp.IntOf("results[i].seller.id") $sellerFirst_name = $oJResp.StringOf("results[i].seller.first_name") $sellerEmail = $oJResp.StringOf("results[i].seller.email") $bFulfilled = $oJResp.BoolOf("results[i].fulfilled") $sBuying_mode = $oJResp.StringOf("results[i].buying_mode") $sTaxesAmount = $oJResp.StringOf("results[i].taxes.amount") $sTaxesCurrency_id = $oJResp.StringOf("results[i].taxes.currency_id") $sOrder_requestChange = $oJResp.StringOf("results[i].order_request.change") $sOrder_requestReturn = $oJResp.StringOf("results[i].order_request.return") $sExpiration_date = $oJResp.StringOf("results[i].expiration_date") $sFeedbackSale = $oJResp.StringOf("results[i].feedback.sale") $sFeedbackPurchase = $oJResp.StringOf("results[i].feedback.purchase") $iShippingId = $oJResp.IntOf("results[i].shipping.id") $oJResp.DtOf("results[i].date_closed",False,$oDate_closed) $id = $oJResp.IntOf("results[i].id") $sManufacturing_ending_date = $oJResp.StringOf("results[i].manufacturing_ending_date") $bHidden_for_seller = $oJResp.BoolOf("results[i].hidden_for_seller") $oJResp.DtOf("results[i].date_last_updated",False,$oDate_last_updated) $sLast_updated = $oJResp.StringOf("results[i].last_updated") $sComments = $oJResp.StringOf("results[i].comments") $sPack_id = $oJResp.StringOf("results[i].pack_id") $iCouponAmount = $oJResp.IntOf("results[i].coupon.amount") $sCouponId = $oJResp.StringOf("results[i].coupon.id") $iShipping_cost = $oJResp.IntOf("results[i].shipping_cost") $oJResp.DtOf("results[i].date_created",False,$oDate_created) $sApplication_id = $oJResp.StringOf("results[i].application_id") $sPickup_id = $oJResp.StringOf("results[i].pickup_id") $status_detail = $oJResp.StringOf("results[i].status_detail") $sBuyerBilling_infoDoc_number = $oJResp.StringOf("results[i].buyer.billing_info.doc_number") $sBuyerBilling_infoDoc_type = $oJResp.StringOf("results[i].buyer.billing_info.doc_type") $sBuyerPhoneNumber = $oJResp.StringOf("results[i].buyer.phone.number") $sBuyerPhoneExtension = $oJResp.StringOf("results[i].buyer.phone.extension") $sBuyerPhoneArea_code = $oJResp.StringOf("results[i].buyer.phone.area_code") $buyerPhoneVerified = $oJResp.BoolOf("results[i].buyer.phone.verified") $sBuyerAlternative_phoneNumber = $oJResp.StringOf("results[i].buyer.alternative_phone.number") $sBuyerAlternative_phoneExtension = $oJResp.StringOf("results[i].buyer.alternative_phone.extension") $sBuyerAlternative_phoneArea_code = $oJResp.StringOf("results[i].buyer.alternative_phone.area_code") $sBuyerNickname = $oJResp.StringOf("results[i].buyer.nickname") $sBuyerLast_name = $oJResp.StringOf("results[i].buyer.last_name") $iBuyerId = $oJResp.IntOf("results[i].buyer.id") $sBuyerFirst_name = $oJResp.StringOf("results[i].buyer.first_name") $sBuyerEmail = $oJResp.StringOf("results[i].buyer.email") $sTotal_amount = $oJResp.StringOf("results[i].total_amount") $sPaid_amount = $oJResp.StringOf("results[i].paid_amount") $sCurrency_id = $oJResp.StringOf("results[i].currency_id") $status = $oJResp.StringOf("results[i].status") $iJ = 0 $iCount_j = $oJResp.SizeOfArray("results[i].payments") While $iJ < $iCount_j $oJResp.J = $iJ $sReason = $oJResp.StringOf("results[i].payments[j].reason") $status_code = $oJResp.StringOf("results[i].payments[j].status_code") $sTotal_paid_amount = $oJResp.StringOf("results[i].payments[j].total_paid_amount") $sOperation_type = $oJResp.StringOf("results[i].payments[j].operation_type") $sTransaction_amount = $oJResp.StringOf("results[i].payments[j].transaction_amount") $oJResp.DtOf("results[i].payments[j].date_approved",False,$oDate_approved) $iCollectorId = $oJResp.IntOf("results[i].payments[j].collector.id") $sCoupon_id = $oJResp.StringOf("results[i].payments[j].coupon_id") $installments = $oJResp.IntOf("results[i].payments[j].installments") $sAuthorization_code = $oJResp.StringOf("results[i].payments[j].authorization_code") $iTaxes_amount = $oJResp.IntOf("results[i].payments[j].taxes_amount") $id = $oJResp.IntOf("results[i].payments[j].id") $oJResp.DtOf("results[i].payments[j].date_last_modified",False,$oDate_last_modified) $iCoupon_amount = $oJResp.IntOf("results[i].payments[j].coupon_amount") $iShipping_cost = $oJResp.IntOf("results[i].payments[j].shipping_cost") $sInstallment_amount = $oJResp.StringOf("results[i].payments[j].installment_amount") $oJResp.DtOf("results[i].payments[j].date_created",False,$oDate_created) $sActivation_uri = $oJResp.StringOf("results[i].payments[j].activation_uri") $iOverpaid_amount = $oJResp.IntOf("results[i].payments[j].overpaid_amount") $iCard_id = $oJResp.IntOf("results[i].payments[j].card_id") $status_detail = $oJResp.StringOf("results[i].payments[j].status_detail") $sIssuer_id = $oJResp.StringOf("results[i].payments[j].issuer_id") $sPayment_method_id = $oJResp.StringOf("results[i].payments[j].payment_method_id") $sPayment_type = $oJResp.StringOf("results[i].payments[j].payment_type") $sDeferred_period = $oJResp.StringOf("results[i].payments[j].deferred_period") $sAtm_transfer_referenceTransaction_id = $oJResp.StringOf("results[i].payments[j].atm_transfer_reference.transaction_id") $sAtm_transfer_referenceCompany_id = $oJResp.StringOf("results[i].payments[j].atm_transfer_reference.company_id") $site_id = $oJResp.StringOf("results[i].payments[j].site_id") $iPayer_id = $oJResp.IntOf("results[i].payments[j].payer_id") $sMarketplace_fee = $oJResp.StringOf("results[i].payments[j].marketplace_fee") $iOrder_id = $oJResp.IntOf("results[i].payments[j].order_id") $sCurrency_id = $oJResp.StringOf("results[i].payments[j].currency_id") $status = $oJResp.StringOf("results[i].payments[j].status") $sTransaction_order_id = $oJResp.StringOf("results[i].payments[j].transaction_order_id") $iK = 0 $iCount_k = $oJResp.SizeOfArray("results[i].payments[j].available_actions") While $iK < $iCount_k $oJResp.K = $iK $strVal = $oJResp.StringOf("results[i].payments[j].available_actions[k]") $iK = $iK + 1 Wend $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJResp.SizeOfArray("results[i].order_items") While $iJ < $iCount_j $oJResp.J = $iJ $sItemSeller_custom_field = $oJResp.StringOf("results[i].order_items[j].item.seller_custom_field") $sItemCondition = $oJResp.StringOf("results[i].order_items[j].item.condition") $sItemCategory_id = $oJResp.StringOf("results[i].order_items[j].item.category_id") $sItemVariation_id = $oJResp.StringOf("results[i].order_items[j].item.variation_id") $sItemSeller_sku = $oJResp.StringOf("results[i].order_items[j].item.seller_sku") $sItemWarranty = $oJResp.StringOf("results[i].order_items[j].item.warranty") $sItemId = $oJResp.StringOf("results[i].order_items[j].item.id") $sItemTitle = $oJResp.StringOf("results[i].order_items[j].item.title") $iQuantity = $oJResp.IntOf("results[i].order_items[j].quantity") $sDifferential_pricing_id = $oJResp.StringOf("results[i].order_items[j].differential_pricing_id") $sale_fee = $oJResp.StringOf("results[i].order_items[j].sale_fee") $sListing_type_id = $oJResp.StringOf("results[i].order_items[j].listing_type_id") $sBase_currency_id = $oJResp.StringOf("results[i].order_items[j].base_currency_id") $sUnit_price = $oJResp.StringOf("results[i].order_items[j].unit_price") $sFull_unit_price = $oJResp.StringOf("results[i].order_items[j].full_unit_price") $sBase_exchange_rate = $oJResp.StringOf("results[i].order_items[j].base_exchange_rate") $sCurrency_id = $oJResp.StringOf("results[i].order_items[j].currency_id") $sManufacturing_days = $oJResp.StringOf("results[i].order_items[j].manufacturing_days") $iK = 0 $iCount_k = $oJResp.SizeOfArray("results[i].order_items[j].item.variation_attributes") While $iK < $iCount_k $oJResp.K = $iK $iK = $iK + 1 Wend $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJResp.SizeOfArray("results[i].tags") While $iJ < $iCount_j $oJResp.J = $iJ $strVal = $oJResp.StringOf("results[i].tags[j]") $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJResp.SizeOfArray("results[i].mediations") While $iJ < $iCount_j $oJResp.J = $iJ $iJ = $iJ + 1 Wend $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("available_sorts") While $i < $iCount_i $oJResp.I = $i $sId_str = $oJResp.StringOf("available_sorts[i].id") $sName = $oJResp.StringOf("available_sorts[i].name") $i = $i + 1 Wend $i = 0 $iCount_i = $oJResp.SizeOfArray("filters") While $i < $iCount_i $oJResp.I = $i $i = $i + 1 Wend |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.