Jump to content

API Call - com.hornbill.servicemanager/RequestHistoricUpdates::read - queryName


Recommended Posts

All,

 

We are looking to run a query involving requests for historic updates - https://api.hornbill.com/apps/com.hornbill.servicemanager/RequestHistoricUpdates?op=read. Unfortunately our API call does not complete as a "queryName" is required as well as the requestid.

Our other arguments do not use this parameter. Could you provide some context to what the "queryName" is or what should be specified? I imagine it is something quite simple.

 

Many Thanks,

 

Josh M

Link to comment
Share on other sites

Hi @Joshua T M

Thanks for the post, to invoke that API call you will need to supply getRequestHistoricUpdates for the queryName parameter and this should enable it to complete successfully.  This should have been made clear in the parameter description so I'll see about getting that added in now for future reference.

Kind Regards,

Dave.

Link to comment
Share on other sites

Hi @David Hall,

I’ve updated the Hornbill code to test the “getRequestHistoricUpdates” queryName but I’m getting an exception thrown in the xmlmc.Invoke method. 

This is the code and below is the exception message -

 

xmlmc = new XmlmcService(instanceName, serviceEntryPoint, davEntryPoint, apiKey);

 

xmlmc.AddParam("queryName""getRequestHistoricUpdates");

xmlmc.AddParam("requestId", requestID);

 

xmlmc.Invoke("apps/com.hornbill.servicemanager/RequestHistoricUpdates""read");

 

Exception:

Hornbill.RequestFailureException: 'FlowCode Exception (com.hornbill.servicemanager/entities/RequestHistoricUpdates/fc_ops/read): nodeName: Run Query; nodeId: e966dd79-fdb9-42bc-bf63-a1dde3b92b70; At 290/1: "Uncaught EspMethodCall::invoke: Operation[data::queryExec] queryParams validation error: The element <returnPrivate> was expected at location ''"

                throw(e);

_fc_node_exec_e966dd79_fdb9_42bc_bf63_a1dde3b92b70'

 

Do you have any idea what may be the cause of this exception?

Link to comment
Share on other sites

@David Hall

Unfortunately we are still getting the below response with a "count" of 0 and a FlowCodeDebugState -

<?xml version="1.0" encoding="UTF-8"?>

-<methodCallResult status="ok">


-<params>

<queryDataJSON>[]</queryDataJSON>

<count>0</count>

</params>


-<flowCodeDebugState>

<step>56c2f640-60a6-4921-9974-3ecb9a26b1d2</step>

<executionId>4328c7e4-d442-4513-a310-5fb3d3b7cb6d</executionId>

</flowCodeDebugState>

</methodCallResult>

The code as is - 

    xmlmc = new XmlmcService(instanceName, serviceEntryPoint, davEntryPoint, apiKey);

            xmlmc.AddParam("queryName", "getRequestHistoricUpdates");
            xmlmc.AddParam("requestId", requestID);
            xmlmc.AddParam("rowStart", "1");
            xmlmc.AddParam("limit", "99");
            xmlmc.AddParam("resultType", "allData");
            xmlmc.AddParam("returnPrivate", "true");
            xmlmc.AddParam("updateOrder", "DESC");

            xmlmc.Invoke("apps/com.hornbill.servicemanager/RequestHistoricUpdates", "read");

            result = xmlmc.GetResponseXML();

We are actually looking for the attached which is all the updates for a request in this case our test is (IN00001160), please let me know if we are looking in the wrong place.

image.thumb.png.2fe5fbb2538d079558cca96b1fccdde6.png

 

Link to comment
Share on other sites

Hi @Joshua T M

Unfortunately the flowcode we were discussing was related to historic imported updates which are a separate entity, not the request timeline updates as you highlighted in the last post.  

For the timeline we store an activity id against each request and then use that id with the activity -> activityStreamQuery api to return content.

Just to step back a bit, if you can give me an idea of what you are trying to achieve we can see if there is a simpler way to do it?

Regards,

Dave.

Link to comment
Share on other sites

Thanks @David Hall,

We are looking to create a viewing tool for other departments within the business so they have an overview of incidents and requests made per organisation/contact using the request ID (IN0000001).

I believe we have virtually achieved this however due to the poor API documentation we are struggling to identify options to use with parameters. A prime example of this is we are now stuck with what the "orderBy" options are...

 xmlmc = new XmlmcService(instanceName, serviceEntryPoint, davEntryPoint, apiKey);

                xmlmc.AddParam("streamId", hornbillRequest.h_activity_stream_id);
                xmlmc.AddParam("orderBy", "?????");

                xmlmc.Invoke("apps/com.hornbill.servicemanager/Requests", "smGetFullActivityStream");

Can you please provide these options?

Link to comment
Share on other sites

  • 2 weeks later...

Hi @Steve G, @David Hall,

 

We have now started work on the activityStreamQuery API, unfortunately the below is being returned with no other data -

result = <?xml version="1.0" encoding="utf-8"?><methodCallResult status="ok"><params><visibility>public</visibility></params></methodCallResult>

This is our code -

xmlmc = new XmlmcService(instanceName, serviceEntryPoint, davEntryPoint, apiKey);

                xmlmc.AddParam("activityStreamID", hornbillRequest.h_activity_stream_id);

                xmlmc.Invoke("activity", "activityStreamQuery");

                result = xmlmc.GetResponseXML();

This is the Activity Stream ID being provided as hornbillRequest.h_activity_stream_id -

urn:buzz:activityStream:8190e864-13b2-4582-910f-4a6533e0efe9

Other values -

 private readonly string instanceName = "strumissupport";
        private readonly string serviceEntryPoint = "xmlmc";
        private readonly string davEntryPoint = "dav";
        private readonly string apiKey = "Correct API Key...";

 

Any idea why this is not returning anything other than the result above, our test request contains updates visible to both "Customer" and "Team"?

 

Many Thanks,

 

Josh M

Link to comment
Share on other sites

Hi @Joshua T M,

This is possibly down to access rights, as no activity stream access token is being passed to the API call. In your script, if you call the following API to generate an access token, then pass that token into the accessToken parameter of your call to activityStreamQuery you should then see the activities returned.

Cheers,

Steve

Link to comment
Share on other sites

Thanks @Steve G,

That got us up and running, thank you!

We need to make one final API call for the attachment details located inside the requests, unfortunately their are several API entities that have the description to fulfill this.

image.thumb.png.745370397847b6ab479aa1f35fa09d94.png

Do you know which one in particular we should look at first?

Thanks again for all your help.

Josh M

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...