POST v1/ads
Cria um novo anúncio
Requer Autorização
Para realizar a autorização, é necessário enviar as credenciais de autenticação usando o cabeçalho de autorização.
O cabeçalho de autorização é construído como se segue:
- O nome de usuário e a senha são combinadas em uma string "usuário:senha"
- A seqüência resultante literal é então codificado em Base64
- O método de autorização seguido da palavra "Basic" é, então, colocado antes da seqüência codificada.
Authorization: Basic QWxhZGRpbjphYnJhLWRlLXPDqXNhbW8=Códigos de Resposta
- Created (201)
- BadRequest (400)
- Unauthorized (401)
- Forbidden (403)
- NotFound (404)
Informações da Requisição
Parâmetros da URL
Os parâmetros devem ser informados na URL da requisição.
Nenhum.
Parâmetros do corpo da requisição
Estes parâmetros devem ser informados no corpo da requisição.
AdNewRequest Representation model of an request to create a new Ad.
| Nome | Descrição | Tipo | Informações adicionais |
|---|---|---|---|
| ReferenceCode | Reference code provided by the advertiser | string | Required |
| OfferType | Offer type (Venda/Locação/Serviço) | string | Required |
| ContractId | Advertiser current Contract ID | integer | Required |
| Category | Machine/Equipment Category | string | Required |
| Make | Machine/Equipment Manufacturer | string | |
| Model | Machine/Equipment Model | string | |
| SerialNumber | Machine/Equipment Serial Number | string | |
| Year | Year of manufacture of the machine/equipment (ex. 1998) | integer | |
| Price | Price of Ad in Reais (ex. R$ 100.000,00 -> 100000). Only numbers. | integer | |
| State | State or Province of location (ex. SP) | string | Required |
| City | City of location (ex. Jundiaí) | string | Required |
| Description | Ad description (Ex.: pintura nova, pneus bons, cabinada, motor novo). It is forbidden to enter addresses of other sites, telephones and email. | string | |
| IsPrivate | Indicates wheter the Ad is private (published only in EmEstoque) | boolean | Required |
| SyncToMarketplaces | Indicates whether the Ad should be Synchronized with the Marketplaces available through EmEstoque | boolean | |
| Photos | List with photos links. Maximum of 4 photos. | string array |
Formatos da Requisição
application/json, text/json
Observações:
- No formato Json, os nomes dos parâmetros seguem o padrão camelCase, ou seja, sempre são iniciados com letras minúsculas.
{
"referenceCode": "XXXX0123456",
"offerType": "Venda",
"contractId": 1,
"category": "Escavadeira",
"make": "Case",
"model": "CX220",
"serialNumber": "ABC123456",
"year": 2012,
"price": 100000,
"state": "SP",
"city": "Jundiaí",
"description": "NONONON NONONON NONONON",
"isPrivate": false,
"syncToMarketplaces": false,
"photos": [
"http://www.yourdomain.com/photo1.jpg",
"http://www.yourdomain.com/photo2.jpg",
"http://www.yourdomain.com/photo3.jpg",
"http://www.yourdomain.com/photo4.jpg"
]
}
text/html
{"referenceCode":"XXXX0123456","offerType":"Venda","contractId":1,"category":"Escavadeira","make":"Case","model":"CX220","serialNumber":"ABC123456","year":2012,"price":100000,"state":"SP","city":"Jundiaí","description":"NONONON NONONON NONONON","isPrivate":false,"syncToMarketplaces":false,"photos":["http://www.yourdomain.com/photo1.jpg","http://www.yourdomain.com/photo2.jpg","http://www.yourdomain.com/photo3.jpg","http://www.yourdomain.com/photo4.jpg"]}
application/xml, text/xml
<AdNewRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ReferenceCode>XXXX0123456</ReferenceCode>
<OfferType>Venda</OfferType>
<ContractId>1</ContractId>
<Category>Escavadeira</Category>
<Make>Case</Make>
<Model>CX220</Model>
<SerialNumber>ABC123456</SerialNumber>
<Year>2012</Year>
<Price>100000</Price>
<State>SP</State>
<City>Jundiaí</City>
<Description>NONONON NONONON NONONON</Description>
<IsPrivate>false</IsPrivate>
<SyncToMarketplaces>false</SyncToMarketplaces>
<Photos>
<Url>http://www.yourdomain.com/photo1.jpg</Url>
<Url>http://www.yourdomain.com/photo2.jpg</Url>
<Url>http://www.yourdomain.com/photo3.jpg</Url>
<Url>http://www.yourdomain.com/photo4.jpg</Url>
</Photos>
</AdNewRequest>
application/x-www-form-urlencoded
Exemplo não disponível.
Informações da Resposta
Descrição do recurso
AdResponse Returns the representation of the new Ad.
| Nome | Descrição | Tipo | Informações adicionais |
|---|---|---|---|
| AdId | ID code generated by the system | integer | |
| ReferenceCode | Reference code provided by the advertiser | string | Required |
| Type | Offer type (Venda/Locação/Serviço) | string | Required |
| ContractId | Advertiser current Contract ID | integer | Required |
| Category | Machine/Equipment Category | string | Required |
| Make | Machine/Equipment Manufacturer | string | Required |
| Model | Machine/Equipment Model | string | Required |
| SerialNumber | Machine/Equipment Serial Number | string | |
| Year | Year of manufacture of the machine/equipment (ex. 1998) | integer | |
| Price | Price of Ad in Reais (ex. R$ 100.000,00 -> 100000). Only numbers. | integer | |
| State | State or Province of location (ex. SP) | string | Required |
| City | City of location (ex. Jundiaí) | string | Required |
| Description | Ad description (Ex.: pintura nova, pneus bons, cabinada, motor novo). It is forbidden to enter addresses of other sites, telephones and email. | string | |
| IsPrivate | Indicates wheter the Ad is private (published only in EmEstoque) | boolean | Required |
| SyncToMarketplaces | Indicar se o anúncio deve ser Sincronizado com os Marketplaces disponíveis através do EmEstoque | boolean | |
| Photos | List with photos links. Maximum of 4 photos. | string array | Max. Length: 4 |
| Specifications | List of the Ad Specifications | NameValueItem array | |
| Links | Ad links list | Link array |
Formatos da Resposta
application/json, text/json
Observações:
- No formato Json, os nomes dos parâmetros seguem o padrão camelCase, ou seja, sempre são iniciados com letras minúsculas.
{
"adId": 1,
"referenceCode": "XXXX0123456",
"type": "Venda",
"contractId": 1,
"category": "Escavadeira",
"make": "Case",
"model": "CX220",
"serialNumber": "ABC123456",
"year": 2012,
"price": 100000,
"state": "SP",
"city": "Jundiaí",
"description": "NONONON NONONON NONONON",
"isPrivate": false,
"syncToMarketplaces": false,
"photos": [
"http://www.yourdomain.com/photo1.jpg",
"http://www.yourdomain.com/photo2.jpg",
"http://www.yourdomain.com/photo3.jpg",
"http://www.yourdomain.com/photo4.jpg"
],
"specifications": [
{
"name": "numero-de-serie",
"value": "ABC1234"
},
{
"name": "ano-fabricacao",
"value": "2012"
}
],
"links": [
{
"href": "https://www.mercadomaquinas.com.br/anuncio/1-test-ad-permalink-slug",
"rel": "ad",
"type": "GET"
},
{
"href": "https://api.mercadomaquinas.com.br/v1/ads/1",
"rel": "ad api",
"type": "GET"
}
]
}
text/html
{"adId":1,"referenceCode":"XXXX0123456","type":"Venda","contractId":1,"category":"Escavadeira","make":"Case","model":"CX220","serialNumber":"ABC123456","year":2012,"price":100000,"state":"SP","city":"Jundiaí","description":"NONONON NONONON NONONON","isPrivate":false,"syncToMarketplaces":false,"photos":["http://www.yourdomain.com/photo1.jpg","http://www.yourdomain.com/photo2.jpg","http://www.yourdomain.com/photo3.jpg","http://www.yourdomain.com/photo4.jpg"],"specifications":[{"name":"numero-de-serie","value":"ABC1234"},{"name":"ano-fabricacao","value":"2012"}],"links":[{"href":"https://www.mercadomaquinas.com.br/anuncio/1-test-ad-permalink-slug","rel":"ad","type":"GET"},{"href":"https://api.mercadomaquinas.com.br/v1/ads/1","rel":"ad api","type":"GET"}]}


