Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Dong Wang
    The filter in RunAnalyticsReport api doesn't work as...
    Topic posted March 6, 2019 by Dong WangRed Ribbon: 250+ Points, tagged SOAP 
    59 Views, 1 Comment
    Title:
    The filter in RunAnalyticsReport api doesn't work as expected
    Summary:
    I'm using soap ui to execute the operation RunAnalyticsReport, and it doesn't work as expected.
    Content:

    Dear All,

    I'm retrieving data from report via API RunAnalyticsReport. I copied the standard report "Answers - Complex Expression Search Default" (whose report id 176) and changed nothing. I use the new report id to run the method RunAnalyticsReport. The request xml is as below,

    <?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Header>
            <ns7:ClientInfoHeader xmlns:ns7="urn:messages.ws.rightnow.com/v1_2" soapenv:mustUnderstand="0">
                <ns7:AppID>Run report sample</ns7:AppID>
            </ns7:ClientInfoHeader>
                <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" mustUnderstand="1">
                    <wsse:UsernameToken><wsse:Username>***</wsse:Username>
                        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">***</wsse:Password>
                    </wsse:UsernameToken>
                </wsse:Security>
        </soapenv:Header>
    <soapenv:Body>
        <ns7:RunAnalyticsReport xmlns:ns7="urn:messages.ws.rightnow.com/v1_2">
            <ns7:AnalyticsReport xmlns:ns4="urn:objects.ws.rightnow.com/v1_2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:AnalyticsReport">
                <ID xmlns="urn:base.ws.rightnow.com/v1_2" id="100194" />
                <ns4:Filters xsi:type="ns4:AnalyticsReportFilter">
                    <ns4:Name>map_cat_hierarchy</ns4:Name>
                    <ns4:Operator>
    <ID xmlns="urn:base.ws.rightnow.com/v1_2" id="10" />
    </ns4:Operator >
    <ns4:Values>137</ns4:Values>
                </ns4:Filters>
            </ns7:AnalyticsReport><ns7:Limit>10</ns7:Limit><ns7:Start>0</ns7:Start>
        </ns7:RunAnalyticsReport>
    </soapenv:Body>
    </soapenv:Envelope>

    I got the operator from GetValuesForNamedID, and the 'IN LIST' operation id is 10. 137 is the category's id, who are associated with more than 1 answers in system.

    But I didn't get any result, see as below,

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header/>
       <soapenv:Body>
          <n0:RunAnalyticsReportResponse xmlns:n0="urn:messages.ws.rightnow.com/v1_2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
             <n0:CSVTableSet>
                <n0:CSVTables>
                   <n0:CSVTable>
                      <n0:Name>xx_Answer-Complex Expression</n0:Name>
                      <n0:Columns>Summary,New or Updated,Description,Date Updated,Summary,Answer ID,Weight,Computed Score</n0:Columns>
                      <n0:Rows/>
                   </n0:CSVTable>
                </n0:CSVTables>
             </n0:CSVTableSet>
          </n0:RunAnalyticsReportResponse>
       </soapenv:Body>
    </soapenv:Envelope>

    But when I changed the operator to some other negative operation, such as <>, not like, not in list, there will be records.

    Please help check the issue.

     

    Thanks a lot in advance.

    Comment

     

    • Robert Surujbhan

      Dong, in the Service Category hierarchy, which level is category ID 137 on?  Is it a node on Level 1, 2, 3, 4, 5, or 6 of the tree?

      Let's say category ID 137 is located on level 2 (so it has one parent).  For your <Values> element in the soap/xml, you will need to send 2.137 instead of just 137.

      <ns4:Values>2.137</ns4:Values>
      

      If it is at the top as a level 1 category node, then you would use:

      <ns4:Values>1.137</ns4:Values>
      

      This is the expected format and it should work fine using the IN LIST operator (ID 10) just as you were doing.  Give it a try?