Create Domain on Jasper via PHP Client

I want to create a domain using the PHP Rest Client.
I created a semanticLayerDatasource. I want to create the schema of this domain in $domname_files.
The object semanticLayer.... needs a schema, but the documentation lacks in this point.
So any idea or at best an example how to create a domain via the php client would be much appreciated.
I tried to create a xml file locally and set schema to the uri of this source. This way i am able to create a domain, but if i try to create an adhoc view, i get a null exception.

Thank you.

t.mehner's picture
Joined: Jun 23 2016 - 2:44am
Last seen: 5 years 11 months ago

1 Answer:

Here is the example how to create a domain:

$domain = new Jaspersoft\Dto\Resource\SemanticLayerDataSource();
$domain->uri = $uri;
$domain->dataSource = $dataSourceuri;
$domain->label = "Client Domain";
$domain->schema = new Jaspersoft\Dto\Resource\File();
$domain->schema->content = base64_encode(file_get_contents('schema.data')); // base46 does the trick
$domain->schema->type = 'xml';
$domain->schema->label = 'schema';
$repositoryService->createResource($domain);

branko.vukasovic's picture
Joined: Jan 28 2015 - 4:19am
Last seen: 2 years 7 months ago
Feedback
randomness