Quantcast
Channel: Kaltura - Latest posts
Viewing all articles
Browse latest Browse all 7410

Adding a MediaSapce channel to a category via API

$
0
0

Hey James,

Below are the needed API calls in raw form [you can then use whatever language you are most comfortable with an use the relevant client lib to do the same using code].

Channels are implemented as categories, the first call creates a category, passing 701 as parentId.
In your case, the ID will be different, of course. Here is what category ID 701 looks like on my ENV:

*************************** 1. row ***************************
                         id: 701
                  parent_id: 699
                      depth: 2
                 partner_id: 102
                       name: channels
                  full_name: MediaSpace>site>channels
...

You can find the right ID for your case with category->list().
Optionally, you can pass a channel description to the call if you wish, my partner ID is 102, I am not including the KS but the gist of the call looks like this:

api_v3/index.php?service=category&action=add&format=2&ignoreNull=1&category:objectType=KalturaCategory&category:parentId=701&category:name=mbp&category:description=&category:tags=&partnerId=102

Next up is setting the custom metadata for whether or not to allow comments.
metadataProfileId=31 is the ChannelComments custom metadata profile on my ENV. This is created by KMS during deployment. You can find yours with a call to service=metadata_metadataprofile&action=list, passing the name "ChannelComments" as filter, or you can go to $MEDIASPACE_URL/admin/config/tab/comments#channelCommentsProfileId and find it there.
the add() action accepts an XML, similar to the below.

api_v3/index.php?service=metadata_metadata&action=add&format=2&ignoreNull=1&metadataProfileId=31&objectType=2&objectId=884&xmlData=<metadata><AllowCommentsInChannel>true</AllowCommentsInChannel></metadata>&partnerId=102

You also need a call to add metadata to the categoryAdditionalInfo ProfileId, which in my case, is 24:

*************************** 1. row ***************************
               id: 24
       created_at: 2015-12-21 16:52:59
       updated_at: 2015-12-21 16:52:59
          version: 2
file_sync_version: 2
    views_version: 2
       partner_id: 102
             name: CategoryAdditionalInfo
      system_name: CategoryAdditionalInfo`

The call looks like this:
api_v3/index.php?service=metadata_metadata&action=add&format=2&ignoreNull=1&metadataProfileId=24&objectType=2&objectId=884&xmlData=<?xml version="1.0"?>
<metadata><Detail><Key>commentsPrivate</Key><Value/></Detail></metadata>

Then, we also need to determine the moderation type, in my case, I chose 0, which means no moderation. You can update it and set it to 1 instead, like so:

api_v3/index.php?service=category&action=update&format=2&ignoreNull=1&id=884&category:objectType=KalturaCategory&category:id=884&category:moderation=0&partnerId=102

category ID is 884, which is the newly created category from category->add() API call:

            id: 884
                  parent_id: 701
                      depth: 3
                 partner_id: 102
                       name: mbp
                  full_name: MediaSpace>site>channels>mbp

Hope this helps,


Viewing all articles
Browse latest Browse all 7410

Trending Articles