jlongoria Posted February 10, 2017 Posted February 10, 2017 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-restBut 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 = """ ------myBoundaryName 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" } ------myBoundaryName Content-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)
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