OData でのリソースパス
OData は PTC FlexPLM の以下のリソースパスをサポートしています。
$select
$select ではアスタリスク (*) 文字がサポートされています。
製品リソースのすべてのプロパティを選択する OData URL の例:
service root URL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')?$select=*
応答の例:
{
"@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
既存のサービスのパッチ処理がサポートされています。
このスクリプトは、サーバーへの 1 回の呼び出しで 4 つのリクエストを実行します。
1. 既存のすべての素材をリストします。
2. 素材を作成します。
3. ステップ 2 で作成された素材を更新します。
4. 既存のすべての素材をリストします。
OData URL の例:
service root URL/$batch
メッセージボディの例:
--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 は読み取りエンティティと読み取りコレクションエンティティでサポートされています。これは expand 内でもサポートされています。
製品カラーウェイが参照としてのみの expand を持つ OData URL の例:
service root URL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')?$expand=Colorways/$ref
製品カラーウェイが参照としてのみの expand を持つ応答の例:
{
"@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 は以下の正規関数をサポートしています。
• String : concat, contains, endswith, length, startswith, substring, tolower, toupper, trim
• date : day, hour, minute, month, second, year
• arithmetics : ceiling, floor, round
OData URL の例:
service root
URL/Seasons/RFA.com_2e_ptc_2e_MySeason?$filter=year(thePersistInfo_2e_createStamp)
lt 2018
応答の例:
{
"@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"
}
]
}