進階自訂 > 使用 Windchill REST Web 服務來開發您的任務
  
使用 Windchill REST Web 服務來開發您的任務
Windchill 提供各種可在混搭中使用的 REST (Representational State Transfer,具象狀態傳輸) Web 服務。這些服務提供用來存取 Windchill 資料的方式,以及 Windchill 系統的處理能力。PTC Windchill Extension 包括啟動 Windchill REST Web 服務的 WindchillSwaggerConnector 物範本。ThingWorx Navigate 連接器的實例為 ptc-windchill-integration-connector
* 
Windchill 也提供了以 OData 為基礎的 Windchill REST 服務。在未來發行版本中,ThingWorx Navigate 將會使用這些服務。
我們建議您在自訂 ThingWorx Navigate 時計劃此變更。
如需有關針對 Windchill 資料配置 OData 服務的詳細資訊與指示,請參閱 Windchill REST Services User’s Guide (Windchill REST 服務使用者指南)。
Windchill REST 服務與 Windchill 稽核記錄整合。截至此 PTC Windchill Extension 發行版本,已記錄下列事件:
檢視屬性
讀取或下載內容
檢視表示
搜尋
如需有關您在任務中呼叫 REST 服務所需的資訊,請使用以下資源:
ThingWorx 說明中有完整的一章是關於整合連接器的,例如 WindchillSwaggerConnector。在此,您可以找到背景資訊,以及如何使用連接器的資訊。請首先參閱主題「整合連接器」。
"Using WindchillSwaggerConnector" 包括有關安裝所需 Windchill 修正檔的資訊,以及可用來擷取資料的受支援 Windchill 端點清單。
Windchill 文件集包括資源、端點、參數、表示及其結構的描述。欲存取此文件集,按一下「導覽器」中的「自訂」圖示,然後選取「文件集」
Windchill 使用者介面中的「用戶端自訂」偏好設定設為「是」的情況下,此文件集才可用。
如需有關設定偏好設定的資訊,請參閱 Windchill Help Center的「自訂工具概觀」。
ServiceTimeout 內容
ServiceTimeout 內容控制在 Windchill 傳回錯誤至混搭使用者介面之前,ThingWorx 等待對 Windchill 執行的 REST 呼叫完成的預設時間 (以毫秒為單位)。您可以透過在呼叫 Windchill 時指定逾時引數來取代個別呼叫上的此預設值。例如,下列程式碼會呼叫 Windchill REST 端點來執行已存搜尋,並指定 10 秒的逾時。如果此呼叫未指定逾時引數,則會使用在 ServiceTimeout 中指定的逾時設定。
var params = {
queryParams: {
  '$select': 'name,number,version'
},
data: {
  keyword: undefined
},
type: 'POST',
url: me.getRestUrl() + "/search/saved-searches/" + encodeURIComponent(oid) + "/results",
timeout: 10000
};
var jsonResult = me.processJSONRequest(params);