3
I am sending via JSON an array of strings, how can I access this array via url? example of some of the tests:
http://localhost:51746/api/Language/Getlanguagelist? key=[spool,error] http://localhost:51746/api/Language/Getlanguagelist? key={racket,}
But it didn’t work, someone knows how I can do it?
[HttpGet]
public HttpResponseMessage GetLanguageList(List<string> keys)
{
try
{
#region meu codigo
Dictionary<string, string> key_value = new Dictionary<string, string>();
foreach (string key in keys)
{
key_value.Add(key,Resources.Language.ResourceManager.GetString(key));
}
#endregion
return Request.CreateResponse(HttpStatusCode.OK, new ResponseApi()
{
Status = Status.OK,
Message = "Sucesso",
Response = key_value
},
"application/json");
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.OK, new ResponseApi()
{
Status = Status.NOK,
Message = ex.Message,
Response = null
},
"application/json");
}
}
I tried here, but the Getlanguagelist(List<string> Keys) parameter is null, even if I say so. Do I have to use an array ? string [] Keys?
– Guilherme Prado
With array or list it would understand the same way...
– Leonardo Bonetti
you copied and pasted my url into your browser?
– Leonardo Bonetti
Yes, I also tried without copying and pasting. Even passing only one parameter the return is coming null
– Guilherme Prado
I had to concatenate all the strings and give a split (famous gambiarra), because I spent all day searching and did not find the solution :/ , if someone knows and can help , thanks
– Guilherme Prado
@Guilhermeprado also researched if there was a case like yours... and I could find nothing, mals.
– Leonardo Bonetti
Quiet, thank you very much, I will leave in Gambi even kkkkkk But thank you very much for the attention!
– Guilherme Prado