Joshua T M Posted December 7, 2018 Posted December 7, 2018 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
David Hall Posted December 10, 2018 Posted December 10, 2018 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.
Joshua T M Posted December 12, 2018 Author Posted December 12, 2018 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?
Joshua T M Posted December 17, 2018 Author Posted December 17, 2018 Hi All, Any further help with this? I appreciate it is the holiday season.
Joshua T M Posted December 17, 2018 Author Posted December 17, 2018 If returnPrivate is not optional then what is the operator for it? Should the argument be y/n 1/0 up/down... returnPrivate xs:string optional Choose whether to return private update entries
David Hall Posted December 18, 2018 Posted December 18, 2018 Hi @Joshua T M Apologies, I missed the notifications Not entirely sure why, but this is essentially a boolean implemented as string, so you need to pass "true" or "false". Will again update that description accordingly. Kind Regards, Dave
Joshua T M Posted December 18, 2018 Author Posted December 18, 2018 Hi Dave, No problem, thank you for coming back to us! I'll have a go now and see what's returned. Josh
Joshua T M Posted December 18, 2018 Author Posted December 18, 2018 Hi @David Hall, Can you please let me know the arguments for all the parameters. It also seems like restType is required not optional and we have no idea what to pass here either!
David Hall Posted December 18, 2018 Posted December 18, 2018 @Joshua T M Yeah sorry about that, I've just updated the flowcode to include the relevant options going forward: * resultType - 'count' or 'allData' * returnPrivate - 'true' or 'false' * updateOrder - 'ASC' or 'DESC' If there are any others that are unclear just let me know Cheers, Dave
Joshua T M Posted December 18, 2018 Author Posted December 18, 2018 @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.
David Hall Posted December 18, 2018 Posted December 18, 2018 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.
Joshua T M Posted December 19, 2018 Author Posted December 19, 2018 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?
Steve G Posted December 19, 2018 Posted December 19, 2018 Hi @Joshua T M, The orderBy input parameter of smGetFullActivityStream is of the type activityStreamSortType, so its value can be either mostRecentlyPosted or mostRecentlyCommented. Cheers, Steve 1
Joshua T M Posted January 2, 2019 Author Posted January 2, 2019 Hi @Steve G, This is extremely helpful thank you. Unfortunately we could not find a link to the types directory on the root API page which would have been a tremendous help initially. Thanks again, Josh M 1
Joshua T M Posted January 3, 2019 Author Posted January 3, 2019 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
Joshua T M Posted January 8, 2019 Author Posted January 8, 2019 Hi, @Steve G, @David Hall, Do you have any thoughts on the above?
Steve G Posted January 11, 2019 Posted January 11, 2019 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
Joshua T M Posted January 14, 2019 Author Posted January 14, 2019 @Steve G, Thanks Steve, unfortunately I seem to be missing the "following API". Josh M
Steve G Posted January 14, 2019 Posted January 14, 2019 Hi @Joshua T M, Apologies, it would have helped if I'd have pasted the link https://api.hornbill.com/apps/com.hornbill.servicemanager/Requests?op=getActivityStreamAccessToken Cheers, Steve
Joshua T M Posted January 15, 2019 Author Posted January 15, 2019 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. Do you know which one in particular we should look at first? Thanks again for all your help. Josh M
Steve G Posted January 15, 2019 Posted January 15, 2019 No worries @Joshua T M, glad to hear that's up and running! This is the API you need to retrieve attachment details: https://api.hornbill.com/apps/com.hornbill.servicemanager/Requests?op=smGetAttachments Cheers, Steve
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now