I would like to get the names in collection href(CustomerDemographics, Customers, Employees, Order Details) to populate a listview. I would like to know how to parse these information in Xamarin platform or C#. I am quite new on this environment. I have experience how to parse json data in native ios with objective c, but it is the first time I see this type of data.
1 Answers
From the attached image it seems that you're requesting the service document of the OData service. Namely the http://host/service/
endpoint of the service. If you would like to get the content of the collections, you should append the names of the collections to the end of the service document URL, such as:
GET http://host/service/Categories
GET http://hsot/service/CustomerDemographics
The format of the response payload depends on the protocol version of the OData service. If you are talking to a OData V4 service (it actually seems a lot like you are querying the Northwind OData V4 sample service: http://services.odata.org/v4/northwind/northwind.svc/), the response payload will be in JSON format and you can use the ways that you are familiar with to parse the response.
In addition, I would recommend you go through the basic tutorial on OData.org so that you can get a better grasp of OData requests: http://www.odata.org/getting-started/basic-tutorial/

- 2,864
- 16
- 16
-
Hello Yi Ding, thanks for your answer, I have clicked as a answer for your effort. However my question is what if you do not know the collections name, how do you get them to list on tableView/ListView? – casillas Oct 13 '14 at 16:11
-
1@casillas There are two cases: 1. You doesn't know much about the OData protocol specification and you don't want to care about them when you just want to write a OData client application. In this case, you can use the OData v4 Client Code Generator (https://visualstudiogallery.msdn.microsoft.com/9b786c0e-79d1-4a50-89a5-125e57475937) which will generate client side proxy for you as service reference which you can easily call to send & receive requests to & from the entity sets defined in the service. – Yi Ding - MSFT Oct 14 '14 at 01:09
-
1@casillas You can find a tutorial about the Code Generator here: You can find a tutorial about it here: http://blogs.msdn.com/b/odatateam/archive/2014/03/12/how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class.aspx – Yi Ding - MSFT Oct 14 '14 at 01:10
-
1@casillas 2. If you know reasonably well about the OData protocol. You know what a metadata document is composed of. You know which HTTP headers an OData request should contain and which response status code you should expect in different cases. In this case, you can use the OData core libraries (ODataLib, EdmLib, OData Client for .NET) to consume the OData V4 service. There is however few documents about this case, as the Code Generator is the premium client experience we'd advocate in consuming an OData service. – Yi Ding - MSFT Oct 14 '14 at 01:13
-
1@casillas I'm not sure if I answered your question this time. If you have any more, please feel free to navigate to our blog (http://blogs.msdn.com/b/odatateam/), comment in this question, or send a specific question to odatafeedback@microsoft.com – Yi Ding - MSFT Oct 14 '14 at 01:14
-
@ Thanks a lot Yi Ding, could you please look at the following question http://stackoverflow.com/questions/26364576/accessing-odata-property – casillas Oct 14 '14 at 15:27