The PUT method on the resource service is used to create a new resource. If the resource has one or more file resources, they must be provided using a multipart request.
Method | URL | ||
PUT | http://<host>:<port>/jasperserver[-pro]/rest/resource/path/to/resource/ | ||
Argument | Type/Value | Description | |
Resource | String | This parameter identifies the part with an XML resource descriptor in a multipart request. This is a required argument when using multipart requests. | |
Content-Type | Content | ||
multipart/form-data text/plain (in the first part) application/octet-stream (for files) | A well-formed XML resourceDescriptor that fully describes the resource, including any locally defined resources. File resources are uploaded in separate parts. | ||
Return Value on Success | Typical Return Values on Failure | ||
201 Created – The body is XML containing the resourceDescriptor of the resource just created. | An error if the resource cannot be created for some reason. If you have very large files, see section Setting the Temporary Upload Directory. |
In the following sample request, the URI is the location where we want to create the resource, in this case / (the root), and the content includes the resource descriptor for a new folder called myfolder.
Also, the example above shows a multi-part request even though it is only sending the plain-text resource descriptor and not a binary file. Usually, such requests could be sent without multiple parts, and multiple parts are used to send a binary file, for example when creating a report.
When the ResourceDescriptor contains the ResourceProperty PROP_PARENT_FOLDER, that property overrides the path/to/resource given as the URL and determines the location of the new resource. |
The response to the PUT request is the complete resource descriptor for the new folder:
Recommended Comments
There are no comments to display.