1
I have the following situation, I need to create an API that will receive the content below:
{
"numeroCarrinho": 122865,
"itens": {
"PA00058": 1,
"MA00068": 1,
"PA00004": 1
},
"cep": "41706670",
"retiraNoLocal": false
}
Example: localhost:7630/api/unit/query/cart/122865/PA00058:1,MA00068:1,PA00004:1/41706670/false
The problem and that the items would be dynamic, an array of items, as I could do this, I made an example more like to know how I can get all the separate items.
[HttpGet]
[Route("unidade/consulta/carrinho/{numerocarrinho}/{itens}/{cep}/{retiralocal}")]
public HttpResponseMessage ConsultaUnidadeAtendimento(string numerocarrinho, string[] itens, string cep, string retiralocal)
{
try
{
var tTabela = "";
var listar = "";
return Request.CreateResponse(HttpStatusCode.OK, new { usuario = listar.ToArray() });
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
}
}
Tomaz, thank you so much for your answer, I made the example, the detail and that the data posted are not coming, I opened a new question, if you can help I thank:https://answall.com/questions/261193/api-com-array-de-itens-n%C3%A3o-receives-the-data-posted
– Harry