November 2017
Intermediate to advanced
420 pages
10h 29m
English
OData supports the linking of related resources. Relationships from one entity to another are represented as navigation properties. The following API reads employees in the HR department:
http://localhost:8080/hrapp/odata/Departments("HR")/ EmployeeDetails
The OData service even allows you to add, update, and remove a relation via navigation properties. The following example shows how you can use the navigation properties to link the employee with the id value of 1700 to the IT department:
POST odata/Departments('IT')/Employees/$ref
OData-Version: 4.0
Content-Type: application/json;odata.metadata=minimal
Accept: application/json
{
"@odata.id": "odata/Employees(1700)"
}