cancel
Showing results for 
Search instead for 
Did you mean: 

Document parameters are not correct from sap bo rest api

Can4
Explorer
0 Kudos
214

Hi,

I am trying to convert sap bo sdk operations to sap bo rest api. So I am using below url to get document parameters;

http://<server>:<port>/biprws/raylight/v1/documents/<DOCID>/parameters

When I try this url to getting document parameters for almost all documents everything is okey and same with sap bo sdk but when I want to list the parameters of some documents, when I run this url, the parameters as in the SDK do not come. Some parameters that say 'Select a context'.

Sample response below;

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<parameters>
    <parameter optional="false" type="context" dpId="DP0" primary="true">
        <id>0</id>
        <technicalName>0</technicalName>
        <name>Select a context</name>
        <answer constrained="true" type="Text" keyType="Numeric">
            <info cardinality="Single" keepLastValues="true" dynamic="false">
                <lov hierarchical="false" partial="false" refreshable="true" searchable="false">
                    <values>
                        <value id="1">Vehicle Test</value>
                        <value id="2">Vehicle Correct</value>
                    </values>
                </lov>
            </info>
        </answer>
    </parameter>
    <parameter optional="false" type="context" dpId="DP1" primary="true">
        <id>1</id>
        <technicalName>0</technicalName>
        <name>Select a context</name>
        <answer constrained="true" type="Text" keyType="Numeric">
            <info cardinality="Single" keepLastValues="true" dynamic="false">
                <lov hierarchical="false" partial="false" refreshable="true" searchable="false">
                    <values>
                        <value id="1">Vehicle Test</value>
                        <value id="2">Vehicle Correct</value>
                    </values>
                </lov>
            </info>
        </answer>
    </parameter>
    <parameter optional="false" type="context" dpId="DP2" primary="true">
        <id>2</id>
        <technicalName>0</technicalName>
        <name>Select a context</name>
        <answer constrained="true" type="Text" keyType="Numeric">
            <info cardinality="Single" keepLastValues="true" dynamic="false">
                <lov hierarchical="false" partial="false" refreshable="true" searchable="false">
                    <values>
                        <value id="1">Vehicle Test</value>
                        <value id="2">Vehicle Correct</value>
                    </values>
                </lov>
            </info>
        </answer>
    </parameter>
</parameters>

What is the reason for this issue? How can I access the parameters of the same document, which are obtained when triggered with the SDK, via the REST API as well?

View Entire Topic
Joe_Peters
Active Contributor

The way /parameters works is that if all prompts have been answered, then the refresh is executed.  If any prompts remain unanswered, then the response includes the XML like you have in your question.  The reason this is happening is that you need to select a context for each query (you have one context for each of two queries).  Once you do that with another PUT, then you'll get another XML response for the actual prompts.  

To submit the request with parameters, you just need to take the XML you got in the response, and plug the  desired values into parameters/parameter/answer/values.  You can literally copy/paste from parameters/parameter/answer/info/lov/values if there's an LOV value that you want to use (which should be the case with all context prompts). I took your example response from above, and added the three parameter values (in bold).  Note that the entire "info" key is not needed in the PUT.  You can remove it or just leave it there, as I did below.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<parameters>
    <parameter optional="false" type="context" dpId="DP0" primary="true">
        <id>0</id>
        <technicalName>0</technicalName>
        <name>Select a context</name>
        <answer constrained="true" type="Text" keyType="Numeric">
            <info cardinality="Single" keepLastValues="true" dynamic="false">
                <lov hierarchical="false" partial="false" refreshable="true" searchable="false">
                    <values>
                        <value id="1">Vehicle Test</value>
                        <value id="2">Vehicle Correct</value>
                    </values>
                </lov>
            </info>
 <values>
<value id="1">Vehicle Test</value>
</values> </answer> </parameter> <parameter optional="false" type="context" dpId="DP1" primary="true"> <id>1</id> <technicalName>0</technicalName> <name>Select a context</name> <answer constrained="true" type="Text" keyType="Numeric"> <info cardinality="Single" keepLastValues="true" dynamic="false"> <lov hierarchical="false" partial="false" refreshable="true" searchable="false"> <values> <value id="1">Vehicle Test</value> <value id="2">Vehicle Correct</value> </values> </lov> </info> <values>
<value id="1">Vehicle Test</value>
</values>
</answer> </parameter> <parameter optional="false" type="context" dpId="DP2" primary="true"> <id>2</id> <technicalName>0</technicalName> <name>Select a context</name> <answer constrained="true" type="Text" keyType="Numeric"> <info cardinality="Single" keepLastValues="true" dynamic="false"> <lov hierarchical="false" partial="false" refreshable="true" searchable="false"> <values> <value id="1">Vehicle Test</value> <value id="2">Vehicle Correct</value> </values> </lov> </info> <values>
<value id="1">Vehicle Test</value>
</values>
</answer> </parameter> </parameters>

 

Can4
Explorer
0 Kudos
Hi Joe, can you send me sample rest api request for this? How can I get parameters with your advice using rest api?
Joe_Peters
Active Contributor
0 Kudos
I updated my answer to include a sample.
Can4
Explorer
0 Kudos
Hi Joe, thank you soo much. Lastly, How do you know about this usage? If you use any documentation or another source, can you send a link?
Joe_Peters
Active Contributor