手動匯入和匯出
管理員使用者在 Composer 中可檢視「匯入/匯出」選單,如此即可匯入和匯出資料、實體與延伸功能。非管理使用者可使用 API,將資料手動匯入至 ThingWorx,或從中匯出資料,但必須擁有特定設計時間權限才能執行此操作。
手動匯入和匯出時,適用以下設計時間權限:
欲進行匯出的使用者必須具備設計時間讀取權限。
欲進行匯入的使用者必須具備設計時間建立權限。
手動匯出
經由瀏覽器使用下表中的呼叫來匯出資料和實體。
實體匯出支援二進位 (application/octet-stream) 或 XML (text/XML)。
資料匯出 (部落格、Wiki、串流、值串流和資料表資料) 支援二進位 (octet-stream)。
匯出實體
描述
URL 範例
將所有實體匯出至檔案 (二進位)
/Thingworx/Exporter/Exporter/?Accept=application/octet-stream&startdate=2015-08-26T11:33:50&enddate=2015-08-28T11:33:52&searchTags=Applications:testTag&repositoryName=SystemRepository&path=/mydir
在此範例中,所有的輸入參數皆已定義。
開始日期=
2015-08-26T11:33:50
結束日期=
2015-08-28T11:33:52
若未定義結束日期,便會使用目前的日期與時間。
模型標籤=
Applications:testTag
存放庫=
SystemRepository
路徑=
mydir
將所有實體匯出至檔案 (XML)
/Thingworx/Exporter/?Accept=text/xml&startdate=2015-08-26T11:33:50&enddate=2015-08-28T11:33:52&searchTags=Applications:testTag&repositoryName=SystemRepository&path=/mydir
在此範例中,所有的輸入參數皆已定義。
開始日期=
2015-08-26T11:33:50
結束日期=
2015-08-28T11:33:52
若未定義結束日期,便會使用目前的日期與時間。
模型標籤=
Applications:testTag
存放庫=
SystemRepository
路徑=
mydir
將單一實體匯出至檔案 (二進位)
/Thingworx/Exporter/ThingTemplates/GenericThing?Accept=application/octet-stream&repositoryName=SystemRepository&path=/mydir
在此範例中,所有的輸入參數皆已定義。
實體=ThingTemplate, GenericThing
存放庫=System Repository
路徑=mydir
將單一實體匯出至檔案 (XML)
/Thingworx/Exporter/ThingTemplates/GenericThing?Accept=text/xml&repositoryName=SystemRepository&path=/mydir
在此範例中,所有的輸入參數皆已定義。
實體=ThingTemplate, GenericThing
存放庫=System Repository
路徑=mydir
匯出資料
描述
URL 範例
將所有資料匯出至檔案
/Thingworx/DataExporter/?Accept=application/octet-stream&repositoryName=SystemRepository&path=/mydir
存放庫=SystemRepository
路徑=mydir
將資料表資料匯出至檔案
/Thingworx/DataExporter/DataTables/?Accept=application/octet-stream&searchTags=Applications:testTag&repositoryname=SystemRepository&path=/mydir
模型標籤=Applications:testTag
存放庫=SystemRepository
路徑=mydir
將單一資料匯出至檔案
/Thingworx/DataExporter/Streams/AlertHistoryStream?Accept=application/octet-stream&startDate=2015-08-26T11:38:46&endDate=2015-08-28T11:38:49&searchTags=Applications:testTag&respositoryName=SystemRepository&path=/mydir
在此範例中,所有的輸入參數皆已定義。
集合=Streams
實體名稱=AlertHistoryStream
開始日期=
2015-08-26T11:38:46
結束日期=
2015-08-28T11:38:49
若未定義結束日期,便會使用目前的日期與時間。
存放庫=
SystemRepository
路徑=
mydir
手動匯入
匯入是多部分請求。我們建議建構一個簡單的 HTML 表單如下:
<html>
<body>
<FORM action="/Thingworx/Importer?purpose=import&usedefaultdataprovider=true&WithSubsystems=false"
enctype="multipart/form-data"
method="post"
<P>
<BR>
What files are you sending? <INPUT type="file" name="files"><BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</FORM>
</body>
</html>
這是否有幫助?