Unofficial Content

List an Item is the functions to publish new items on MercadoLibre platform.

In order to list a new item in MercadoLibre you just need a valid user (you should use a Test User  if you are trying a new app) and with this user call the function.

ListAnItem

Parameters:

  • AccessToken of your user
  • ListAnItemSDT  (all the information about your Item)

Return values:

  • &ErrorCode - 0 is OK, 1 and error occurred.
  • &Message -  In case of errors, here you will get detailed information.
  • &Properties - It is a property value list. For example in order to get the id of the inserted item, you can access to &Properties.Get(“id”)

Sample

Look up the object PublishItem on the Samples Module, that will show you the full cycle of creating a Test User and publish some test products.

The following code is an example of listing a Vehicle in MercadoLibre Uruguay. 

Data Provider that load the Item properties and attributes:

{
      title = "My Api Car"
      category_id = "MLU55126"    // Alfa Romeo
      price = 1000
      currency_id = "USD"
      listing_type_id = "free"
      available_quantity = 1
      condition = "new"
      location
      {
          id = "UY"
          state
          {
               id = "TUxVUEFSVHMxMzQ1Mw" //Artigas
                 }
                 city
                {
                      id = "TUxVQ0FSVDE5ZjIz" //Artigas
         }
      }
    attributes
    {
        attribute
        {
           id = "MLU1744-COMBUS"
                   value_name = "Nafta"
        }

        attribute
        {
           id = "MLU1744-KMTS"
                  value_name = "0"
        }
         attribute
        {
           id = "MLU1744-DOOR"
                  value_name = "4"
        }

        attribute
        {
           id = "MLU1744-VERS"
                  value_name = "Alfa"
        }
        attribute
        {
           id = "MLU1744-YEAR"
                  value_name = "2015"
        }

     }

Procedure that List an Item:

// The access token for your user
&AccessToken = "APP_USR-6596664158486645-082613-b277bd50db7e3e141a46ab663db5b9be__D_C__-191063807"
&Item = DataProviderGetItem()
&ErrorCode = ValidateTheItemJsonBody(&AccessToken, &Item, &ValidationProperties, &Message)
If &ErrorCode = 0
    msg(!"Es una publicacion valida", status)
    &ErrorCode = ListAnItem(&AccessToken, &Item, &Properties, &Message)
    If &ErrorCode = 0
        msg(!"Anuncio ID #" + &Properties.Get(!"id"), status)
    Else
        msg(&Message.ToJson())
    Endif
Else
    msg(&Message.ToJson())
Endif

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant