Building the API client library requires Maven to be installed.
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/java-client-sdk-master.jar
- target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import io.swagger.client.ApiException;
import io.swagger.client.api.DefaultApi;
import io.swagger.client.model.*;
public class DefaultApiExample {
/*Replace with your application Client Id, Client Secret and RedirectUri*/
Long ClientId = 0;
String SecretKey = "abc123";
String redirectUri = "https://your_url.com";
private final DefaultApi api = new DefaultApi();
private static void getAuthUrl() throws UnsupportedEncodingException {
DefaultApi api = new DefaultApi(new ApiClient(), clientId, clientSecret);
String response = api.getAuthUrl(redirectUri, Configuration.AuthUrls.{your_site_id});
}
private static void getAccessToken() throws UnsupportedEncodingException {
DefaultApi api = new DefaultApi(new ApiClient(), clientId, clientSecret);
String code = "{your_code}";
AccessToken response = api.authorize(code, redirectUri);
}
private static void refreshToken() throws UnsupportedEncodingException {
DefaultApi api = new DefaultApi(new ApiClient(), clientId, clientSecret);
String refreshToken = "{your_refresh_token}";
RefreshToken response = api.refreshAccessToken(refreshToken);
}
private static void GET() throws ApiException {
String resource = "{api_resource}";
Object response = api.defaultGet(resource);
}
public void POST() throws ApiException {
String resource = "{api_resource}";
Object body = new Object();
body.field("{some_value}");
Object response = api.defaultPost(accessToken, resource, body);
}
public void PUT() throws ApiException {
String id = "{object_id}";
String resource = "{api_resource}";
Object body = new Object();
body.field("{some_value}");
Object response = api.defaultPut(resource, id, accessToken, body);
}
public void DELETE() throws ApiException {
String id = "{object_id}";
String resource = "{api_resource}";
Object response = api.defaultDelete(resource, id, accessToken);
}
}
All URIs are relative to https://api.mercadolibre.com
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | defaultGet | GET /{resource}/{id} | Returns details about an object. |
DefaultApi | defaultPut | PUT /{resource}/{id}/attributes | Updates an object. |
DefaultApi | defaultPost | POST /{resource}/ | Creates an object. |
DefaultApi | defaultDelete | DELETE /{resource}/{id} | Deletes an object. |
DefaultApi | categoriesCategoryIdAttributesGet | GET /categories/{category_id}/attributes | Returns all attributes from a category. |
DefaultApi | categoriesCategoryIdGet | GET /categories/{category_id} | Returns information about a category. |
DefaultApi | itemsItemIdGet | GET /items/{item_id} | Return item infromation. |
DefaultApi | itemsItemIdPut | PUT /items/{item_id} | Update an item. |
DefaultApi | itemsPost | POST /items | List an item. |
DefaultApi | itemsValidatePost | POST /items/validate | Validate the JSON before listing an item. |
DefaultApi | messagesMessageIdGet | GET /messages/{message_id} | Get a message by ID. |
DefaultApi | messagesOrdersOrderIdGet | GET /messages/orders/{order_id} | Return all messages from a order. |
DefaultApi | messagesPost | POST /messages | Send a message. |
DefaultApi | ordersOrderIdGet | GET /orders/{order_id} | Get an order by ID. |
DefaultApi | ordersSearchGet | GET /orders/search | Search orders by seller or buyer. |
DefaultApi | shipmentsShipmentIdGet | GET /shipments/{shipment_id} | Retrieves all data to make a delivery. |
DefaultApi | sitesGet | GET /sites | Return all sites where MercadoLibre operates. |
DefaultApi | sitesSiteIdCategoryPredictorPredictGet | GET /sites/{site_id}/category_predictor/predict | Predict category by title. |
DefaultApi | sitesSiteIdGet | GET /sites/{site_id} | Return information about a site. |
DefaultApi | usersMeGet | GET /users/me | Return account information about the authenticated user. |
DefaultApi | usersUserIdGet | GET /users/{user_id} | Return user account information. |
- Address
- AlternativePhone
- AttributeCombinations
- Attributes
- BillData
- Billing
- Buy
- BuyerReputation
- BuyerReputationTransactions
- Canceled
- Categories
- CategoryPrediction
- CategoryResponse
- CategorySettings
- City
- Claims
- Context
- Conversation
- CostComponents
- Country
- Credit
- Currencies
- DelayedHandlingTime
- Descriptions
- Error
- EstimatedDeliveryExtended
- EstimatedDeliveryFinal
- EstimatedDeliveryLimit
- EstimatedDeliveryTime
- EstimatedHandlingLimit
- EstimatedScheduleLimit
- From
- Geolocation
- Identification
- IdentificationTypesRules
- ImmediatePayment
- ItemJson
- ItemResponse
- ItemResponseAttributes
- ItemResponsePictures
- ListImmediatePayment
- Location
- Message
- MessageAttachmentsValidations
- MessageCreated
- MessageFrom
- MessageJSON
- MessageModeration
- MessageSearchResults
- MessageText
- MessageTo
- Metrics
- Moderation
- Municipality
- Neighborhood
- NotYetRated
- Offset
- Paging
- PathFromRoot
- Phone
- Pictures
- PredictionPathFromRoot
- Ratings
- ReceiverAddress
- ReceiverAddressCity
- ReceiverAddressCountry
- ReceiverAddressMunicipality
- ReceiverAddressNeighborhood
- ReceiverAddressState
- Results
- ResultsFrom
- ResultsText
- ResultsTo
- Rules
- SaleTerms
- Sales
- SearchLocation
- SearchLocationCity
- SearchLocationState
- Sell
- SellImmediatePayment
- SellerAddress
- SellerReputation
- SenderAddress
- Shipment
- Shipping
- ShippingItems
- ShippingOption
- ShoppingCart
- Site
- SiteSettings
- Sites
- SitesSite
- State
- Status
- StatusHistory
- Text
- TimeFrame
- To
- Transactions
- Unrated
- UserResponse
- Variations
- Warnings
Authentication schemes defined for the API:
- Type: OAuth
- Flow: accessCode
- Authorization URL: https://auth.mercadolibre.com.ar/authorization Check AuthURL values by Site
- Token URL: https://api.mercadolibre.com/oauth/token
- Scopes:
- read: Grants read access
- write: Grants write access
- offline_access: Grants read and write access, and adds the possibility to get a refresh token and stay authenticated as the user.
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.
Florencia Solari (fsolari)
Most code was auto generated by swagger code generator
If you are looking for the older java-sdk, please refer to here