Enabling Navigation Between Entities in OData
Navigation between entities is allowed through defined navigation properties.
Hard Navigation
The following associations are hard defined in the code:
• Season ▶ ProductSeasons (containsTarget)
• Season ▶ ColorwaySeasons (containsTarget)
• ProductSeason ▶ Season, Product
• ColorwaySeason ▶ Season, Colorway
• Product ▶ ProductSeasons (containsTarget), Colorways
• Colorway ▶ ColorwaySeasons (containsTarget), Product
When containsTarget is true, no entity set is defined for those entities. Access to those resources needs to be done through navigation only.
Soft Navigation
Associations are based on the object reference attributes defined in the type manager. Enabling navigation makes an object reference attribute to be a navigable property when the end entity type is defined in the entity data model.
All existing entities ▶ creator(Principal), modifier(Principal), containerReference(Container) and to all entities that exist (for example, on Colorway ▶ color(Color))
$expand
$expand is supported on all available navigation properties defined and so nested expand. $expand works with $select, $filter, $orderby, $expand, $skip, $top, and $count. The asterisk (*) character and level option are supported in $expand.
Example of an OData URL:
servicerootURL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')?$expand=*,
ProductSeasons($expand=Season($select=seasonName)),
Colorways($expand=color($select=name))
Example of a response:
{
"@odata.context": "$metadata#Products/$entity",
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSProduct",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:150513",
"partPrimaryImageURL": null,
"floatAtt": 0,
"thePersistInfo_2e_createStamp": "2017-04-05T16:35:13Z",
"state_2e_state": "INWORK",
"productName": "MyProduct1",
"thePersistInfo_2e_modifyStamp": "2017-05-05T18:45:44Z",
"test1": null,
"drivenAtt": null,
"drivenAtt3": null,
"drivenAtt2": null,
"ProductSeasons": [
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_season_5f_LCSProductSeasonLink",
"ID": "VR:com.lcs.wc.product.LCSProduct:154613",
"placeholderStatus": "candidate",
"thePersistInfo_2e_createStamp": "2017-04-10T17:59:19Z",
"thePersistInfo_2e_modifyStamp": "2017-04-10T17:59:19Z",
"Season": {
"@odata.type": "#RFA.com_2e_ptc_2e_MySeason",
"@odata.id": "/Seasons('VR:com.lcs.wc.season.LCSSeason:154587')",
"seasonName": "Brand 2 Spring 2008"
}
},
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_season_5f_LCSProductSeasonLink",
"ID": "VR:com.lcs.wc.product.LCSProduct:150630",
"placeholderStatus": "candidate",
"thePersistInfo_2e_createStamp": "2017-04-05T16:55:37Z",
"thePersistInfo_2e_modifyStamp": "2017-04-05T16:55:37Z",
"Season": {
"@odata.type": "#RFA.com_2e_ptc_2e_MySeason",
"@odata.id": "/Seasons('VR:com.lcs.wc.season.LCSSeason:150484')",
"seasonName": "Brand 1 Spring 2008"
}
}
],
"Colorways": [
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSSKU",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:154045",
"skuName": "blue",
"thePersistInfo_2e_createStamp": "2017-04-10T12:59:31Z",
"state_2e_state": "INWORK",
"thePersistInfo_2e_modifyStamp": "2017-04-10T12:59:31Z",
"color": {
"@odata.id": "/Colors('OR:com.lcs.wc.color.LCSColor:154017')",
"name": "blue"
}
},
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSSKU",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:154106",
"skuName": "red",
"thePersistInfo_2e_createStamp": "2017-04-10T12:59:37Z",
"state_2e_state": "INWORK",
"thePersistInfo_2e_modifyStamp": "2017-04-10T12:59:37Z",
"color": {
"@odata.id": "/Colors('OR:com.lcs.wc.color.LCSColor:152591')",
"name": "red"
}
}
],
"iterationInfo_2e_modifier": {
"@odata.type": "#RFA.wt_2e_org_2e_WTUser",
"ID": "OR:wt.org.WTUser:11",
"name": "Administrator"
},
"iterationInfo_2e_creator": {
"@odata.type": "#RFA.wt_2e_org_2e_WTUser",
"ID": "OR:wt.org.WTUser:11",
"name": "Administrator"
},
"sizingDefinition": null,
"refProduct": {
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSProduct",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:159522",
"partPrimaryImageURL": null,
"floatAtt": 1.1,
"thePersistInfo_2e_createStamp": "2017-04-12T14:48:27Z",
"state_2e_state": "INWORK",
"productName": "MyProduct4",
"thePersistInfo_2e_modifyStamp": "2017-04-12T16:31:51Z",
"test1": null,
"drivenAtt": null,
"drivenAtt3": null,
"drivenAtt2": null
}
}
Navigation URL
When a request includes odata.metadata=full in the header or specified in the URL as the format, the response includes a navigation URL for navigationPropertyName@odata.navigationLink and navigationPropertyName@odata.associationLink.
Example of an OData URL:
servicerootURL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')
Example of a response:
{
"@odata.context": "$metadata#Products/$entity",
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSProduct",
"@odata.id": "/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')",
"@odata.editLink": "/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:150513",
"partPrimaryImageURL": null,
"floatAtt": 0,
"thePersistInfo_2e_createStamp@odata.type": "#DateTimeOffset",
"thePersistInfo_2e_createStamp": "2017-04-05T16:35:13Z",
"state_2e_state": "INWORK",
"productName": "MyProduct1",
"thePersistInfo_2e_modifyStamp@odata.type": "#DateTimeOffset",
"thePersistInfo_2e_modifyStamp": "2017-05-05T18:45:44Z",
"test1@odata.type":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_test1_25_Enum",
"test1": null,
"drivenAtt@odata.type":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_drivenAtt_25_Enum",
"drivenAtt": null,
"drivenAtt3@odata.type":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_drivenAtt3_25_Enum",
"drivenAtt3": null,
"drivenAtt2@odata.type":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_drivenAtt2_25_Enum",
"drivenAtt2": null,
"ProductSeasons@odata.navigationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/ProductSeasons",
"ProductSeasons@odata.associationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/ProductSeasons/$ref",
"Colorways@odata.navigationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/Colorways",
"Colorways@odata.associationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/Colorways/$ref",
"iterationInfo_2e_modifier@odata.navigationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_modifier",
"iterationInfo_2e_modifier@odata.associationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_modifier/$ref",
"iterationInfo_2e_creator@odata.navigationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_creator",
"iterationInfo_2e_creator@odata.associationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_creator/$ref",
"sizingDefinition@odata.navigationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/sizingDefinition",
"sizingDefinition@odata.associationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/sizingDefinition/$ref",
"containerReference@odata.navigationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/containerReference",
"containerReference@odata.associationLink":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/containerReference/$ref"
}