Unable to create group hub using API
Hi,
I am trying to create a group hub using this document (https://developer.khoros.com/khoroscommunitydevdocs/docs/create-a-group-hub?_ga=2.117082309.2123355538.1619410972-1050991493.1615871887) I have given all the required fields but getting 500 status after API call.
Post call : [COMMUNITY-DOMAIN]/api/2.0/grouphubs
Requested body :
{
"grouphub":{
"id":"shutterbugs",
"title":"Shutterbugs",
"description" : "test",
"parent":{
"type":"node",
"id":"category:groupHubs",
"href":"/nodes/category:testGroups"
},
"membership_type":"open",
"conversation_styles":[
"forum",
"blog"
],
"parent_category":{
"id":"testGroups"
}
}
}
Response :
<html>
<head>
<title>null</title>
<style>
<!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}
-->
</style>
</head>
<body>
<h1>HTTP Status 500 – </h1>
<HR size="1" noshade="noshade">
<p><b>type</b> Status Report</p>
<p><b>Description</b> <u>http.500</u></p>
</body>
</html>
Any help with this would be greatly appreciated.
Thank you.
I believe the issue is with the "parent" key, which shouldn't be necessary. If you try it without that but still with the "parent_category" key (assuming that category exists) then it should work for you.
For example:
{ "grouphub":{ "id":"shutterbugs", "title":"Shutterbugs", "description" : "test", "membership_type":"open", "conversation_styles":[ "forum", "blog" ], "parent_category":{ "id":"testGroups" } } }
Alternatively, if you are using Python to make the REST API calls then you could utilize the open-source Khoros Python library I'm developing to create your group hubs, as documented here and shown in the example below.
>>> khoros.grouphubs.create( ... 'python-lovers', 'The Python Lovers Group', \ ... 'This is my witty description.', \ ... open_group=True, discussion_styles=['forum', 'blog'], \ ... parent_category_id='testGroups', return_url=True) 'https://stage.example.com/t5/the-python-lovers-group/gh-p/python-lovers'
Hope this helps!