2016-11-14 73 views
2

我試圖使用Nifi REST API 1.0的導入終結點。我已經使用UI將模板導出爲XML,並試圖使用Postman將其導入。該請求是這樣的:使用nifi模板導入API的參數類型不匹配

POST /nifi-api/process-groups/63dcaf98-0158-1000-04da-dd54bbb3a5b8/templates/import HTTP/1.1 
Host: localhost:8080 
Content-Type: application/xml 
Cache-Control: no-cache 
Postman-Token: 37a10e8b-b30d-b5c8-4219-ca1ba34f79da 

<?xml version="1.0" ?> 
<template encoding-version="1.0"> 
    <description></description> 
    ... 
</template> 

我得到400錯誤返回,與消息argument type mismatch。在nifi-user.log中沒有什麼非常有用的:

2016-11-14 14:58:22,164 INFO [NiFi Web Server-327] org.apache.nifi.web.filter.RequestLogger Attempting request for (anonymous)  POST http://localhost:8080/nifi-api/process-groups/63dcaf98-0158-1000-04da-dd54bbb3a5b8/templates/import (source ip: 127.0.0.1) 
2016-11-14 14:58:22,231 INFO [NiFi Web Server-327] o.a.n.w.a.c.IllegalArgumentExceptionMapper java.lang.IllegalArgumentException: argument type mismatch. Returning Bad Request response. 

任何想法可能會導致這種情況,或者我可以如何調試?

回答

3

嘗試用稱爲templateEntity的另一個元素包裝根template元素。 Apache NiFi 1.0.0中的大多數端點將有問題的對象包含在entity對象中,以便在拒絕訪問時轉發有關對象的相關詳細信息以幫助推廣多租戶模型。該模式已應用於大多數終端,以幫助貫穿整個API的一致性。

您也可以通過啓用調試級別日誌記錄到另外的細節

<logger name="org.apache.nifi.web.api.config" level="DEBUG" additivity="false"> 
中的conf/logback.xml