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
(Tcl) 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
load ./chilkat.dll # This example assumes the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. set http [new_CkHttp] # First get our previously obtained OAuth2 access token. set jsonToken [new_CkJsonObject] set success [CkJsonObject_LoadFile $jsonToken "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 CkHttp_SetUrlVar $http "access_token" [CkJsonObject_stringOf $jsonToken "access_token"] # Use an actual buyer ID here.. CkHttp_SetUrlVar $http "buyer_id" "577815702" set sbResponseBody [new_CkStringBuilder] set success [CkHttp_QuickGetSb $http "https://api.mercadolibre.com/orders/search?buyer={$buyer_id}&access_token={$access_token}" $sbResponseBody] if {$success == 0} then { puts [CkHttp_lastErrorText $http] puts "Response Header:" puts [CkHttp_lastHeader $http] puts "----" puts "Response Body:" puts [CkStringBuilder_getAsString $sbResponseBody] puts "Failed." delete_CkHttp $http delete_CkJsonObject $jsonToken delete_CkStringBuilder $sbResponseBody exit } set jResp [new_CkJsonObject] CkJsonObject_LoadSb $jResp $sbResponseBody CkJsonObject_put_EmitCompact $jResp 0 puts "Response Body:" puts [CkJsonObject_emit $jResp] set respStatusCode [CkHttp_get_LastStatus $http] puts "Response Status Code = $respStatusCode" if {$respStatusCode >= 400} then { puts "Response Header:" puts [CkHttp_lastHeader $http] puts "----" puts "Response Body:" puts [CkStringBuilder_getAsString $sbResponseBody] puts "Failed." delete_CkHttp $http delete_CkJsonObject $jsonToken delete_CkStringBuilder $sbResponseBody delete_CkJsonObject $jResp exit } # 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 set date_closed [new_CkDtObj] set date_last_updated [new_CkDtObj] set date_created [new_CkDtObj] set date_approved [new_CkDtObj] set date_last_modified [new_CkDtObj] set query [CkJsonObject_stringOf $jResp "query"] set sortId [CkJsonObject_stringOf $jResp "sort.id"] set sortName [CkJsonObject_stringOf $jResp "sort.name"] set pagingTotal [CkJsonObject_IntOf $jResp "paging.total"] set pagingOffset [CkJsonObject_IntOf $jResp "paging.offset"] set pagingLimit [CkJsonObject_IntOf $jResp "paging.limit"] set display [CkJsonObject_stringOf $jResp "display"] set i 0 set count_i [CkJsonObject_SizeOfArray $jResp "results"] while {$i < $count_i} { CkJsonObject_put_I $jResp $i set sellerPhoneNumber [CkJsonObject_stringOf $jResp "results[i].seller.phone.number"] set sellerPhoneExtension [CkJsonObject_stringOf $jResp "results[i].seller.phone.extension"] set sellerPhoneArea_code [CkJsonObject_stringOf $jResp "results[i].seller.phone.area_code"] set sellerPhoneVerified [CkJsonObject_BoolOf $jResp "results[i].seller.phone.verified"] set sellerAlternative_phoneNumber [CkJsonObject_stringOf $jResp "results[i].seller.alternative_phone.number"] set sellerAlternative_phoneExtension [CkJsonObject_stringOf $jResp "results[i].seller.alternative_phone.extension"] set sellerAlternative_phoneArea_code [CkJsonObject_stringOf $jResp "results[i].seller.alternative_phone.area_code"] set sellerNickname [CkJsonObject_stringOf $jResp "results[i].seller.nickname"] set sellerLast_name [CkJsonObject_stringOf $jResp "results[i].seller.last_name"] set sellerId [CkJsonObject_IntOf $jResp "results[i].seller.id"] set sellerFirst_name [CkJsonObject_stringOf $jResp "results[i].seller.first_name"] set sellerEmail [CkJsonObject_stringOf $jResp "results[i].seller.email"] set fulfilled [CkJsonObject_BoolOf $jResp "results[i].fulfilled"] set buying_mode [CkJsonObject_stringOf $jResp "results[i].buying_mode"] set taxesAmount [CkJsonObject_stringOf $jResp "results[i].taxes.amount"] set taxesCurrency_id [CkJsonObject_stringOf $jResp "results[i].taxes.currency_id"] set order_requestChange [CkJsonObject_stringOf $jResp "results[i].order_request.change"] set order_requestReturn [CkJsonObject_stringOf $jResp "results[i].order_request.return"] set expiration_date [CkJsonObject_stringOf $jResp "results[i].expiration_date"] set feedbackSale [CkJsonObject_stringOf $jResp "results[i].feedback.sale"] set feedbackPurchase [CkJsonObject_stringOf $jResp "results[i].feedback.purchase"] set shippingId [CkJsonObject_IntOf $jResp "results[i].shipping.id"] CkJsonObject_DtOf $jResp "results[i].date_closed" 0 $date_closed set id [CkJsonObject_IntOf $jResp "results[i].id"] set manufacturing_ending_date [CkJsonObject_stringOf $jResp "results[i].manufacturing_ending_date"] set hidden_for_seller [CkJsonObject_BoolOf $jResp "results[i].hidden_for_seller"] CkJsonObject_DtOf $jResp "results[i].date_last_updated" 0 $date_last_updated set last_updated [CkJsonObject_stringOf $jResp "results[i].last_updated"] set comments [CkJsonObject_stringOf $jResp "results[i].comments"] set pack_id [CkJsonObject_stringOf $jResp "results[i].pack_id"] set couponAmount [CkJsonObject_IntOf $jResp "results[i].coupon.amount"] set couponId [CkJsonObject_stringOf $jResp "results[i].coupon.id"] set shipping_cost [CkJsonObject_IntOf $jResp "results[i].shipping_cost"] CkJsonObject_DtOf $jResp "results[i].date_created" 0 $date_created set application_id [CkJsonObject_stringOf $jResp "results[i].application_id"] set pickup_id [CkJsonObject_stringOf $jResp "results[i].pickup_id"] set status_detail [CkJsonObject_stringOf $jResp "results[i].status_detail"] set buyerBilling_infoDoc_number [CkJsonObject_stringOf $jResp "results[i].buyer.billing_info.doc_number"] set buyerBilling_infoDoc_type [CkJsonObject_stringOf $jResp "results[i].buyer.billing_info.doc_type"] set buyerPhoneNumber [CkJsonObject_stringOf $jResp "results[i].buyer.phone.number"] set buyerPhoneExtension [CkJsonObject_stringOf $jResp "results[i].buyer.phone.extension"] set buyerPhoneArea_code [CkJsonObject_stringOf $jResp "results[i].buyer.phone.area_code"] set buyerPhoneVerified [CkJsonObject_BoolOf $jResp "results[i].buyer.phone.verified"] set buyerAlternative_phoneNumber [CkJsonObject_stringOf $jResp "results[i].buyer.alternative_phone.number"] set buyerAlternative_phoneExtension [CkJsonObject_stringOf $jResp "results[i].buyer.alternative_phone.extension"] set buyerAlternative_phoneArea_code [CkJsonObject_stringOf $jResp "results[i].buyer.alternative_phone.area_code"] set buyerNickname [CkJsonObject_stringOf $jResp "results[i].buyer.nickname"] set buyerLast_name [CkJsonObject_stringOf $jResp "results[i].buyer.last_name"] set buyerId [CkJsonObject_IntOf $jResp "results[i].buyer.id"] set buyerFirst_name [CkJsonObject_stringOf $jResp "results[i].buyer.first_name"] set buyerEmail [CkJsonObject_stringOf $jResp "results[i].buyer.email"] set total_amount [CkJsonObject_stringOf $jResp "results[i].total_amount"] set paid_amount [CkJsonObject_stringOf $jResp "results[i].paid_amount"] set currency_id [CkJsonObject_stringOf $jResp "results[i].currency_id"] set status [CkJsonObject_stringOf $jResp "results[i].status"] set j 0 set count_j [CkJsonObject_SizeOfArray $jResp "results[i].payments"] while {$j < $count_j} { CkJsonObject_put_J $jResp $j set reason [CkJsonObject_stringOf $jResp "results[i].payments[j].reason"] set status_code [CkJsonObject_stringOf $jResp "results[i].payments[j].status_code"] set total_paid_amount [CkJsonObject_stringOf $jResp "results[i].payments[j].total_paid_amount"] set operation_type [CkJsonObject_stringOf $jResp "results[i].payments[j].operation_type"] set transaction_amount [CkJsonObject_stringOf $jResp "results[i].payments[j].transaction_amount"] CkJsonObject_DtOf $jResp "results[i].payments[j].date_approved" 0 $date_approved set collectorId [CkJsonObject_IntOf $jResp "results[i].payments[j].collector.id"] set coupon_id [CkJsonObject_stringOf $jResp "results[i].payments[j].coupon_id"] set installments [CkJsonObject_IntOf $jResp "results[i].payments[j].installments"] set authorization_code [CkJsonObject_stringOf $jResp "results[i].payments[j].authorization_code"] set taxes_amount [CkJsonObject_IntOf $jResp "results[i].payments[j].taxes_amount"] set id [CkJsonObject_IntOf $jResp "results[i].payments[j].id"] CkJsonObject_DtOf $jResp "results[i].payments[j].date_last_modified" 0 $date_last_modified set coupon_amount [CkJsonObject_IntOf $jResp "results[i].payments[j].coupon_amount"] set shipping_cost [CkJsonObject_IntOf $jResp "results[i].payments[j].shipping_cost"] set installment_amount [CkJsonObject_stringOf $jResp "results[i].payments[j].installment_amount"] CkJsonObject_DtOf $jResp "results[i].payments[j].date_created" 0 $date_created set activation_uri [CkJsonObject_stringOf $jResp "results[i].payments[j].activation_uri"] set overpaid_amount [CkJsonObject_IntOf $jResp "results[i].payments[j].overpaid_amount"] set card_id [CkJsonObject_IntOf $jResp "results[i].payments[j].card_id"] set status_detail [CkJsonObject_stringOf $jResp "results[i].payments[j].status_detail"] set issuer_id [CkJsonObject_stringOf $jResp "results[i].payments[j].issuer_id"] set payment_method_id [CkJsonObject_stringOf $jResp "results[i].payments[j].payment_method_id"] set payment_type [CkJsonObject_stringOf $jResp "results[i].payments[j].payment_type"] set deferred_period [CkJsonObject_stringOf $jResp "results[i].payments[j].deferred_period"] set atm_transfer_referenceTransaction_id [CkJsonObject_stringOf $jResp "results[i].payments[j].atm_transfer_reference.transaction_id"] set atm_transfer_referenceCompany_id [CkJsonObject_stringOf $jResp "results[i].payments[j].atm_transfer_reference.company_id"] set site_id [CkJsonObject_stringOf $jResp "results[i].payments[j].site_id"] set payer_id [CkJsonObject_IntOf $jResp "results[i].payments[j].payer_id"] set marketplace_fee [CkJsonObject_stringOf $jResp "results[i].payments[j].marketplace_fee"] set order_id [CkJsonObject_IntOf $jResp "results[i].payments[j].order_id"] set currency_id [CkJsonObject_stringOf $jResp "results[i].payments[j].currency_id"] set status [CkJsonObject_stringOf $jResp "results[i].payments[j].status"] set transaction_order_id [CkJsonObject_stringOf $jResp "results[i].payments[j].transaction_order_id"] set k 0 set count_k [CkJsonObject_SizeOfArray $jResp "results[i].payments[j].available_actions"] while {$k < $count_k} { CkJsonObject_put_K $jResp $k set strVal [CkJsonObject_stringOf $jResp "results[i].payments[j].available_actions[k]"] set k [expr $k + 1] } set j [expr $j + 1] } set j 0 set count_j [CkJsonObject_SizeOfArray $jResp "results[i].order_items"] while {$j < $count_j} { CkJsonObject_put_J $jResp $j set itemSeller_custom_field [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.seller_custom_field"] set itemCondition [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.condition"] set itemCategory_id [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.category_id"] set itemVariation_id [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.variation_id"] set itemSeller_sku [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.seller_sku"] set itemWarranty [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.warranty"] set itemId [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.id"] set itemTitle [CkJsonObject_stringOf $jResp "results[i].order_items[j].item.title"] set quantity [CkJsonObject_IntOf $jResp "results[i].order_items[j].quantity"] set differential_pricing_id [CkJsonObject_stringOf $jResp "results[i].order_items[j].differential_pricing_id"] set sale_fee [CkJsonObject_stringOf $jResp "results[i].order_items[j].sale_fee"] set listing_type_id [CkJsonObject_stringOf $jResp "results[i].order_items[j].listing_type_id"] set base_currency_id [CkJsonObject_stringOf $jResp "results[i].order_items[j].base_currency_id"] set unit_price [CkJsonObject_stringOf $jResp "results[i].order_items[j].unit_price"] set full_unit_price [CkJsonObject_stringOf $jResp "results[i].order_items[j].full_unit_price"] set base_exchange_rate [CkJsonObject_stringOf $jResp "results[i].order_items[j].base_exchange_rate"] set currency_id [CkJsonObject_stringOf $jResp "results[i].order_items[j].currency_id"] set manufacturing_days [CkJsonObject_stringOf $jResp "results[i].order_items[j].manufacturing_days"] set k 0 set count_k [CkJsonObject_SizeOfArray $jResp "results[i].order_items[j].item.variation_attributes"] while {$k < $count_k} { CkJsonObject_put_K $jResp $k set k [expr $k + 1] } set j [expr $j + 1] } set j 0 set count_j [CkJsonObject_SizeOfArray $jResp "results[i].tags"] while {$j < $count_j} { CkJsonObject_put_J $jResp $j set strVal [CkJsonObject_stringOf $jResp "results[i].tags[j]"] set j [expr $j + 1] } set j 0 set count_j [CkJsonObject_SizeOfArray $jResp "results[i].mediations"] while {$j < $count_j} { CkJsonObject_put_J $jResp $j set j [expr $j + 1] } set i [expr $i + 1] } set i 0 set count_i [CkJsonObject_SizeOfArray $jResp "available_sorts"] while {$i < $count_i} { CkJsonObject_put_I $jResp $i set id_str [CkJsonObject_stringOf $jResp "available_sorts[i].id"] set name [CkJsonObject_stringOf $jResp "available_sorts[i].name"] set i [expr $i + 1] } set i 0 set count_i [CkJsonObject_SizeOfArray $jResp "filters"] while {$i < $count_i} { CkJsonObject_put_I $jResp $i set i [expr $i + 1] } delete_CkHttp $http delete_CkJsonObject $jsonToken delete_CkStringBuilder $sbResponseBody delete_CkJsonObject $jResp delete_CkDtObj $date_closed delete_CkDtObj $date_last_updated delete_CkDtObj $date_created delete_CkDtObj $date_approved delete_CkDtObj $date_last_modified |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.