Sample code for 30+ languages & platforms
Visual Basic 6.0

MercadoLibre - Consultar mis datos personales

See more MercadoLibre Examples

Consultar mis datos personales

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

' 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
success = 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

success = http.SetUrlVar("access_token",jsonToken.StringOf("access_token"))

Dim sbResponseBody As New ChilkatStringBuilder
success = http.QuickGetSb("https://api.mercadolibre.com/users/me?access_token={$access_token}",sbResponseBody)
If (success = 0) Then
    Debug.Print http.LastErrorText
    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 "Failed."
    Exit Sub
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

Dim strVal As String

Dim id As Long
id = jResp.IntOf("id")
Dim nickname As String
nickname = jResp.StringOf("nickname")
Dim registration_date As String
registration_date = jResp.StringOf("registration_date")
Dim country_id As String
country_id = jResp.StringOf("country_id")
Dim addressState As String
addressState = jResp.StringOf("address.state")
Dim addressCity As String
addressCity = jResp.StringOf("address.city")
Dim user_type As String
user_type = jResp.StringOf("user_type")
Dim logo As String
logo = jResp.StringOf("logo")
Dim points As Long
points = jResp.IntOf("points")
Dim site_id As String
site_id = jResp.StringOf("site_id")
Dim permalink As String
permalink = jResp.StringOf("permalink")
Dim seller_reputationLevel_id As String
seller_reputationLevel_id = jResp.StringOf("seller_reputation.level_id")
Dim seller_reputationPower_seller_status As String
seller_reputationPower_seller_status = jResp.StringOf("seller_reputation.power_seller_status")
Dim seller_reputationTransactionsPeriod As String
seller_reputationTransactionsPeriod = jResp.StringOf("seller_reputation.transactions.period")
Dim seller_reputationTransactionsTotal As Long
seller_reputationTransactionsTotal = jResp.IntOf("seller_reputation.transactions.total")
Dim seller_reputationTransactionsCompleted As Long
seller_reputationTransactionsCompleted = jResp.IntOf("seller_reputation.transactions.completed")
Dim seller_reputationTransactionsCanceled As Long
seller_reputationTransactionsCanceled = jResp.IntOf("seller_reputation.transactions.canceled")
Dim seller_reputationTransactionsRatingsPositive As Long
seller_reputationTransactionsRatingsPositive = jResp.IntOf("seller_reputation.transactions.ratings.positive")
Dim seller_reputationTransactionsRatingsNegative As Long
seller_reputationTransactionsRatingsNegative = jResp.IntOf("seller_reputation.transactions.ratings.negative")
Dim seller_reputationTransactionsRatingsNeutral As Long
seller_reputationTransactionsRatingsNeutral = jResp.IntOf("seller_reputation.transactions.ratings.neutral")
Dim statusSite_status As String
statusSite_status = jResp.StringOf("status.site_status")
Dim i As Long
i = 0
Dim count_i As Long
count_i = jResp.SizeOfArray("tags")
Do While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("tags[i]")
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("buyer_reputation.tags")
Do While i < count_i
    jResp.I = i
    i = i + 1
Loop