This document will help to understand how to add an activity in a group
Background
We can enable any activity type for a group
We can configure form API for that
Form creation
This form will be used to populate the activity types that can be added for a group. If there is no form created we won’t be able to create any activity.
End Point:
POST: /data/v1/form/create
Request Body
{ "request": { "type": "group", "subType": "supported_activities", "action": "list", "data": { "templateName": "supported_activities", "action": "list", "fields": [ { "index": 0, "activityType": "Explanation Content", "objectType": "Content", "isEnabled": true, "sortBy": [ { "name": "asc" } ], "searchQuery": "{\"request\":{\"filters\":{\"primaryCategory\":[\"Explanation Content\"],\"status\":[\"Live\"],\"objectType\":[\"Content\"]},\"fields\":[\"name\",\"appIcon\",\"contentType\",\"identifier\",\"objectType\",\"createdBy\"]}}", "title": "Explanation Content", "translations": "{\"en\":\"Explanation Content\"}" }, { "index": 1, "activityType": "Learning Resource", "objectType": "Content", "isEnabled": true, "sortBy": [ { "name": "asc" } ], "searchQuery": "{\"request\":{\"filters\":{\"primaryCategory\":[\"Learning Resource\"],\"status\":[\"Live\"],\"objectType\":[\"Content\"]},\"fields\":[\"name\",\"appIcon\",\"contentType\",\"identifier\",\"objectType\",\"createdBy\"]}}", "title": "Learning Resource", "translations": "{\"en\":\"Learning Resource\"}" }, { "index": 2, "activityType": "Course", "objectType": "Content", "isEnabled": true, "sortBy": [ { "name": "asc" } ], "searchQuery": "{\"request\":{\"filters\":{\"primaryCategory\":[\"Course\"],\"batches.status\":1,\"batches.enrollmentType\":\"open\",\"objectType\":[\"Content\"],\"status\":[\"Live\"]},\"fields\":[\"name\",\"appIcon\",\"contentType\",\"identifier\",\"objectType\",\"createdBy\"]}}", "title": "Course", "translations": "{\"en\": \"Course\", \"as\": \"পাঠ্যক্ৰমসমুহ\", \"bn\": \"পাঠ্যধারাগুলি\", \"gu\":\"કોર્સ\", \"hi\":\"कोर्स\", \"kn\":\"ಕೋರ್ಸ್ ಗಳು\", \"mr\":\"कोर्सेस\", \"or\":\"ପାଠ୍ୟକ୍ରମଗୁଡ଼ିକ\", \"pa\":\"ਕੋਰਸਿਸ\", \"ta\":\"பாடநெறிகள்\", \"te\":\"కోర్సులు\", \"ur\":\"کورسز\"}" }, { "index": 3, "activityType": "Practice Question Set", "objectType": "Content", "isEnabled": true, "sortBy": [ { "name": "asc" } ], "searchQuery": "{\"request\":{\"filters\":{\"primaryCategory\":[\"Practice Question Set\"],\"status\":[\"Live\"],\"objectType\":[\"Content\"]},\"fields\":[\"name\",\"appIcon\",\"contentType\",\"identifier\",\"objectType\",\"createdBy\"]}}", "title": "Practice Question Set", "translations": "{\"en\":\"Practice Question Set\"}" } ] } } }
Refer the below table to find more about the fields
Field | type | description |
---|---|---|
index | number | For sorting in frontend |
activityType | string | Activity type which needs to be added to group |
objectType | string | Type of the object |
isEnabled | boolean | Indicates whether the activityType is to be displayed |
searchQuery | stringified object | query needs to be called with search API when a activity is selected |
title | string | Activity types title which is used to display in front end |
translations | stringified object | provide the translations to handle localisation |
Steps for adding activity for group
Open a group and click on add activity button
2. Select any activity type u want to add
3. Select any activity you want to add and click on Add to group