• No results found

To access objects with relationships

4 Using the SDK

4.5 Navigating the BI platform repository

4.5.7 To access objects with relationships

Before you can retrieve a resource from the BI platform, you must have a valid logon token and know the base URL for RESTful web service requests.

You can access objects that are related to the currently listed object by appending its object ID, then append / relationships to the URL followed by the name of the relationship. Further, you can make more specific queries by adding the ID or CUID of an object. A relationship can be, for example, a resource such as an account named Administrator that is associated with with other objects such as user groups, received alerts and subscribed events. Use of the /infostore/<id> API will return relationship information on the InfoObject with

<id> if such associations exist. For more information on relationships, consult the Business Intelligence Platform Administator Guide.

1. Create a new HTTP request.

2. Add the X-SAP-LogonToken attribute to the request header and set its value to a valid logon token.

3. Add the Accept attribute to the request header and set its value to application/xml.

4. Use the GET method to send a request to the http://<baseURL>/biprws/infostore/<id>/

relationships/<id> URL.

Replace <baseURL> with the base URL for RESTful web service requests, and replace <id> with the ID or CUID of the object you want to retrieve.

To illustrate relationships, the following example begins by using the /infostore API. This will reveal if an object with an ID of 12 has any relationships to other objects in the BI platform.

http://commandcom-lcm:6405/biprws/infostore/12

The response shows that ID 12 is an Administrator object that has relationships that include include subscribedEvents, userGroups and receivedAlerts.

http://commandcom-lcm:6405/biprws/infostore/12 </uri>

</author>

<id>

tag:sap.com,2010:bip-rs/AfRWaT5_131NlLLf5bRMLKY </id>

<title type="text">

Administrator </title>

<updated>

2012-01-04T20:03:20.085Z </updated>

<link href="http://commandcom-lcm:6405/biprws/infostore/Users" rel="up"/>

<link href="http://commandcom-lcm:6405/biprws/infostore/12/relationships/

subscribedEvents"

rel="http://www.sap.com/rws/bip#subscribed-events" title="Subscribed events"/>

<link href="http://commandcom-lcm:6405/biprws/infostore/12/relationships/

userGroups"

rel="http://www.sap.com/rws/bip#user-groups" title="User groups"/>

<link href="http://commandcom-lcm:6405/biprws/infostore/12/relationships/

receivedAlerts"

rel="http://www.sap.com/rws/bip#received-alerts" title="Received alerts"/>

<content type="application/xml">

<attrs xmlns="http://www.sap.com/rws/bip">

<attr name="id" type="int32">

12 </attr>

<attr name="cuid" type="string">

AfRWaT5_131NlLLf5bRMLKY </attr>

<attr name="description" type="string">

Administrator account </attr>

<attr name="name" type="string">

Administrator </attr>

<attr name="type" type="string">

User </attr>

<attr name="emailAddress" type="string"/>

<attr name="lastLogon" type="datetime">

2012-01-04T20:03:20.085Z </attr>

<attr name="fullName" type="string"/>

</attrs>

</content>

</entry>

The following code snippet uses the .../relationship/users link obtained from the previous example.

http://commandcom-lcm:6405/biprws/infostore/12/relationships/userGroups

Since a trailing ID number was not used, the response in the following code snippet lists 3 links that may be examined further. These are ../infostore/1, ../infostore/2 and ../infostore/3.

<?xml version="1.0" ?>

http://commandcom-lcm:6405/biprws/infostore/12 </uri>

</author>

<id>

tag:sap.com,2010:bip-rs/AfRWaT5_131NlLLf5bRMLKY/relationships/userGroups </id>

<title type="text">

InfoObjects related to Administrator via userGroups </title>

<updated>

2012-01-04T20:08:32.441Z </updated>

<entry>

<title type="text">

1 </title>

<id>

tag:sap.com,2010:bip-rs/AfRWaT5_131NlLLf5bRMLKY/relationships/userGroups/1 </id>

<link href="http://commandcom-lcm:6405/biprws/infostore/12/relationships/

userGroups/1" rel="self"/>

<link href="http://commandcom-lcm:6405/biprws/infostore/1" rel="related"/>

<content type="application/xml">

<attrs xmlns="http://www.sap.com/rws/bip">

<attr name="id" type="int32">

<title type="text">

2 </title>

<id>

tag:sap.com,2010:bip-rs/AfRWaT5_131NlLLf5bRMLKY/relationships/userGroups/2 </id>

<link href="http://commandcom-lcm:6405/biprws/infostore/12/relationships/

userGroups/2" rel="self"/>

<link href="http://commandcom-lcm:6405/biprws/infostore/2" rel="related"/>

<content type="application/xml">

<attrs xmlns="http://www.sap.com/rws/bip">

<attr name="id" type="int32">

<title type="text">

3 </title>

<id>

tag:sap.com,2010:bip-rs/AfRWaT5_131NlLLf5bRMLKY/relationships/userGroups/3 </id>

<link href="http://commandcom-lcm:6405/biprws/infostore/12/relationships/

userGroups/3" rel="self"/>

<link href="http://commandcom-lcm:6405/biprws/infostore/3" rel="related"/>

<content type="application/xml">

<attrs xmlns="http://www.sap.com/rws/bip">

<attr name="id" type="int32">

Related documents