cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How Can I Increase performance of Document Parameter Get And Put Request?

Can4
Explorer
0 Likes
902

Hi, 

I am using sap bo rest api in c# application.

In this app, I am getting document parameters by id using below endpoint;

raylight/v1/documents/{documentId}/parameters

After receiving these parameters, I send a put request to the same endpoint. The payload of the put request includes the parameters from the get request. After making a get, I put again because the values ​​of some parameters are missing after the get request. Due to the size limit, I make a put request after the get to get all the values ​​of the parameters completely.

Sample code is below;

 

                var documentParametersXml = await _sapClient.GetDocumentParametersByIdAsync(documentId);
                var parsedParameters = ParseDocumentParameters(documentParametersXml);
                var updatePayload = CreateParametersPayload(parsedParameters);
                var updateResponseXml = await _sapCustomPortalClient.UpdateDocumentParametersAsync(documentId, updatePayload);
                return ParseDocumentParameters(updateResponseXml);

 

Sample get request response;

<?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>

I am getting this response and create update payload then sending put request to raylight/v1/documents/{documentId}/parameters then I can obtain parameters and its all values.

So, There is no problem for documents that do not contain many parameters and values, but if the document has many parameters, these get and put requests take a very long time. How can I fix the performance issue here?

Accepted Solutions (0)

Answers (1)

Answers (1)

umasaral
Contributor
0 Likes

Hi 

To improve performance, fetch only the necessary parameters by adding filters or criteria
to the GET request, reducing the data size. Use parallel processing to split and handle large datasets simultaneously. Implement incremental updates to PUT only the parameters that have changed instead of sending all data every time. Optimize the API calls by adjusting timeouts, batching requests, or leveraging caching mechanisms. Finally, consult the SAP BO REST API documentation (https://help.sap.com/docs/) for any performance-specific configurations.