I have a Android App which is via Web Services connected with my ASP.NET WebApi Server. For sending requests I am using AsyncHttpClient
and for passing parameters to the server I use RequestParams
. Now I want to send a complex object that contains a list with other complex objects to my server, and there is the issue. How am I supposed to do that? For simple types, it is pretty easy, since I just need to call parameter.add("paramname", paramvalue);
multiple times on the same parameter name, and on the server side I receive a list. But what should the call look like when my list has complex types so that I receive a list on my server containing these complex types?
Let's say I have a book that contains a list of authors:
class Book {
string title;
int year;
List<Authors> authors;
}
class Author {
string name;
int age;
}
How should I pass a Book (including authors)to my server using Request params (let's assume the data class on the server looks the same)?
I've almost forgot that the server accepts JSON as format.
Thanks