Announcement

Collapse
No announcement yet.

Mirth API _clearStatistics Payload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    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.

    Comment


    • #3
      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?

      Comment

      Working...
      X