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:
http://community.jaspersoft.com/questions/1011556/create-domain-rest
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 = """------myBoundaryNameContent-Type: application/repository.semanticLayerDataSource+json; charset=UTF-8Content-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"}------myBoundaryNameContent-Disposition: form-data; name="schema"; filename="schema.xml"Content-Type: application/xml; charset=UTF-8{{ ...contents of schema... }}------myBoundaryName--"""headers = {'authorization': {{ ...auth info... }},'accept': "application/json",'content-type': "multipart/form-data; boundary=----myBoundaryName",}response = requests.request("POST", url, data=payload, headers=headers)
0 Answers:
No answers yet