PDI(Kettle)的使用三 獲取REST api資料並儲存
阿新 • • 發佈:2020-12-29
獲取REST api資料並儲存到json檔案裡
1.新建轉換
2.設定
(1)核心物件,拖拽
生成記錄,REST client,Json input,Json output
並依次連線(按shift+滑鼠拖拽)
(2)編輯生成記錄
(3)編輯REST client
(4)編輯Json input
設定獲取的欄位
說明:
根據返回的資料格式設定
{ "code": 200, "message": "SUCCESS", "data": { "total": 3, "list": [ {"id": 13, "fileName": "aa.txt", "size": 9084, "status": 5, "uploadTime": "2020-12-18 11:26:08", }, { "id": 12, "fileName": "bb.pdf", "size": 1729, "status": 5, "uploadTime": "2020-12-18 11:25:03", }, { "id": 11, "fileName": "cc.ppt", "size": 9451, "status": 5, "uploadTime": "2020-12-18 11:20:11", } ] } }
(4)編輯Json output
輸出欄位
3.儲存並執行
儲存到json的資料為
{ "lists": [ { "fileName": "aa.txt", "fileSize": "9084", "id": "13" }, { "fileName": "bb.pdf", "fileSize": "1729", "id": "12" }, { "fileName": "cc.ppt", "fileSize": "9451", "id": "11" } ] }
附加:
不在url中指定引數size,使用post的formdata傳遞size
設定傳遞引數size