Jump to content
We've recently updated our Privacy Statement, available here ×
  • How-To: Downloading and Uploading a Domain Schema Using RESTv2


    eferrell
    • Features: Domains, Web Services Version: v6.0 Product: JasperReports® Server

    In this article I will provide step-by-step instructions for editing a domain schema using the RESTv2 webservice API. I recommend testing this out with a REST tool before coding your customized solution. I used WizTool’s REST Client v3.2.2 which can be found here: http://code.fosshub.com/WizToolsorg-RESTClient/download/restclient-ui-3.2.2-jar-with-dependencies.jar but you can also use the Postman extension on Google Chrome.

    1. First, you need to get the resource descriptor of the domain. You are required to know the repository URI of the domain as it part of the request’s URL. This resource descriptor will contain the URI of the domain’s schema file which we will use in future steps.

      URL: localhost:8080/jasperserver-pro/rest_v2/resources/public/Testing/sugarcrm_domain_REST

      Method: GET

      Auth: Basic, username=superuser, password=superuser, pre-emptive=yes

      Body: None (GET request)

      Response Status: HTTP/1.1 200 OK

      Response Body:

      <?xml version="1.0" encoding="UTF-8"?>
      <semanticLayerDataSource>
          <creationDate>2015-04-02T11:26:04</creationDate>
          <description/>
          <label>sugarcrm-domain-REST</label>
          <permissionMask>1</permissionMask>
          <updateDate>2015-04-02T11:26:04</updateDate>
          <uri>/public/Testing/sugarcrm_domain_REST</uri>
          <version>0</version>
          <dataSourceReference>
              <uri>/public/Samples/Data_Sources/SugarCRM_postgres93</uri>
          </dataSourceReference>
          <schemaFileReference>
              <uri>/public/Testing/sugarcrm_domain_REST_files/sugarcrm_domain_REST_schema</uri>
          </schemaFileReference>
      </semanticLayerDataSource>
      
    2. Download the existing schema using the URI in the schemaFileReference tag from the domain resource descriptor.

      URL: localhost:8080/jasperserver-pro/rest_v2/resources/public/Testing/sugarcrm_domain_REST_files/sugarcrm_domain_REST_schema

      Method: GET

      Auth: Basic, username=superuser, password=superuser, pre-emptive=yes

      Body: None (GET request)

      Response Status: HTTP/1.1 200 OK

      Response Body:

      [Contains the schema XML file. This is the same file that you would see if you click on the Export Design button in the Domain Designer]

    3. Modify your domain schema xml.

    4. Upload the schema xml back to the repository replacing the existing one. Note that this call is very similar to step 2 but requires additional parameters in the header.

      URL: localhost:8080/jasperserver-pro/rest_v2/resources/public/Testing/sugarcrm_domain_REST_files/sugarcrm_domain_REST_schema

      Method: PUT

      Auth: Basic, username=superuser, password=superuser, pre-emptive=yes

      Header
        Content-Type:
      application/xml

        Content-Disposition: filename=schema.xml

      Body Contents:

      [Contains the modified domain xml schema from step 3.]

      Response Status: HTTP/1.1 200 OK

      Response Body:

      <?xml version="1.0" encoding="UTF-8"?>
      <file>
          <creationDate>2015-04-02T11:26:04</creationDate>
          <label>sugarcrm_domain_REST_schema</label>
          <permissionMask>1</permissionMask>
          <updateDate>2015-04-02T11:45:43</updateDate>
          <uri>/public/Testing/sugarcrm_domain_REST_files/sugarcrm_domain_REST_schema</uri>
          <version>1</version>
          <type>xml</type>
      </file>
      

    User Feedback

    Recommended Comments

    There are no comments to display.



    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...