Administration > OData Web Services > Resource Paths in OData
  
Resource Paths in OData
OData supports the following resource paths in PTC FlexPLM.
$select
The asterisk (*) character is supported in $select.
Example of an OData URL to select all properties of the product resource:
service root URL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')?$select=*
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
}
$batch
Batch processing is supported for existing services.
This script executes four requests in one call to the server:
1. List all existing materials.
2. Create a material.
3. Update the created material in step 2.
4. List all existing materials.
Example of an OData URL:
service root URL/$batch
Example of the payload:
--abc123
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Materials HTTP/1.1
Content-Type: application/json
--abc123
Content-Type: multipart/mixed;boundary=changeset_abc
--changeset_abc
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-ID: 1
POST Materials HTTP/1.1
Content-Type: application/json
{
"@odata.type":
"#RFA.com_2e_ptc_2e_Labor_5f_Material_24_com_5f_lcs_5f_wc_5f_material_5f_LCSMaterial",
"ptcmaterialName": "MaterialLabor4",
"description": "Material Labor 3"
}
--changeset_abc
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-ID: 2
PATCH $1 HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"@odata.type":
"#RFA.com_2e_ptc_2e_Labor_5f_Material_24_com_5f_lcs_5f_wc_5f_material_5f_LCSMaterial",
"description": "Material Labor 3 updated"
}
--changeset_abc--
--abc123
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Materials HTTP/1.1
Content-Type: application/json
--abc123-
$ref
$ref is supported for the read entity and read collection entity. It is also supported inside expand.
Example of an OData URL where the product colorways have expand as a reference only:
service root URL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')?$expand=Colorways/$ref
Example of a response where the product colorways have expand as a reference only:
{
"@odata.context": "$metadata#Products(Colorways/null)/$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,
"Colorways": [
{
"@odata.id": "/Colorways('OR:com.lcs.wc.part.LCSPartMaster:154045')"
},
{
"@odata.id": "/Colorways('OR:com.lcs.wc.part.LCSPartMaster:154106')"
}
]
}
$filter
$filter supports the following canonical functions:
String : concat, contains, endswith, length, startswith, substring, tolower, toupper, trim
date : day, hour, minute, month, second, year
arithmetics : ceiling, floor, round
Example of an OData URL:
service root
URL/Seasons/RFA.com_2e_ptc_2e_MySeason?$filter=year(thePersistInfo_2e_createStamp)
lt 2018
Example of a response:
{
"@odata.context": "$metadata#Seasons",
"value": [
{
"ID": "VR:com.lcs.wc.season.LCSSeason:150484",
"seasonType": "spring",
"year": "2008",
"active": true,
"state_2e_state": "INWORK",
"productTypeRole": "com.ptc.MyProduct$com_lcs_wc_product_LCSProduct",
"seasonName": "Brand 1 Spring 2008",
"seasonGroupIds": null,
"thePersistInfo_2e_createStamp": "2017-04-05T16:30:58Z",
"brand": "brand1",
"thePersistInfo_2e_modifyStamp": "2017-04-20T17:59:44Z"
},
{
"ID": "VR:com.lcs.wc.season.LCSSeason:154587",
"seasonType": "spring",
"year": "2008",
"active": true,
"state_2e_state": "INWORK",
"productTypeRole": "com.ptc.MyProduct$com_lcs_wc_product_LCSProduct",
"seasonName": "Brand 2 Spring 2008",
"seasonGroupIds": null,
"thePersistInfo_2e_createStamp": "2017-04-10T17:58:21Z",
"brand": "brand2",
"thePersistInfo_2e_modifyStamp": "2017-04-10T17:58:21Z"
}
]
}