Esse documento explica com exemplos de uso de nossa API REST a criação e finalização de carrinho de compras.
Nota |
---|
Requisições POST devem ter o header “Content-Type“ com o valor “application/vnd.api+json“ para evitar erros na criação de itens |
...
Bloco de código |
---|
|
{
"data": {
"type": "Coverage",
"attributes": {
"street_address_1": "Avenida José Antônio Lorenzetti",
"street_address_3": "Jardim São João",
"address_number": "0",
"postal_code": "18680-410",
"state": "SP",
"city": "Lençóis Paulista"
}
}
} |
Resposta:
Bloco de código |
---|
{
"data": {
"street_address_1": "Avenida José Antônio Lorenzetti",
"street_address_3": "Jardim São João",
"address_number": "0",
"postal_code": "18680-410",
"state": "SP",
"city": "Lençóis Paulista",
"latitude": -22.5879666,
"longitude": -48.7980126
}
} |
...
Exemplo:
Body:
Bloco de código |
---|
{
"data": {
"type": "Coverage",
"attributes": {
"latitude": -22.5879666,
"longitude": -48.7980126
}
}
} |
Resposta:
Bloco de código |
---|
|
{
"data": {
"address": "R. Nicolau Dias Batista",
"number": "1",
"neighborhood": "Parque Res. Elizabeth",
"city": "Lençóis Paulista",
"state": "SP",
"country": "BR",
"postal_code": "18680-440"
}
} |
...
Exemplo:
Body:
Bloco de código |
---|
{
"data": {
"type": "Coverage",
"attributes": {
"street_address_1": "Rua Paraná",
"street_address_3": "Jardim Cruzeiro",
"address_number": "222",
"postal_code": "18680-510",
"state": "SP",
"city": "Lençóis Paulista",
"latitude": -22.5885833,
"longitude": -48.7980126
}
}
} |
Caso tenha cobertura retornara o status 200:
...
Exemplo:
Body:
Bloco de código |
---|
{
"data": {
"type": "Address",
"attributes": {
"first_name": "Nome",
"last_name": "Sobrenome",
"city": "Lençóis Paulista",
"number": "999",
"street_address_1": "Rua São Pedro",
"street_address_2": "",
"street_address_3": "Centro",
"state": "SP",
"postal_code": "18680-049",
"country": "BR",
"country_area": "BR"
}
}
} |
Resposta:
Bloco de código |
---|
{
"data": {
"type": "Address",
"id": "723",
"attributes": {
"created": "2022-02-24T14:55:28.492506-03:00",
"updated": "2022-02-24T14:55:28.492572-03:00",
"nickname": "",
"first_name": "Nome",
"last_name": "Sobrenome",
"company_name": null,
"number": "999",
"street_address_1": "Rua São Pedro",
"street_address_2": "",
"street_address_3": "Centro",
"city": "Lençóis Paulista",
"state": "SP",
"postal_code": "18680-049",
"country": "BR",
"country_area": "BR",
"phone": "",
"is_default": null,
"type": "billing",
"latitude": "",
"longitude": ""
},
"relationships": {
"user": {
"links": {
"self": "http://devisp.datacake.com.br/api/address/723/relationships/user/",
"related": "http://devisp.datacake.com.br/api/address/723/user/"
},
"data": null
}
}
}
} |
...