Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(MFC) 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
#include <CkHttp.h> #include <CkJsonObject.h> #include <CkStringBuilder.h> #include <CkDtObj.h> void ChilkatSample(void) { CkString strOut; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttp http; // First get our previously obtained OAuth2 access token. CkJsonObject jsonToken; bool 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 http.SetUrlVar("access_token",jsonToken.stringOf("access_token")); // Use an actual buyer ID here.. http.SetUrlVar("buyer_id","577815702"); CkStringBuilder sbResponseBody; success = http.QuickGetSb("https://api.mercadolibre.com/orders/search?buyer={$buyer_id}&access_token={$access_token}",sbResponseBody); if (success == false) { strOut.append(http.lastErrorText()); strOut.append("\r\n"); strOut.append("Response Header:"); strOut.append("\r\n"); strOut.append(http.lastHeader()); strOut.append("\r\n"); strOut.append("----"); strOut.append("\r\n"); strOut.append("Response Body:"); strOut.append("\r\n"); strOut.append(sbResponseBody.getAsString()); strOut.append("\r\n"); strOut.append("Failed."); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } CkJsonObject jResp; jResp.LoadSb(sbResponseBody); jResp.put_EmitCompact(false); strOut.append("Response Body:"); strOut.append("\r\n"); strOut.append(jResp.emit()); strOut.append("\r\n"); int respStatusCode = http.get_LastStatus(); strOut.append("Response Status Code = "); strOut.appendInt(respStatusCode); strOut.append("\r\n"); if (respStatusCode >= 400) { strOut.append("Response Header:"); strOut.append("\r\n"); strOut.append(http.lastHeader()); strOut.append("\r\n"); strOut.append("----"); strOut.append("\r\n"); strOut.append("Response Body:"); strOut.append("\r\n"); strOut.append(sbResponseBody.getAsString()); strOut.append("\r\n"); strOut.append("Failed."); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } // 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 // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat. // See this example explaining how this memory should be used: const char * functions. CkDtObj date_closed; CkDtObj date_last_updated; CkDtObj date_created; CkDtObj date_approved; CkDtObj date_last_modified; const char *sellerPhoneNumber = 0; const char *sellerPhoneExtension = 0; const char *sellerPhoneArea_code = 0; bool sellerPhoneVerified; const char *sellerAlternative_phoneNumber = 0; const char *sellerAlternative_phoneExtension = 0; const char *sellerAlternative_phoneArea_code = 0; const char *sellerNickname = 0; const char *sellerLast_name = 0; int sellerId; const char *sellerFirst_name = 0; const char *sellerEmail = 0; bool fulfilled; const char *buying_mode = 0; const char *taxesAmount = 0; const char *taxesCurrency_id = 0; const char *order_requestChange = 0; const char *order_requestReturn = 0; const char *expiration_date = 0; const char *feedbackSale = 0; const char *feedbackPurchase = 0; int shippingId; int id; const char *manufacturing_ending_date = 0; bool hidden_for_seller; const char *last_updated = 0; const char *comments = 0; const char *pack_id = 0; int couponAmount; const char *couponId = 0; int shipping_cost; const char *application_id = 0; const char *pickup_id = 0; const char *status_detail = 0; const char *buyerBilling_infoDoc_number = 0; const char *buyerBilling_infoDoc_type = 0; const char *buyerPhoneNumber = 0; const char *buyerPhoneExtension = 0; const char *buyerPhoneArea_code = 0; bool buyerPhoneVerified; const char *buyerAlternative_phoneNumber = 0; const char *buyerAlternative_phoneExtension = 0; const char *buyerAlternative_phoneArea_code = 0; const char *buyerNickname = 0; const char *buyerLast_name = 0; int buyerId; const char *buyerFirst_name = 0; const char *buyerEmail = 0; const char *total_amount = 0; const char *paid_amount = 0; const char *currency_id = 0; const char *status = 0; int j; int count_j; const char *reason = 0; const char *status_code = 0; const char *total_paid_amount = 0; const char *operation_type = 0; const char *transaction_amount = 0; int collectorId; const char *coupon_id = 0; int installments; const char *authorization_code = 0; int taxes_amount; int coupon_amount; const char *installment_amount = 0; const char *activation_uri = 0; int overpaid_amount; int card_id; const char *issuer_id = 0; const char *payment_method_id = 0; const char *payment_type = 0; const char *deferred_period = 0; const char *atm_transfer_referenceTransaction_id = 0; const char *atm_transfer_referenceCompany_id = 0; const char *site_id = 0; int payer_id; const char *marketplace_fee = 0; int order_id; const char *transaction_order_id = 0; int k; int count_k; const char *strVal = 0; const char *itemSeller_custom_field = 0; const char *itemCondition = 0; const char *itemCategory_id = 0; const char *itemVariation_id = 0; const char *itemSeller_sku = 0; const char *itemWarranty = 0; const char *itemId = 0; const char *itemTitle = 0; int quantity; const char *differential_pricing_id = 0; const char *sale_fee = 0; const char *listing_type_id = 0; const char *base_currency_id = 0; const char *unit_price = 0; const char *full_unit_price = 0; const char *base_exchange_rate = 0; const char *manufacturing_days = 0; const char *id_str = 0; const char *name = 0; const char *query = jResp.stringOf("query"); const char *sortId = jResp.stringOf("sort.id"); const char *sortName = jResp.stringOf("sort.name"); int pagingTotal = jResp.IntOf("paging.total"); int pagingOffset = jResp.IntOf("paging.offset"); int pagingLimit = jResp.IntOf("paging.limit"); const char *display = jResp.stringOf("display"); int i = 0; int count_i = jResp.SizeOfArray("results"); while (i < count_i) { jResp.put_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"); jResp.DtOf("results[i].date_closed",false,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"); jResp.DtOf("results[i].date_last_updated",false,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"); jResp.DtOf("results[i].date_created",false,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"); while (j < count_j) { jResp.put_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"); jResp.DtOf("results[i].payments[j].date_approved",false,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"); jResp.DtOf("results[i].payments[j].date_last_modified",false,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"); jResp.DtOf("results[i].payments[j].date_created",false,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"); while (k < count_k) { jResp.put_K(k); strVal = jResp.stringOf("results[i].payments[j].available_actions[k]"); k = k + 1; } j = j + 1; } j = 0; count_j = jResp.SizeOfArray("results[i].order_items"); while (j < count_j) { jResp.put_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"); while (k < count_k) { jResp.put_K(k); k = k + 1; } j = j + 1; } j = 0; count_j = jResp.SizeOfArray("results[i].tags"); while (j < count_j) { jResp.put_J(j); strVal = jResp.stringOf("results[i].tags[j]"); j = j + 1; } j = 0; count_j = jResp.SizeOfArray("results[i].mediations"); while (j < count_j) { jResp.put_J(j); j = j + 1; } i = i + 1; } i = 0; count_i = jResp.SizeOfArray("available_sorts"); while (i < count_i) { jResp.put_I(i); id_str = jResp.stringOf("available_sorts[i].id"); name = jResp.stringOf("available_sorts[i].name"); i = i + 1; } i = 0; count_i = jResp.SizeOfArray("filters"); while (i < count_i) { jResp.put_I(i); i = i + 1; } SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.