web stats
Mirth API _clearStatistics Payload - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-26-2019, 10:55 AM
tstratton tstratton is offline
What's HL7?
 
Join Date: Feb 2019
Posts: 2
tstratton is on a distinguished road
Default Mirth API _clearStatistics Payload

Can someone provide the payload necessary to complete the /api/channels/_clearStatistics POST request via the API UI? I have yet to construct a single request body what results in an HTTP 2xx response.

My best shot at it involves the following:

curl -X POST --header 'Content-Type: application/xml' --header 'Accept: text/html' -d '{5f5c5814-f113-41f0-b3d8-2c1cc988384f: []}' 'https://localhost:8443/api/channels/_clearStatistics'

This yields an HTTP 500.
Reply With Quote
  #2  
Old 04-26-2019, 05:34 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 964
agermano is on a distinguished road
Default

It's not easy. All of the POST functions want XML in the body instead of json. The description isn't very accurate either. You also need to specify which statuses you want to reset as parameters. They are all false by default. Like this
Code:
https://localhost:8443/api/channels/_clearStatistics?received=true&sent=true
This is what the client would submit for the body if you have one destination with metadata id 1. metadata id 0 is always the source connector. If you have multiple destinations you would have to list them all. The id is from the table in the destinations tab, and might not be sequential. The client knows which destinations every channel has since it keeps all of the channel definitions in memory.

Code:
<map>
  <entry>
    <string>5f5c5814-f113-41f0-b3d8-2c1cc988384f</string>
     <list>
      <null/>
      <int>0</int>
      <int>1</int>
    </list>
  </entry>
</map>
You might be able to get away with just doing this:

Code:
<map>
  <entry>
    <string>5f5c5814-f113-41f0-b3d8-2c1cc988384f</string>
     <list>
      <null/>
    </list>
  </entry>
</map>
Which will clear the global stats for the channel, but if you click the + to expand the channel on the dashboard, you'll see that the individual connectors didn't reset.
Reply With Quote
  #3  
Old 04-30-2019, 09:49 AM
tstratton tstratton is offline
What's HL7?
 
Join Date: Feb 2019
Posts: 2
tstratton is on a distinguished road
Smile

That worked like a charm! Thank you. I will continue to fiddle around with the metadata configurations and see how their configuration might best fit the work we have to do! Thank you again.

Is there an upvote operation here?
Reply With Quote
Reply

Tags
api, clearstatistics, mirthapi, payload

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:38 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation