vgaikwad Posted November 25, 2015 Share Posted November 25, 2015 Hi,I am using the resource ("rest/resource") v1 rest api. and want to create a datasource on the server. As per the documentation I am using a plain vanilla web request (btw I am in c#).http-method = "PUT"content-type = "text/plain; boundary={boundaryvalue}"Payload looks like this:--1afdzzMUQLfSOmu0Pgb2F-nmEnTwWuPf3Content-Disposition: form-data; name="local"Content-Type: text/plain; charset=utf-8Content-Transfer-Encoding: 8bit<resourceDescriptor name="local" wsType="custom" uriString="/datasources" isNew="true"><label><![CDATA[local]]></label><creationDate></creationDate><resourceProperty name="PROP_RESOURCE_TYPE"><value><![CDATA[com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.CustomReportDataSource]]></value></resourceProperty><resourceProperty name="PROP_PARENT_FOLDER"><value><![CDATA[/datasources]]></value></resourceProperty><resourceProperty name="PROP_VERSION"><value><![CDATA[0]]></value></resourceProperty><resourceProperty name="PROP_SECURITY_PERMISSION_MASK"><value><![CDATA[33]]></value></resourceProperty><resourceProperty name="PROP_DATASOURCE_CUSTOM_SERVICE_CLASS"><value><![CDATA[com.jaspersoft.jasperserver.api.metadata.jasperreports.service.ReportDataAdapterService]]></value></resourceProperty><resourceProperty name="PROP_DATASOURCE_CUSTOM_PROPERTY_MAP"><resourceProperty name="fileName"><value><![CDATA[http://local/json]]></value></resourceProperty><resourceProperty name="_cds_name"><value><![CDATA[jsonDataSource]]></value></resourceProperty></resourceProperty><resourceProperty name="PROP_HAS_DATA"><value><![CDATA[true]]></value></resourceProperty></resourceDescriptor>--1afdzzMUQLfSOmu0Pgb2F-nmEnTwWuPf3-- On sending this to server I get "The remote server returned an error: (403) Forbidden" error. Any help is much appreciated. I have also tried changing the follow:Content-Disposition: form-data; name="ResourceDescriptor"It still give me the same error. Link to comment Share on other sites More sharing options...
hozawa Posted November 25, 2015 Share Posted November 25, 2015 You'll need to send user/password to use to login to JasperReports Server with the request. That user would need privilege to write to the folder where the datasource will be created. Link to comment Share on other sites More sharing options...
vgaikwad Posted November 26, 2015 Author Share Posted November 26, 2015 Hi hozawa,Thanks for the response, that is not the case, I can change the pay load and create fodler. The session is created for a organization_1 > jasperadmin user which is kind of a administration profile.Are there any working examples of the same? (i.e. creating datasource using resource api v1)Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now