web stats
Mirth Connect API operation to get the channels' name and ID - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2017, 04:47 AM
Ayanami Ayanami is offline
Mirth Newb
 
Join Date: Dec 2015
Posts: 14
Ayanami is on a distinguished road
Question 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!
Reply With Quote
  #2  
Old 06-07-2017, 05:43 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 838
siddharth is on a distinguished road
Default

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}
Reply With Quote
  #3  
Old 06-07-2017, 05:47 AM
Ayanami Ayanami is offline
Mirth Newb
 
Join Date: Dec 2015
Posts: 14
Ayanami is on a distinguished road
Default

That's a great idea! Will do that! Thank you so much
Reply With Quote
  #4  
Old 06-13-2017, 07:11 AM
Ayanami Ayanami is offline
Mirth Newb
 
Join Date: Dec 2015
Posts: 14
Ayanami is on a distinguished road
Default

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 at 07:28 AM.
Reply With Quote
Reply

Tags
api, channel id, channel name, operations

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 06:59 AM.


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