How to create a new Domain via REST v2?

How can I create a domain using REST v2? (NOTE: I am not allowed to use the PHP client interface.)

I am currently using the python 'requests' library to make the POST request outlined in the reponse found here:

But I can't get it to work. Can anyone give me a detailed example in which you successfully create a new domain through the REST v2 API?

Here is what I have tried. The desired name of the domain is "myNewDomain". Using 'superuser' authorization.

        url = "http://{{myJasperServer}}/jasperserver-pro/rest_v2/resources/organizations/organization_1/api_test/myNewDomain"
        payload = """
                  Content-Type: application/repository.semanticLayerDataSource+json; charset=UTF-8
                  Content-Disposition: form-data; name="resource"
                        "uri" : "/organizations/organization_1/api_test/myNewDomain",
                        "dataSource": {
                            "dataSourceReference": {
                                "uri": "/path/to/myDataSource"
                        "schema": {
                            "schemaFile": {
                                "label": "schema",
                                "description": "schema",
                                "type": "xml"
                        "label": "myNewDomain"
                  Content-Disposition: form-data; name="schema"; filename="schema.xml"
                  Content-Type: application/xml; charset=UTF-8
                 {{ ...contents of schema... }}
        headers = {
            'authorization': {{ ...auth info... }},
            'accept': "application/json",
            'content-type': "multipart/form-data; boundary=----myBoundaryName",
        response = requests.request("POST", url, data=payload, headers=headers)
jlongoria's picture
Joined: Aug 21 2015 - 8:03am
Last seen: 1 year 11 months ago

0 Answers:

No answers yet