API Documentation
The Mercado Máquinas Application Programming Interface (API) is a set of functions and standards established for the creation of customized applications, in which there is a need to use the database of ads and services offered by the Mercado Máquinas Website.
How it works?
In order to user the Mercado Máquinas API it is necessary:
- Registration on the Mercado Máquinas Portal
- Access Plan to API Mercado Máquinas. Plans available
- Request the release of the (source) IPs that will be used in the API requests.
All services use REST technology to handle requests, via XML or JSON over HTTP, using all major HTTP verbs (GET, POST, PUT, DELETE). Each resource has its own URL and can be handled in isolation to run on your browser, command line, or code.
Environments
Two types of environments were available to our advertisers: Developments and Production.
The Development environment is where developers, customers, advertisers, and users can test API functionality. All data manipulation done in this environment does not modify the production data and can be discarded at any time.
The production environment is used to manipulate the data used in the Mercado Máquinas Website and should only be used after all the tests in the development environment have been successfully performed. In order to use this environment it is necessary to request the authorization of use in the Mercado Máquinas Website. All requests made in this environment will be monitored.
Development: http://apidev.mercadomaquinas.com.br
Production http://api.mercadomaquinas.com.br
Authentication and Authorization
All access to the API is done through an authorized user in the Mercado Máquinas Website. Therefore, every request must be authenticated.
To perform authorization, you must submit the authentication credentials using the HTTP Basic authorization header.
The authorization header is constructed as follows:
- The username and password are combined into a string "user:password"
- The resulting literal string is then encoded in Base64
- The authorization method followed by the word "Basic" is then placed before the coded sequence.
For example, if the user is 'Aladdin' and the password is 'open-sesame' then the header should be:
Authorization: Basic QWxhZGRpbjpvcGVuLXNlc2FtZQ==
In case of authorization failure, an error of type HTTP/1.1 401 Unauthorized
will be returned.
Request format
The REST technology is the only one used in all Mercado Máquinas API services in the handling of requisitions.
curl -X GET -H "Accept: application/json" -H "Content-type: application/json; charset=utf-8" -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" http://api.mercadomaquinas.com.br/v1/ads/1
Response Formats
JSON and/or XML can be used as return formats for Mercado Máquinas API.
Ads
Api for publishing ads on the Mercado Máquinas Portal. Step-by-step recommendations for publishing an Ad.
- Get the advertiser's current contract (GETv1/contracts)
- Check if the model (Category/Manufacturer/Model) informed exists (GETv1/ad-models/{category}/{make}/{model})
- Create a new ad (POSTv1/ads)
- Returns the specifications of an ad through the given id code (GETv1/ads/{adid}/specs)
- Update/Modify the specifications of an existing Ad (PUTv1/ads/specs)
Contracts
Api for publishing ads in Mercado Máquinas website