How to add to a nested collection in oData
If I had a co开发者_运维百科llection /Events(123)/Registrants
, and I wanted to add a Person
to that collection, how would I do something like that.
I tried POSTing
a Person
to that url, but I get an error.
Stupid me for not reading the oData specification.
POST /OData/OData.svc/Events(123)/$links/Registrants HTTP/1.1
Host: services.odata.org
DataServiceVersion: 1.0
MaxDataServiceVersion: 2.0
Content-Length: 159
Content-Type: application/xml
<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">
http://services.odata.org/OData/OData.svc/Person(10)
</uri>
精彩评论