-
Notifications
You must be signed in to change notification settings - Fork 21
ReleaseNotes_0_3_8
Version 0.3.8
Generated on 2016-3-3
Implement belongsTo relationship in PUT request
0.3.8
It's now possible to update a child object of a belongsTo relationship and define to which owner object this child belongs. In other words: You can now change the owner object or initially create the association via a PUT request.
Example: A customer has many contacts and a contact belongs to exactly one customer. The following OData PUT request associates a contact with a specific customer.
PUT http://0.0.0.0:3000/odata/Contacts(1)
Body:
{
"customer": {
"__metadata": {
"uri": "http://0.0.0.0:3000/odata/Customers(3)"
}
}
}
The Contact with id 1 gets associated with / belongs to Customer 3.
Implement belongsTo relationship in POST request
0.3.8
It's now possible to create a child object of a belongsTo relationship and define to which owner object this child belongs.
Example: A customer has many contacts and a contact belongs to exactly one customer. The following OData POST request creates a contact that belongs to a specific customer.
POST http://0.0.0.0:3000/odata/Contacts
Body:
{
"firstname": "Werner",
"lastname": "Wüterich",
"phone": "0511 123456",
"mobile": "+49 170 8822491",
"email": "[email protected]",
"address": "My Home",
"customer": {
"__metadata": {
"uri": "http://0.0.0.0:3000/odata/Customers(23)"
}
}
}
The new Contact is associated with the Customer 23.
ERROR: GET entity/$links returns wrong url
0.3.8
Error: A GET request to get the links of an association did return the url with the association property and not with the associated class. This is fixed
Ex: GET http://0.0.0.0:3000/odata/Customers(3)/$links/contacts returned
{
"value": [
{
"url": "http://0.0.0.0:3000/odata/contacts(1)"
}
]
}
with lowercase contacts cause the association parameter is contacts but should return
{
"value": [
{
"url": "http://0.0.0.0:3000/odata/Contacts(1)"
}
]
}
with uppercase Contacts cause the associated class is Contact and it's plural is Contacts.