Hi
my code looks like this:
public async Task<AjaxResponse<List<int>>> GetListOfInts()
{
AjaxResponse<List<int>> listOfInts = new AjaxResponse<List<int>>();
string path = $"/api/services/app/Orte/GetPLZByLandId?land={land}";
HttpResponseMessage response = await GetAsync(path);
var r = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
listOfInts = await response.Content.ReadAsAsync<AjaxResponse<List<int>>>();
else
listOfInts = await response.Content.ReadAsAsync<AjaxResponse<List<int>>>();
return listOfInts;
}
My Json Result looks like this: {"result":{"items":[1000,1020,1030,1040,1050,9992]},"targetUrl":null,"success":true,"error":null,"unAuthorizedRequest":false,"__abp":true}
On Error the Json looks like this: {"result":null,"targetUrl":null,"success":false,"error":{"code":0,"message":"[Invalid country]","details":null,"validationErrors":null},"unAuthorizedRequest":false,"__abp":true}
But the conversion of the to case doesnt work.
Hi
i have create a class for the response, but how i can desirialized the json to this c# class?
{"result":{"isValid":true,"value":0.87},"targetUrl":null,"success":true,"error":null,"unAuthorizedRequest":false,"__abp":true}
This doesnt work MyClass obj = new MyClass(); HttpResponseMessage response = await GetAsync(path); if (response.IsSuccessStatusCode) obj = await response.Content.ReadAsAsync<MyClass>();
Hi
ok, thanks for give me update.
Hi
and when i call a api get function wich doesnt need authentification token, the function parameters are also not passed.. I think the problem is not the authentication?
Hm.. i cannot found it in the .net core version of the aspzero.net template... :(