Jump to content
  • This documentation is an older version of JasperReports Server REST API Reference. View the latest documentation.

    This chapter provides a reference by example for every type of resource descriptor that exists in the repository. Use the resources service to get and set resources with these descriptors. For further information, see:

    Working With Resources for general guidelines about using descriptors.
    The resources Service for methods to operate on resources in the repository.

    This chapter does not cover descriptors for objects that are not stored in the repository. Descriptors that represent jobs, calendars, organizations, roles, users, and attributes are described with the service that operates on them.

    This chapter includes the following sections:

    Common Attributes
    Folder
    JNDI Data Source
    JDBC Data Source
    AWS Data Source
    Virtual Data Source
    Custom Data Source
    Bean Data Source
    Datatypes
    List of Values
    Query
    Input Control
    File
    Report Unit (JRXML Report)
    Report Options
    Domain (semanticLayerDataSource)
    Domain Topic
    XML/A Connection
    Mondrian Connection
    Secure Mondrian Connection
    OLAP Unit
    Mondrian XML/A Definition
    Other Types

    Common Attributes

    All resource types contain the following attributes. Of these common attributes, only the label and description fields are writable.

    In general, writable fields are ones that can be set by the client when sending a descriptor for a write or update operation (PUT or POST). The other fields are read-only fields that the server sets automatically.

    application/repository.{resourceType}+json

    application/repository.{resourceType}+xml

    {    "uri" :"/sample/resource/uri",     "label":"Sample Label",     "description":"Sample Description",     "permissionMask":"0",    "creationDate": "2013-07-04T12:18:47",    "updateDate": "2013-07-04T12:18:47",     "version":"0"    ... }[/code]                    
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><{resourceType}>    /sample/resource/uri    Sample Label    Sample Description            0    2013-07-04T12:18:47            2013-07-04T12:18:47            0    ...{resourceType}>[/code]                    

    Only the label, description, and permission fields are writable. The other fields are generated by the server.

    Throughout the rest of the resource type sections, the common attributes are included in every descriptor as <commonAttributes> in JSON or {commonAttributes} in XML.

    Folder

    Folder types do not contain any additional fields beyond the common attributes shown above.

    application/repository.folder+json

    application/repository.folder+xml

    {    "uri" :"<resourceURI>",     "label":"Sample Label",     "description":"Sample Description",     "permissionMask":"0",    "creationDate": "2013-07-04T12:18:47",    "updateDate": "2013-07-04T12:18:47",     "version":"0" }[/code]                    
        {resourceURI}    Sample Label    Sample Description          0    2013-07-04T12:18:47          2013-07-04T12:18:47           0[/code]                    

    Only the label and description fields are writable.

    JNDI Data Source

    application/repository.jndiJdbcDataSource+json

    application/repository.jndiJdbcDataSource+xml

    {    <commonAttributes>,     "jndiName":"<jndiName>",    "timezone":"<timezone>"}[/code]                    
        {commonAttributes}    {jndiName}    {timezone}[/code]                    

    JDBC Data Source

    application/repository.jdbcDataSource+json

    application/repository.jdbcDataSource+xml

    {    <commonAttributes>,     "driverClass":"<driverClass>",     "password":"<password>",     "username":"<username>",     "connectionUrl":"<connectionURL>",    "timezone":"<timezone>"}[/code]                    
        {commonAttributes}    {driverClass}    {password}    {username}             {connectionURL}        {timezone}[/code]                    

    AWS Data Source

    application/repository.awsDataSource+json

    application/repository.awsDataSource+xml

    {    <commonAttributes>,     "driverClass":"<driverClass>",     "password":"<password>",     "username":"<username>",     "connectionUrl":"<connectionURL>",    "timezone":"<timezone>",    "accessKey":"<accessKey>",     "secretKey":"<secretKey>",     "roleArn":"<roleArn>",     "region":"<region>",     "dbName":"<dbName>",     "dbInstanceIdentifier":        "<dbInstanceIdentifier>",     "dbService":"<dbService>"}[/code]                    
        {commonAttributes}    {driverClass}    {password}    {username}             {connectionURL}        {timezone}    {accessKey}     {secretKey}     {roleArn}     {region}     {dbName}              {dbInstanceIdentifier}         {dbService}[/code]                    

    The {region} values are specified in the file .../WEB-INF/application-context.xml, with their corresponding display labels defined in .../WEB-INF/bundles/jasperserver_messages.properties. By default, the following regions are defined:

    Values of AWS {region} in
    .../WEB-INF/application-context.xml

    Labels for AWS regions in
    .../WEB-INF/bundles/jasperserver_messages.properties

    Virtual Data Source

    The id of each subDataSource must be unique. The server does not prevent duplicates, and the last one to be defined silently overwrites the previous definition.

    application/repository.virtualDataSource+json

    application/repository.virtualDataSource+xml

    {    <commonAttributes>,     "subDataSources":[         {             "id":"<subDataSourceID>",             "uri":"<subDataSourceURI>"         },         ...    ] }[/code]                    
        {commonAttributes}                        {subDataSourceID}            {subDataSourceURI}                ...    [/code]                    

    Custom Data Source

    The value of the serviceClass attribute is read-only and depends on the specific type of the custom data source, as defined in the server's applicationContext configuration files.

    application/repository.customDataSource+json

    application/repository.customDataSource+xml

    {    <commonAttributes>,     "serviceClass":"<serviceClass>",       "dataSourceName":"<dataSourceName>",     "properties":[         {            "key":"<key>",            "value":"<value>"        },         ...    ] }[/code]                    
        {commonAttributes}            {serviceClass}                {dataSourceName}                            {key}            {value}                ...    [/code]                    

    Bean Data Source

    application/repository.beanDataSource+json

    application/repository.beanDataSource+xml

    {    <commonAttributes>,     "beanName":"<beanName>",     "beanMethod":"<beanMethod>"}[/code]                    
        {commonAttributes}    {beanName}    {beanMethod}[/code]                    

    Datatypes

    application/repository.dataType+json

    application/repository.dataType+xml

    {    <commonAttributes>,     "type":"text|number|date|dateTime|time",     "pattern":"<pattern>",     "maxValue":"<maxValue>",     "strictMax":"true|false",     "minValue":"<minValue>",     "strictMin":"true|false"       "maxLength":"<maxLengthInteger>"}[/code]                    
        {commonAttributes}    text|number|date|dateTime|time    {pattern}    {maxValue}    true|false    {minValue}    true|false    {maxLengthInteger}[/code]                    

    List of Values

    application/repository.listOfValues+json

    application/repository.listOfValues+xml

    {    <commonAttributes>,     "items":[        {            "label":"<label>",            "value":"<value>"        },        ...    ]}[/code]                    
        {commonAttributes}                        {label}            {value}                ...    [/code]                    

    Query

    The dataSource field of the query may be null. Set an empty dataSource field when you want to remove a local data source, either a reference or a local definition. When the data source of a query is not defined, the query uses the data source of its parent, for example its JRXML report (reportUnit).

    application/repository.query+json

    application/repository.query+xml

    {    <commonAttributes>,     "value":"<query>",     "language":"<language>",    "dataSource":{        "dataSourceReference": {            "uri":"<dataSourceURI>"        }    } }[/code]                    
        {commonAttributes}    {query}     {language}            {dataSourceURI}    [/code]                    

    Input Control

    Input controls come in several types that require different fields. The following table shows all possible fields, not all of which are mutually compatible.

    application/repository.inputControl+json

    application/repository.inputControl+xml

    {    <commonAttributes>,     "mandatory":"true|false",      "readOnly":"true|false",      "visible":"true|false",      "type":"<inputControlTypeByteValue>",    "usedFields":"<field1;field2;...>",    "dataType": {        "dataTypeReference": {            "uri": "<dataTypeResourceURI>"        }    },      "listOfValues": {        "listOfValuesReference": {            "uri": "<listOfValuesResourceURI>"        }    }      "visibleColumns":["column1", "colum2", ...],      "valueColumn":"<valueColumn>",      "query": {        "queryReference": {            "uri": "<queryResourceURI>"        }    }}[/code]                    
        {commonAttributes}    true|false    true|false    true|false    {inputControlTypeByteValue}    {field1;field2;...}            {dataTypeResourceURI}                {listOfValuesResourceURI}                {queryResourceURI}                {column1}        {column2}        ...        {valueColumn}[/code]                    

    The following list shows the numerical code and meaning for {inputControlTypeByteValue}. The input control type determines the other fields that are required. The list of required fields may appear in a field named usedFields, separated by semi-colons (;).

    Type

    Type of Input Control

    Other Fields Required (usedFields)

    1

    Boolean

    None

    2

    Single value

    dataType

    3

    Single-select list of values

    listOfValues

    4

    Single-select query

    query; queryValueColumn

    5

    Not used

    6

    Multi-select list of values

    listOfValues

    7

    Multi-select query

    query; queryValueColumn

    8

    Single-select list of values radio buttons

    listOfValues

    9

    Single-select query radio buttons

    query; queryValueColumn

    10

    Multi-select list of values check boxes

    listOfValues

    11

    Multi-select query check boxes

    query; queryValueColumn

    File

    The repository.file+<format> descriptor is used to identify the file type.

    application/repository.file+json

    application/repository.file+xml

    {    <commonAttributes>,     "type":"pdf|html|xls|rtf|csv|odt|txt            |docx|ods|xlsx|img|font|jrxml            |jar|prop|jrtx|xml|css            |olapMondrianSchema            |accessGrantSchema            |unspecified",    "content":"<base64EncodedContent>"}[/code]                    
        {commonAttributes}    pdf|html|xls|rtf|csv|odt|txt        |docx|ods|xlsx|img|font|jrxml        |jar|prop|jrtx|xml|css        |olapMondrianSchema        |accessGrantSchema|unspecified        {base64EncodedContent}[/code]                    

    The content field is write-only: it is absent when requesting the file resource descriptor and used only when uploading a file resource as base-64 encoded content. For other ways to upload file contents, see Uploading File Resources. To download file contents, see Downloading File Resources.

    Report Unit (JRXML Report)

    A report unit contains mostly references to the files that make up a report within the server. A report unit is a composite resource that may contain other local resources (see Nested Resources). In this case, the URIs that it references include a URI in the following format:

    <reportUnitURI>_files/<localResourceID>

    For example, the main JRXML of a sample report is referenced as follows:

    /reports/samples/Cascading_multi_select_report_files/Cascading_multi_select_report

    The default value for the controlsLayout is popupScreen. The reportRenderingView and the inputControlRenderingView can be left as empty strings (""), while the query can be null.

    application/repository.reportUnit+json

    application/repository.reportUnit+xml

    {    <commonAttributes>,     "controlsLayout":"<popupScreen|separatePage          |topOfPage|inPage>",[/code]                    
        {commonAttributes}    popupScreen|separatePage        |topOfPage|inPage[/code]                    
        "alwaysPromptControls":"true|false",    "inputControlRenderingView":        "<inputControlRenderingView>",        "reportRenderingView":        "<reportRenderingView>",    "dataSource":{        "dataSourceReference": {            "uri":"<dataSourceURI>"        }    },    "query:" {        "queryReference": {            uri: "<queryResourceURI>"        }    },      "jrxml": {        "jrxmlFileReference": {            "uri": "<jrxmlFileResourceURI>"        } or        "jrxmlFile": {            "type": "jrxml",            "label": "Main jrxml",            "content": "<base64Encoded>        }    },    "inputControls": [        {            "inputControlReference": {                "uri": "<inputControlURI>"            }           },        ...    ],    "resources": {        "resource": [{            "name": "<resourceName>",            "fileReference": {                "uri": "<fileResourceURI>"            }        }],         "resource": [{            "name": "Logo",            "file": {                "fileResource": {                    "type": "img",                    "label": "Logo.png",                    "content":"<base64Encoded>"                }            }        }]        ...    }}[/code]                    
        <alwaysPromptControls>true|false        </alwaysPromptControls>    <inputControlRenderingView>        {inputControlRenderingView}    </inputControlRenderingView>    <reportRenderingView>        {reportRenderingView}    </reportRenderingView>    <dataSource>        <dataSourceReference>            <uri>{dataSourceURI}</uri>        </dataSourceReference>    </dataSource>    <query>        <queryReference>            <uri>{queryResourceURI}</uri>        </queryReference>    </query>    <jrxml>          <jrxmlFileReference>            <uri>{jrxmlFileResourceURI}</uri>        </jrxmlFileReference>        or <jrxmlFile>               <type>jrxml</type>               <label>Main report</label>               <content>{base64Encoded}               </content>           </jrxmlFile>    </jrxml>    <inputControls>        <inputControlReference>            <uri>{inputControlURI}</uri>        </inputControlReference>        ...    </inputControls>    <resources>        <resource>            <name>{resourceName}</name>            <fileReference>                <uri>{fileResourceURI}</uri>            </fileReference>        </resource>        <resource>            <name>Logo</name>            <file>                <type>img</type>                <label>Logo.png</label>                <content>{base64Encoded}                </content>            </file>        </resource>        ...    </resources>    </reportUnit>[/code]                    

    Report Options

    application/repository.reportOptions+json

    application/repository.reportOptions+xml

    {    <commonAttributes>,     "reportUri":"<reportURI>",       "reportParameters":[          {             "name":"<parameterName>",             "value":[                 "value_1",                 "value_2",                 ...            ]         },          ...        ]  }[/code]                    
        {commonAttributes}    {reportURI}                        {parameterName}            value_1            value_2            ...                ...    [/code]                    

    Domain (semanticLayerDataSource)

    For more information about accessing the schema of a Domain, see Working With Domains.

    When the locale property is left empty, the default locale bundle is used.

    application/repository.semanticLayerDataSource+json

    application/repository.semanticLayerDataSource+xml

    {    <commonAttributes>,     "dataSource":{        "dataSourceReference": {            "uri":"<dataSourceURI>"    }   },    "schema": {        "schemaFileReference": {            "uri": "<schemaFileURI>"    }   },     "bundles": [{        "locale": "<localeString>",        "file": {            "fileReference": {"uri":                "<propertiesFileURI>"        }   }   },         ...    ],     "securityFile": {        "securityFileReference": {            "uri": "<securityFileURI>"}   }   }[/code]                    
        {commonAttributes}            {dataSourceURI}                {schemaFileURI}                            {localeString}                {propertiesFileURI}                             ...                 {securityFileURI}    [/code]                    

    Domain Topic

    A Domain Topic is a Topic created by selecting database fields from a Domain. It is structurally equivalent to a JRXML report, and thus it has the same type attributes (see Report Unit (JRXML Report)). The only difference is that the data source field will reference a Domain (semanticLayerDataSource).

    application/repository.domainTopic+json

    application/repository.domainTopic+xml

    Same attributes as
    application/repository.reportUnit+json

    Same attributes as
    application/repository.reportUnit+xml

    XML/A Connection

    application/repository.xmlaConnection+json

    application/repository.xmlaConnection+xml

    {    <commonAttributes>,     "url":"<xmlaServiceURL>",     "xmlaDataSource":"<xmlaDataSource>",     "catalog":"<catalog>",     "username":"<username>",     "password":"<password>"}[/code]                    
        {commonAttributes}    {xmlaServiceURL}            {xmlaDataSource}        {catalog}    {username}    {password}[/code]                    

    Mondrian Connection

    Mondrian connections without the access grant schemas are used in the Community edition of JasperReports Server.

    application/repository.mondrianConnection+json

    application/repository.mondrianConnection+xml

    {    <commonAttributes>,     "dataSource":{        "dataSourceReference": {            "uri":"<dataSourceURI>"        }    },    "schema": {        "schemaReference": {            "uri": "<schemaFileResourceURI>"        }    }}[/code]                    
        {commonAttributes}            {dataSourceURI}                {schemaFileResourceURI}    [/code]                    

    Secure Mondrian Connection

    Secure Mondrian connections are available only in commercial releases of JasperReports Server.

    application/repository.secureMondrianConnection+json

    application/repository.secureMondrianConnection+xml

    {    <commonAttributes>,     "dataSource":{        "dataSourceReference": {            "uri":"<dataSourceURI>"        }    },     "schema": {        "schemaReference": {            "uri": "<schemaFileResourceURI>"        }    },     "accessGrantSchemas": [        {            "accessGrantSchemaReference": {                "uri": "<accessGrantSchemaFileResourceURI>"            }        },        ...    ]}[/code]                    
        {commonAttributes}            {dataSourceURI}                {schemaFileResourceURI}                            {accessGrantSchemaFileResourceURI}            [/code]                    

    OLAP Unit

    application/repository.olapUnit+json

    application/repository.olapUnit+xml

    {    <commonAttributes>,     "mdxQuery":"<mdxQuery>",     "olapConnection": {         "olapConnectionReference": {                     "uri": "<olapConnectionReferenceURI>"              }      } }[/code]                    
        {commonAttributes}    {mdxQuery}            {olapConnectionReferenceURI}     [/code]                    

    Mondrian XML/A Definition

    application/repository.mondrianXmlaDefinition+json

    application/repository.mondrianXmlaDefinition+xml

    {    <commonAttributes>,     "catalog":"<catalog>",     "mondrianConnection": {        "mondrianConnectionReference": {            "uri": "<mondrianConnectionResourceURI>"        }    } }[/code]                    
        {commonAttributes}    {catalog}            {mondrianConnectionResourceURI}    [/code]                    

    Other Types

    The following types are defined in commercial editions of the server and appear in the repository. However, they are meant only to describe the corresponding resources as read-only objects in the repository. The REST API does not support services for clients to create or modify these types.

    The types in the following table contain only the common attributes described in Common Attributes.

    Type String

    Description

    application/repository.dashboard+json
    application/repository.dashboard+xml

    The dashboard resource descriptors are deprecated and subject to change.

    application/repository.adhocDataView+json
    application/repository.adhocDataView+xml

    The Ad Hoc view type is not fully defined yet and subject to change. Ad Hoc views may be referenced as data sources in other repository types, in which case they are called advDataSource.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...