Announcement

Collapse
No announcement yet.

Creating a Group with REST API

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

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

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

    Comment


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

      Comment


      • #4
        Please try with below input:
        <list>
        <channelGroup version="3.5.0">
        <name>
        TestChannel
        </name>
        </channelGroup>
        </list>

        Comment


        • #5
          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>

          Comment


          • #6
            How do you add channels to a group though?

            Comment

            Working...
            X