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
(PowerBuilder) MercadoLibre - Consultar mis datos personalesConsultar mis datos personales For more information, see https://developers.mercadolibre.com.ar/es_ar/servicios-consulta-usuarios
integer li_rc oleobject loo_Http oleobject loo_JsonToken integer li_Success oleobject loo_SbResponseBody oleobject loo_JResp integer li_RespStatusCode string ls_StrVal integer li_Id string ls_Nickname string ls_Registration_date string ls_Country_id string ls_AddressState string ls_AddressCity string ls_User_type string ls_Logo integer li_Points string ls_Site_id string ls_Permalink string ls_Seller_reputationLevel_id string ls_Seller_reputationPower_seller_status string ls_Seller_reputationTransactionsPeriod integer li_Seller_reputationTransactionsTotal integer li_Seller_reputationTransactionsCompleted integer li_Seller_reputationTransactionsCanceled integer li_Seller_reputationTransactionsRatingsPositive integer li_Seller_reputationTransactionsRatingsNegative integer li_Seller_reputationTransactionsRatingsNeutral string ls_StatusSite_status integer i integer li_Count_i // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // First get our previously obtained OAuth2 access token. loo_JsonToken = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JsonToken.ConnectToNewObject("Chilkat.JsonObject") li_Success = loo_JsonToken.LoadFile("qa_data/tokens/mercadolibre.json") // Implements the following CURL command: // curl - X GET https://api.mercadolibre.com/users/me?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 loo_Http.SetUrlVar("access_token",loo_JsonToken.StringOf("access_token")) loo_SbResponseBody = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder") li_Success = loo_Http.QuickGetSb("https://api.mercadolibre.com/users/me?access_token={$access_token}",loo_SbResponseBody) if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_JsonToken destroy loo_SbResponseBody return end if loo_JResp = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject") loo_JResp.LoadSb(loo_SbResponseBody) loo_JResp.EmitCompact = 0 Write-Debug "Response Body:" Write-Debug loo_JResp.Emit() li_RespStatusCode = loo_Http.LastStatus Write-Debug "Response Status Code = " + string(li_RespStatusCode) if li_RespStatusCode >= 400 then Write-Debug "Response Header:" Write-Debug loo_Http.LastHeader Write-Debug "Failed." destroy loo_Http destroy loo_JsonToken destroy loo_SbResponseBody destroy loo_JResp return end if // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "id": 202593498, // "nickname": "TETE2870021", // "registration_date": "2016-01-06T11: 31: 42.000-04: 00", // "country_id": "AR", // "address": { // "state": "AR-C", // "city": "Palermo" // }, // "user_type": "normal", // "tags": [ // "normal", // "test_user", // "user_info_verified" // ], // "logo": null, // "points": 100, // "site_id": "MLA", // "permalink": "http://perfil.mercadolibre.com.ar/TETE2870021", // "seller_reputation": { // "level_id": null, // "power_seller_status": null, // "transactions": { // "period": "historic", // "total": 0, // "completed": 0, // "canceled": 0, // "ratings": { // "positive": 0, // "negative": 0, // "neutral": 0 // } // } // }, // "buyer_reputation": { // "tags": [ // ] // }, // "status": { // "site_status": "active" // } // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON li_Id = loo_JResp.IntOf("id") ls_Nickname = loo_JResp.StringOf("nickname") ls_Registration_date = loo_JResp.StringOf("registration_date") ls_Country_id = loo_JResp.StringOf("country_id") ls_AddressState = loo_JResp.StringOf("address.state") ls_AddressCity = loo_JResp.StringOf("address.city") ls_User_type = loo_JResp.StringOf("user_type") ls_Logo = loo_JResp.StringOf("logo") li_Points = loo_JResp.IntOf("points") ls_Site_id = loo_JResp.StringOf("site_id") ls_Permalink = loo_JResp.StringOf("permalink") ls_Seller_reputationLevel_id = loo_JResp.StringOf("seller_reputation.level_id") ls_Seller_reputationPower_seller_status = loo_JResp.StringOf("seller_reputation.power_seller_status") ls_Seller_reputationTransactionsPeriod = loo_JResp.StringOf("seller_reputation.transactions.period") li_Seller_reputationTransactionsTotal = loo_JResp.IntOf("seller_reputation.transactions.total") li_Seller_reputationTransactionsCompleted = loo_JResp.IntOf("seller_reputation.transactions.completed") li_Seller_reputationTransactionsCanceled = loo_JResp.IntOf("seller_reputation.transactions.canceled") li_Seller_reputationTransactionsRatingsPositive = loo_JResp.IntOf("seller_reputation.transactions.ratings.positive") li_Seller_reputationTransactionsRatingsNegative = loo_JResp.IntOf("seller_reputation.transactions.ratings.negative") li_Seller_reputationTransactionsRatingsNeutral = loo_JResp.IntOf("seller_reputation.transactions.ratings.neutral") ls_StatusSite_status = loo_JResp.StringOf("status.site_status") i = 0 li_Count_i = loo_JResp.SizeOfArray("tags") do while i < li_Count_i loo_JResp.I = i ls_StrVal = loo_JResp.StringOf("tags[i]") i = i + 1 loop i = 0 li_Count_i = loo_JResp.SizeOfArray("buyer_reputation.tags") do while i < li_Count_i loo_JResp.I = i i = i + 1 loop destroy loo_Http destroy loo_JsonToken destroy loo_SbResponseBody destroy loo_JResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.