sma2006 Outstanding Contributor.
Outstanding Contributor.
197 views

How to return empty attributes with REST driver query

Hello,

When I make a REST query to the IDM 4.7 REST driver, empty attributes are not returned:

Query :

https://10.175.99.26:9090/User?search-attr=cn%20eq%20%27*bla%27&read-attr=CN%20and%20Surname%20and%20Given%20Name%20and%20Internet%20Email%20Address

Response :

{"totalResults":1,"results":[{"association":"BLA","src-dn":"\\TEST\\data\\users\\BLA","class-name":"User","CN":["BLA"],"Surname":["LALATEST"],"Given Name":["Bob"]}]}

(no email address in the json answer)

This is normal behavior as per the OTP policy : NETQRESTJSON-otp-XDStoJSON

I tried to modify this rule to add the missing empty attribute, but I'm missing some XPATH expertise.

Does anyone already tried that ?

Thanks a lot.

Sylvain

 

Labels (1)
0 Likes
7 Replies
Knowledge Partner
Knowledge Partner

Re: How to return empty attributes with REST driver query

Hi Sylvain,

Could you show an example of JSON doc returned from query to this entry point without the driver? (for example, directly fro your browser).

Level 3 driver trace also will be helpfull.

 

0 Likes
sma2006 Outstanding Contributor.
Outstanding Contributor.

Re: How to return empty attributes with REST driver query

Hello,

Maybe I was not clear, but the query is on the publisher channel from my browser to eDirectory.

After itp-json-to-xds, the query is :

<nds dtdversion="3.5" ndsversion="8.x">

  <source>

    <product build="20181130_1107" instance="Rest Driver" version="1.0.2.0">Identity Manager REST Driver</product>

    <contact>NetIQ Corporation.</contact>

  </source>

  <input>

    <query class-name="User">

      <search-class class-name="User"/>

      <search-attr attr-name="cn ">

        <value> *bla</value>

      </search-attr>

      <read-attr attr-name="CN "/>

      <read-attr attr-name=" Surname "/>

      <read-attr attr-name=" Given Name "/>

      <read-attr attr-name=" Internet Email Address"/>

    </query>

  </input>

</nds>

 

The answer to the query is (xds):

<output>

    <instance class-name="User" event-id="0" qualified-src-dn="O=data\OU=users\CN=BLA" src-dn="\XXX\data\users\BLA" src-entry-id="34286">

      <association state="associated">BLA</association>

      <attr attr-name="CN">

        <value naming="true" timestamp="1433156258#28" type="string">BLA</value>

      </attr>

      <attr attr-name="Surname">

        <value timestamp="1433156258#6" type="string">LALATEST</value>

      </attr>

      <attr attr-name="Given Name">

        <value timestamp="1433156258#5" type="string">Ben</value>

      </attr>

    </instance>

    <status event-id="0" level="success"></status>

  </output>

 

All is ok and the JSON answer is (after otp-XDS to JSON)

 

[09/10/19 23:12:28.161]:Rest Driver PT:                Token Value: "{"totalResults":1,"results":[{"association":"BLA","src-dn":"\\XXX\\data\\users\\BLA","class-name":"User","CN":["BLA"],"Surname":["LALATEST"],"Given Name":["Ben"]}]}".

 

This work as designed, but I would like to have the empty attributes in the JSON answers, like :

[09/10/19 23:12:28.161]:Rest Driver PT:                Token Value: "{"totalResults":1,"results":[{"association":"BLA","src-dn":"\\XXX\\data\\users\\BLA","class-name":"User","CN":["BLA"],"Surname":["LALATEST"],"Given Name":["Ben"],"Internet Email Address":[]}]}".

 

This should be possible by modifying the OTP xds to json rule.

It means, adding the empty attribute in the XML before the XDS-to-JSON transformation.

I tried different solution, but I'm unsuccessful.

 

thx

 

Sylvain

 

0 Likes
Knowledge Partner
Knowledge Partner

Re: How to return empty attributes with REST driver query

Hi Sylvain,

Driver designed to convert XDS document to JSON format (all existing attributes in this XDS doc).

Your XDS response doesn't include email info (it doesn't exist in your object) and "optimization" functionality doesn't include empty/non-existing attributes in this response.

XDS2JSON converter includes to JSON only existing in "original" XDS information. How this convertor knows, that you want also email? Why not ein or any other existing in schema attributes?

 

Anyway, this is the expected functionality related to the product architecture (query-response).

 

0 Likes
sma2006 Outstanding Contributor.
Outstanding Contributor.

Re: How to return empty attributes with REST driver query

Yes, I understand, but the below rule first create a variable name "status"  that contain the query output  that is then converted to Base64 (xmlinput variable) and then send to the XDStoJSON .

So, my idea is to modify the "status" variable to add the xml element with missing empty attribute.

I guess this can be done by comparing the query and the output.

Don't you think this might be possible ?

 

thx

 

Sylvain

 

 

0 Likes
sma2006 Outstanding Contributor.
Outstanding Contributor.

Re: How to return empty attributes with REST driver query

Here is the whole rule :

 

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE policy PUBLIC "policy-builder-dtd" "C:\netiq\idm\apps\Designer47\plugins\com.novell.idm.policybuilder_4.0.0.201906141638\DTD\dirxmlscript4.7.3.dtd"><policy xmlns:es="http://www.novell.com/nxsl/ecmascript" xmlns:rs="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.rest.common.JSONConverter">
<rule>
<description>Translate XDS to JSON</description>
<conditions>
<and>
<if-operation mode="regex" op="not-equal">instance</if-operation>
<if-operation mode="nocase" op="not-equal">driver-operation-data</if-operation>
</and>
</conditions>
<actions>
<do-if>
<arg-conditions>
<and>
<if-operation mode="regex" op="equal">status</if-operation>
<if-xpath op="true">count(//nds//instance)>0</if-xpath>
<if-xpath op="not-true">//instance[@class-name="DirXML-Driver"]</if-xpath>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="status" scope="policy">
<arg-node-set>
<token-xml-parse>
<token-text xml:space="preserve">&lt;status>&lt;/status></token-text>
</token-xml-parse>
</arg-node-set>
</do-set-local-variable>
<do-clone-xpath dest-expression="$status/status" src-expression="/nds/*/instance"/>
<do-set-local-variable name="xmlInput" scope="policy">
<arg-string>
<token-base64-encode charset="UTF-8">
<token-replace-all regex="&amp;lt;" replace-with="&lt;">
<token-xml-serialize>
<token-xpath expression="$status"/>
</token-xml-serialize>
</token-replace-all>
</token-base64-encode>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="applicationContent" notrace="true" scope="policy">
<arg-string>
<token-xpath expression="rs:xdsToJSON($xmlInput)"/>
</arg-string>
</do-set-local-variable>
<do-append-xml-element expression="$current-op" name="driver-operation-data"/>
<do-append-xml-element expression="$current-op/driver-operation-data[last()]" name="header"/>
<do-set-xml-attr expression="$current-op/driver-operation-data[last()]/header" name="Accept">
<arg-string>
<token-text xml:space="preserve">application/json</token-text>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="$current-op/driver-operation-data[last()]" name="response"/>
<do-append-xml-element expression="$current-op/driver-operation-data[last()]/response" name="value"/>
<do-append-xml-text expression="$current-op/driver-operation-data[last()]/response/value" notrace="true">
<arg-string>
<token-local-variable name="applicationContent"/>
</arg-string>
</do-append-xml-text>
<do-strip-xpath expression="/nds/*/instance"/>
</arg-actions>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-class-name op="available"/>
<if-class-name mode="nocase" op="not-equal">DirXML-Driver</if-class-name>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="operations" scope="policy">
<arg-node-set>
<token-xpath expression="."/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-local-variable name="operations"/>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="xmlInput" notrace="true" scope="policy">
<arg-string>
<token-base64-encode charset="UTF-8">
<token-replace-all regex="&amp;lt;" replace-with="&lt;">
<token-xml-serialize>
<token-xpath expression="$current-op"/>
</token-xml-serialize>
</token-replace-all>
</token-base64-encode>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="applicationContent" notrace="true" scope="policy">
<arg-string>
<token-xpath expression="rs:xdsToJSON($xmlInput)"/>
</arg-string>
</do-set-local-variable>
<do-if notrace="true">
<arg-conditions>
<and>
<if-local-variable mode="nocase" name="applicationContent" op="not-equal"/>
</and>
</arg-conditions>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-operation mode="regex" op="not-equal">query</if-operation>
</and>
</arg-conditions>
<arg-actions>
<do-append-xml-element expression=".." name="driver-operation-data"/>
<do-set-xml-attr expression="../driver-operation-data" name="src-dn">
<arg-string>
<token-src-dn/>
</arg-string>
</do-set-xml-attr>
<do-if>
<arg-conditions>
<and>
<if-password op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="is-sensitive">
<arg-string>
<token-text xml:space="preserve">true</token-text>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions/>
</do-if>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="class-name">
<arg-string>
<token-class-name/>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="event-id">
<arg-string>
<token-xpath expression="$current-op/@event-id"/>
</arg-string>
</do-set-xml-attr>
<do-if>
<arg-conditions>
<and>
<if-operation mode="nocase" op="equal">modify-password</if-operation>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="command">
<arg-string>
<token-text xml:space="preserve">modify</token-text>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="command">
<arg-string>
<token-operation/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
</do-if>
<do-append-xml-element expression="../driver-operation-data[last()]" name="request"/>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="url-token"/>
<do-if>
<arg-conditions>
<and>
<if-association op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="association">
<arg-string>
<token-association/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions/>
</do-if>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="header"/>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/header" name="content-type">
<arg-string>
<token-text xml:space="preserve">application/json</token-text>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="value"/>
<do-append-xml-text expression="../driver-operation-data[last()]/request[last()]/value">
<arg-string>
<token-local-variable name="applicationContent"/>
</arg-string>
</do-append-xml-text>
</arg-actions>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-xpath op="true">$current-op/@scope="entry"</if-xpath>
</and>
</arg-conditions>
<arg-actions>
<do-append-xml-element expression=".." name="driver-operation-data"/>
<do-if disabled="true">
<arg-conditions>
<and>
<if-global-variable mode="case" name="drv.allowtracing" op="equal">false</if-global-variable>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="is-sensitive">
<arg-string>
<token-text xml:space="preserve">false</token-text>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="is-sensitive">
<arg-string>
<token-text xml:space="preserve">true</token-text>
</arg-string>
</do-set-xml-attr>
</arg-actions>
</do-if>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="class-name">
<arg-string>
<token-class-name/>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="command">
<arg-string>
<token-operation/>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="event-id">
<arg-string>
<token-xpath expression="$current-op/@event-id"/>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]" name="request"/>
<do-if>
<arg-conditions>
<and>
<if-association op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="associationHolder" scope="policy">
<arg-string>
<token-association/>
</arg-string>
</do-set-local-variable>
</arg-actions>
<arg-actions>
<do-set-local-variable name="associationHolder" scope="policy">
<arg-string>
<token-text xml:space="preserve">/</token-text>
<token-dest-dn/>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-if>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="url-token"/>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="association">
<arg-string>
<token-local-variable name="associationHolder"/>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="header"/>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/header" name="content-type">
<arg-string>
<token-text xml:space="preserve">application/json</token-text>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="value"/>
<do-append-xml-text expression="../driver-operation-data[last()]/request[last()]/value">
<arg-string>
<token-local-variable name="applicationContent"/>
</arg-string>
</do-append-xml-text>
</arg-actions>
<arg-actions>
<do-set-local-variable name="searchClasses" scope="policy">
<arg-node-set>
<token-xpath expression="$current-op/search-class"/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-local-variable name="searchClasses"/>
</arg-node-set>
<arg-actions>
<do-append-xml-element expression=".." name="driver-operation-data"/>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="class-name">
<arg-string>
<token-class-name/>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="command">
<arg-string>
<token-operation/>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="event-id">
<arg-string>
<token-xpath expression="$current-op/@event-id"/>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]" name="request"/>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="url-token"/>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="header"/>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/header" name="content-type">
<arg-string>
<token-text xml:space="preserve">application/json</token-text>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="value"/>
<do-append-xml-text expression="../driver-operation-data[last()]/request[last()]/value">
<arg-string>
<token-local-variable name="applicationContent"/>
</arg-string>
</do-append-xml-text>
<do-set-local-variable name="searchAttrs" scope="policy">
<arg-node-set>
<token-xpath expression="$current-op/search-attr"/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-local-variable name="searchAttrs"/>
</arg-node-set>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-local-variable name="filterText" op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="filterText" scope="policy">
<arg-string>
<token-xpath expression="$current-node/@attr-name"/>
<token-text xml:space="preserve"> eq '</token-text>
<token-xpath expression="$current-node/value/text()"/>
<token-text xml:space="preserve">'</token-text>
<token-text xml:space="preserve"> and </token-text>
<token-local-variable name="filterText"/>
</arg-string>
</do-set-local-variable>
</arg-actions>
<arg-actions>
<do-set-local-variable name="filterText" scope="policy">
<arg-string>
<token-xpath expression="$current-node/@attr-name"/>
<token-text xml:space="preserve"> eq '</token-text>
<token-xpath expression="$current-node/value/text()"/>
<token-text xml:space="preserve">'</token-text>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-if>
</arg-actions>
</do-for-each>
<do-set-local-variable name="filterText" scope="policy">
<arg-string>
<token-xpath expression='rs:urlEncode($filterText,"UTF-8")'/>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-for-each>
</arg-actions>
</do-if>
<do-set-local-variable name="readAttrs" scope="policy">
<arg-node-set>
<token-xpath expression="$current-op/read-attr"/>
</arg-node-set>
</do-set-local-variable>
<do-if>
<arg-conditions>
<and>
<if-xpath op="true">count($readAttrs)>0</if-xpath>
</and>
</arg-conditions>
<arg-actions>
<do-for-each>
<arg-node-set>
<token-local-variable name="readAttrs"/>
</arg-node-set>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-local-variable name="readAttrText" op="not-available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="readAttrText" scope="policy">
<arg-string>
<token-text xml:space="preserve">'</token-text>
<token-xpath expression="$current-node/@attr-name"/>
<token-text xml:space="preserve">'</token-text>
</arg-string>
</do-set-local-variable>
</arg-actions>
<arg-actions>
<do-set-local-variable name="readAttrText" scope="policy">
<arg-string>
<token-text xml:space="preserve">'</token-text>
<token-xpath expression="$current-node/@attr-name"/>
<token-text xml:space="preserve">'</token-text>
<token-text xml:space="preserve">and</token-text>
<token-local-variable name="readAttrText"/>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-if>
</arg-actions>
</do-for-each>
<do-if>
<arg-conditions>
<and>
<if-local-variable mode="case" name="readAttrText" op="not-equal">''</if-local-variable>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="readAttrText" scope="policy">
<arg-string>
<token-xpath expression='rs:urlEncode($readAttrText,"UTF-8")'/>
</arg-string>
</do-set-local-variable>
<do-if>
<arg-conditions>
<and>
<if-xpath op="true">$current-op/@scope="entry"</if-xpath>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="filter">
<arg-string>
<token-text xml:space="preserve">?read-attr=</token-text>
<token-local-variable name="readAttrText"/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="filter">
<arg-string>
<token-text xml:space="preserve">?search-attr=</token-text>
<token-local-variable name="filterText"/>
<token-text xml:space="preserve">&amp;read-attr=</token-text>
<token-local-variable name="readAttrText"/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
</do-if>
</arg-actions>
<arg-actions>
<do-set-local-variable name="readAttrText" scope="policy">
<arg-string>
<token-xpath expression='rs:urlEncode("","UTF-8")'/>
</arg-string>
</do-set-local-variable>
<do-if>
<arg-conditions>
<and>
<if-xpath op="true">$current-op/@scope="entry"</if-xpath>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="filter">
<arg-string>
<token-text xml:space="preserve">?read-attr=</token-text>
<token-local-variable name="readAttrText"/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="filter">
<arg-string>
<token-text xml:space="preserve">?search-attr=</token-text>
<token-local-variable name="filterText"/>
<token-text xml:space="preserve">&amp;read-attr=</token-text>
<token-local-variable name="readAttrText"/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
</do-if>
</arg-actions>
</do-if>
</arg-actions>
<arg-actions>
<do-set-local-variable name="readAttrText" scope="policy">
<arg-string>
<token-xpath expression='rs:urlEncode("*","UTF-8")'/>
</arg-string>
</do-set-local-variable>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="filter">
<arg-string>
<token-text xml:space="preserve">?search-attr=</token-text>
<token-local-variable name="filterText"/>
<token-text xml:space="preserve">&amp;read-attr=</token-text>
<token-local-variable name="readAttrText"/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
</do-if>
</arg-actions>
</do-if>
</arg-actions>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-operation mode="regex" op="equal">delete|modify-password</if-operation>
</and>
</arg-conditions>
<arg-actions>
<do-append-xml-element expression=".." name="driver-operation-data"/>
<do-if>
<arg-conditions>
<and>
<if-password op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="is-sensitive">
<arg-string>
<token-text xml:space="preserve">true</token-text>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions/>
</do-if>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="class-name">
<arg-string>
<token-class-name/>
</arg-string>
</do-set-xml-attr>
<do-if>
<arg-conditions>
<and>
<if-operation mode="nocase" op="equal">modify-password</if-operation>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="command">
<arg-string>
<token-text xml:space="preserve">modify</token-text>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]" name="command">
<arg-string>
<token-operation/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
</do-if>
<do-append-xml-element expression="../driver-operation-data[last()]" name="request"/>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="url-token"/>
<do-if>
<arg-conditions>
<and>
<if-association op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/url-token" name="association">
<arg-string>
<token-association/>
</arg-string>
</do-set-xml-attr>
</arg-actions>
<arg-actions/>
</do-if>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="header"/>
<do-set-xml-attr expression="../driver-operation-data[last()]/request[last()]/header" name="content-type">
<arg-string>
<token-text xml:space="preserve">application/json</token-text>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]/request[last()]" name="value"/>
<do-append-xml-text expression="../driver-operation-data[last()]/request[last()]/value">
<arg-string>
<token-local-variable name="applicationContent"/>
</arg-string>
</do-append-xml-text>
</arg-actions>
<arg-actions/>
</do-if>
</arg-actions>
</do-if>
<do-clone-xpath dest-expression="../driver-operation-data[last()]" notrace="true" src-expression="$current-op/operation-data"/>
<do-strip-xpath expression="$current-op" notrace="true"/>
</arg-actions>
</do-for-each>
</arg-actions>
<arg-actions/>
</do-if>
</arg-actions>
</do-if>
</actions>
</rule>
</policy>

0 Likes
sma2006 Outstanding Contributor.
Outstanding Contributor.

Re: How to return empty attributes with REST driver query

I made some progress, from another thread in this forum I get the rules syntax to add an attribute to the output to the query.

I added this rule before the XDS-to-JSON otp rule:

<rule>
<description>Add empty or not empty attributes to output - 13 sept 2019</description>
<conditions>
<and>
<if-operation mode="regex" op="equal">instance</if-operation>
<if-operation mode="nocase" op="not-equal">driver-operation-data</if-operation>
</and>
</conditions>
<actions>
<do-append-xml-element expression="." name="attr"/>
<do-set-xml-attr expression="attr[last()]" name="attr-name">
<arg-string>
<token-text xml:space="preserve">Internet Email Address</token-text>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="attr[last()]" name="value"/>
<do-append-xml-text expression='$current-op/attr[@attr-name="Internet Email Address"]/value'>
<arg-string>
<token-text xml:space="preserve"> </token-text>
</arg-string>
</do-append-xml-text>
</actions>
</rule>

 

Now, I need to find from the query result which attribut is empty and fill in the output accordingly.

 

0 Likes
Knowledge Partner
Knowledge Partner

Re: How to return empty attributes with REST driver query

IDM is a very flexible product and it allows to do almost everything.

If you are ready to spend a long time and put great amounts of efforts to this task, you will be able to achieve the result! 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.