web stats
Creating a Group with REST API - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-16-2017, 12:30 PM
spookymodem spookymodem is offline
Mirth Newb
 
Join Date: Aug 2017
Posts: 6
spookymodem is on a distinguished road
Question Creating a Group with REST API

I'm attempting to create a new group by sending a POST request (via curl) to the /channelgroups/_bulkUpdate endpoint, and so far, with no success.

My questions related to this are:

(1) Is /channelgroups/_bulkUpdate the proper endpoint to use for creating a new group?

(2) Assuming I am using the proper endpoint, the documentation states that, in order to create a new group, one must pass a group object when making the call. What is the minimal object that one can pass when creating a new group? For example, is it possible to only pass the group name, as in the following?

<list>
<channelGroup version="3.5.0">
<name>
TestGroup
</name>
<channels>
</channels>
</channelGroup>
</list>


I have attempted to pass the XML above and also attempted to pass some variations of the above, and every time I do, I receive a "415 (Unsupported Media Type)" error.

Thanks!
Reply With Quote
  #2  
Old 08-18-2017, 07:34 AM
spookymodem spookymodem is offline
Mirth Newb
 
Join Date: Aug 2017
Posts: 6
spookymodem is on a distinguished road
Smile Content Type for channelgroups/_bulkUpdate

After doing some searching on the message board, I found that I was using the incorrect content type; the correct one appears to be "multipart/form-data".

Now I'm getting a 400 error (Bad Request). The XML data that I'm trying to pass is:

Code:
<set>
  <channelGroup version="3.5.0">
    <name>
      TestChannel
    </name>
  </channelGroup>
</set>
Does anyone know what I am doing wrong??

Thanks!
Reply With Quote
  #3  
Old 08-18-2017, 09:06 AM
spookymodem spookymodem is offline
Mirth Newb
 
Join Date: Aug 2017
Posts: 6
spookymodem is on a distinguished road
Cool Group Creation

Assuming that I want to use the API to create a group named "Test", does anyone know what would the group object look like that needs to be passed in the POST call?

Thanks!
Reply With Quote
  #4  
Old 09-25-2017, 09:48 AM
bandheli bandheli is offline
Mirth Newb
 
Join Date: Jul 2017
Posts: 9
bandheli is on a distinguished road
Default

Please try with below input:
<list>
<channelGroup version="3.5.0">
<name>
TestChannel
</name>
</channelGroup>
</list>
Reply With Quote
  #5  
Old 09-28-2017, 05:14 AM
gribo gribo is offline
What's HL7?
 
Join Date: May 2017
Posts: 5
gribo is on a distinguished road
Default

That is not easy to deal with bulkUpdate API.

You cannot create a group without channel, otherwise you get a NullPointerException in DefaultChannelController L735 in 3.5.0.
If you put an empty <channels/> tag in bandheli solution, you get another NPE later in DefaultChannelController L828 in version 3.5.0

You have to call the get API, then replace <list></list> root element by <set></set>
and add your group like this, setting the id manually ...

Code:
<set>
  <channelGroup>
    <id>98d47d66-ccd8-43f2-9676-de92960def59</id>
    <name>TestChannel</name>
    <channels/>
  </channelGroup>
</set>
Do not forget to add the properties removedChannelGroupIds with <set/> if empty

Of course you have to use multipart/form-data;boundary=your-boundary as applicationType

After that you should get the answer <boolean>true</boolean>
Reply With Quote
  #6  
Old 03-23-2018, 01:15 PM
frankh frankh is offline
What's HL7?
 
Join Date: Feb 2018
Posts: 5
frankh is on a distinguished road
Default

How do you add channels to a group though?
Reply With Quote
Reply

Tags
api, group, xml

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:24 PM.


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