Announcement

Collapse
No announcement yet.

Mirth Connect API operation to get the channels' name and ID

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

  • Mirth Connect API operation to get the channels' name and ID

    Hi,

    I need to retrieve all channels' names and IDs in a Mirth instance. The only operation in the Mirth Connect API that returns both a channel name and ID is "GET /channels", but since I have 185 channels, the returned XML is too large just to get a small piece of the information, since it also returns all the scripts associated to each channel, and it is too costly to parse such a file just to get names and IDs.

    Is there any other operation I can use that returns both the channels' name and respective ID?

    I tried to use "GET /channelgroups" but it only returns the channels' ID on each group. This operation would be perfect if it also returned the channels names. Is there any possibility for such improvement? Or is there any other operation in the API I can use that returns the channels' names and IDs?

    (the User API, http://javadocs.mirthcorp.com/connect/3.4.2/user-api/, has 2 distinct functions getChannelIds() and getChannelNames() I could use, but it is a risk to make a correspondence between them since they may not come in the same order)


    Thank you very much for your time!

  • #2
    I think it should be manageable in your client.
    You get Channels by Group, it will give you array (possibly) of channel IDs inside that group, run those ids against

    GET /channels/{channelId}/metaDataColumns for individual channel names.

    Or, alternatively To get the channel name you need the channel ID so you can consume
    GET /channels/{channelId}
    HL7v2.7 Certified Control Specialist!

    Comment


    • #3
      That's a great idea! Will do that! Thank you so much

      Comment


      • #4
        Hi,

        I tried to use GET /channels/337e1f4e-7054-42fd-a823-4e2822d114a7/metaDataColumns to get the corresponding channel name, but the message body does not contain any element corresponding to the channel name. Shouldn't it have an element with that information? It only returns the name of the metadata columns, not the values. Here is the response returned from the API:

        Code:
        <list>
            <metaDataColumn>
                <name>STATUSCODE</name>
                <type>STRING</type>
                <mappingName>STATUSCODE</mappingName>
            </metaDataColumn>
            <metaDataColumn>
                <name>MESSAGECONTROLID</name>
                <type>STRING</type>
                <mappingName>messageControlId</mappingName>
            </metaDataColumn>
            <metaDataColumn>
                <name>MESSAGEHEADEREVENTCODE</name>
                <type>STRING</type>
                <mappingName>MessageHeaderEventCode</mappingName>
            </metaDataColumn>
            <metaDataColumn>
                <name>MESSAGEHEADERRECEIVER</name>
                <type>STRING</type>
                <mappingName>MessageHeaderReceiver</mappingName>
            </metaDataColumn>
            <metaDataColumn>
                <name>INOCULATIONFACILITY</name>
                <type>STRING</type>
                <mappingName>InoculationFacility</mappingName>
            </metaDataColumn>
            <metaDataColumn>
                <name>PATIENTREGISTRATIONFACILITY</name>
                <type>STRING</type>
                <mappingName>PatientRegistrationFacility</mappingName>
            </metaDataColumn>
            <metaDataColumn>
                <name>BUNDLEID</name>
                <type>STRING</type>
                <mappingName>BundleId</mappingName>
            </metaDataColumn>
        </list>

        To use the other operation (GET /channels/{channelId}) is too costly and it returns too much uneeded information.
        Last edited by Ayanami; 06-13-2017, 06:28 AM.

        Comment

        Working...
        X