How to deploy a report (jrxml
file) through the Jasper PHP/REST API
to the Jasper Reports Server?
For deploying Jasper reports on Jasper Server using Rest-API you can use following method:
JRXML_DATA=$(cat $PATHTOJRXMLFILE/$JRXML_FILE)
curl -X POST $JASPER_REST_HOST/jasperserver/rest_v2/resources/reports \
-H "Content-Type:application/jrxml" \
-H "Content-Disposition:attachment; filename=test" \
-H "Content-Description:test file" \
-d "$JRXML_DATA" \
--user $JASPER_USERNAME:$JASPER_USERNAME
RESOURCEDESCRIPTOR_JSON=$(cat $REPORT/deployable/reportunit.json)
curl -X POST $JASPER_REST_HOST/jasperserver/rest_v2/resources/reports \
-H "Content-Type:application/repository.reportUnit+json" \
-d "$RESOURCEDESCRIPTOR_JSON" \
--user $JASPER_USERNAME:$JASPER_PASSWORD
{
"uri": "/reports/test_report",
"label": "test_report",
"description": "description",
"permissionMask": "0",
"version": "0" ,
"alwaysPromptControls": "true",
"controlsLayout": "popupScreen",
"jrxml": {
"jrxmlFileReference": {
"uri": "/reports/test"
}
}
}
http://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/v2-resource-descriptor-types