2017-05-31 77 views
0

使用TIBCO JasperReports Server 6.3.0並通過rest_v2端點添加資源。該resource descriptor for file似乎相當簡單,這是我使用的測試腳本:Jasper服務器rest_v2上傳要求額外參數的文件

#!/bin/bash 
output=$(curl -sX POST "http://localhost:8080/jasperserver/rest_v2/resources/common/someFile.jrtx?createFolders=true" \ 
     -H "Content-Type:application/repository.query+json" \ 
     -H "Accept:application/json" \ 
     -d "{ 
      \"uri\" :\"/common/someFile.jrtx\", 
      \"label\":\"someFile.jrtx\", 
      \"description\":\"Some File\", 
      \"permissionMask\":\"0\", 
      \"type\":\"jrtx\", 
      \"content\":\"$(base64 -w 0 /path/to/someFile.jrtx)\" 
     }" \ 
     --user jasperadmin:jasperadmin) 

echo "${output}" | python -m json.tool 

我得到這個輸出是不解:

[ 
    { 
     "errorCode": "mandatory.parameter.error", 
     "message": "A value for the field QueryValue must be set", 
     "parameters": [ 
      "QueryValue" 
     ] 
    }, 
    { 
     "errorCode": "mandatory.parameter.error", 
     "message": "A value for the field Language must be set", 
     "parameters": [ 
      "Language" 
     ] 
    } 
] 

的文件描述符不提這些字段(語言或QueryValue)中的任何一個,我當然不必在手動創建文件時輸入它們。我究竟做錯了什麼?

的JRTX文件:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE jasperTemplate PUBLIC "-//JasperReports//DTD Template//EN" "http://jasperreports.sourceforge.net/dtds/jaspertemplate.dtd"> 

<jasperTemplate> 
    <style name="SimpleStyle"/> 
    <style name="ColumnHeading" hAlign="Center" vAlign="Middle" isBlankWhenNull="true" fontName="Verdana" fontSize="10" isBold="true"> 
     <pen lineWidth="1.0" lineColor="#666565"/> 
     <box> 
     <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
     <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
     <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
     <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
     </box> 
    </style> 
    <style name="Title" markup="" fontSize="20" isBold="true"/> 
    <style name="TableCells" hAlign="Center" vAlign="Middle" isBlankWhenNull="true" fontName="Verdana" fontSize="10" isBold="false"> 
     <pen lineWidth="1.0" lineColor="#CCCCCC"/> 
     <box> 
     <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#CCCCCC"/> 
     <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#CCCCCC"/> 
     <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#CCCCCC"/> 
     <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#CCCCCC"/> 
     </box> 
    </style> 
    <style name="VerticalColumnHeading" hAlign="Center" vAlign="Middle" rotation="Left" fontName="Verdana" fontSize="12" isBold="true"/> 
    <style name="GroupHeading" hAlign="Left" vAlign="Middle" fontName="Verdana" fontSize="10"> 
     <pen lineWidth="1.0" lineColor="#CCCCCC"/> 
    </style> 
</jasperTemplate> 
+0

您可以將您的someFile.jrtx? –

回答

0

錯誤的內容類型。取而代之的是

-H "Content-Type:application/repository.query+json" \ 

我應該使用這樣的:

-H "Content-Type:application/repository.file+json" \