How to configure forms for framework metadata for Project creation and asset update
PROJECT Creation form
PRD: https://project-sunbird.atlassian.net/wiki/spaces/SingleSource/pages/2830565388/Population+of+metadata+for+an+asset+-+a+generalized+approach#Configuration
As part of SB-26390, Content metadata is the combination of both Primary object category definition and the framework meta data.
To show the relevant channel level / system level framework fields available, a form needs to be created with framework fields such as board, medium, grade, subject, topic and Learning outcome. User can define the required fields that needs to shown on the K-12 / TPD form during the project creation.
A form can be created for both channel level and system level. To create a channel level framework form (TPD/K-12) channel value has to be passed in the payload.
Curl Command to create form uration:
curl --location --request POST '{{host}}/content/program/v1/form/create' \
--header 'Authorization: Bearer {{api_key}}' \
--header 'Cookie: {{cookie_connect_id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"request": {
"context": "framework",
"context_type": "k-12",
}
}'
Project Creation Form- System Level uration
For K-12 Framework Fields
Board(org framework)
Medium (org framework)
Class (org framework)
Subject (org framework)
For TPD Framework Fields
Medium (org framework)
Class (org framework)
Subject (org framework)
K-12 Framework CURL to System level create form
curl --location --request POST '{{host}}/api/program/v1/form/create' \
--header 'Authorization: Bearer {{api_key}}' \
--header 'Cookie: {{cookie_connect_id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"request": {
"context": "framework",
"context_type": "K-12",
"data": {
"properties": [
{
"code": "board",
"name": "Board/Syllabus",
"label": "Board",
"default": "",
"visible": true,
"dataType": "list",
"editable": true,
"required": true,
"inputType": "select",
"description": "Board",
"placeholder": "Select Board/Syllabus",
"renderingHints": {
"class": "sb-g-col-lg-1"
}
},
{
"code": "medium",
"name": "Medium",
"label": "Medium",
"default": "",
"visible": true,
"dataType": "list",
"editable": true,
"required": true,
"inputType": "nestedselect",
"description": "",
"placeholder": "Select Medium",
"renderingHints": {
"class": "sb-g-col-lg-1"
}
},
{
"code": "gradeLevel",
"name": "Class",
"label": "Class",
"default": "",
"visible": true,
"dataType": "list",
"editable": true,
"required": true,
"inputType": "nestedselect",
"description": "Class",
"placeholder": "Select Class",
"renderingHints": {
"class": "sb-g-col-lg-1"
}
},
{
"code": "subject",
"name": "Subject",
"label": "Subject",
"default": "",
"visible": true,
"dataType": "list",
"editable": true,
"required": true,
"inputType": "nestedselect",
"description": "",
"placeholder": "Select Subject",
"renderingHints": {
"class": "sb-g-col-lg-1"
}
}
]
}
}
}'
TPD Framework CURL to to System level create form
curl --location --request POST '{{host}}/api/program/v1/form/create' \
--header 'Authorization: Bearer {{api_key}}' \
--header 'Cookie: {{cookie_connect_id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"request": {
"context": "framework",
"context_type": "tpd",
"data": {
"properties": [
{
"code": "medium",
"name": "Medium",
"label": "Medium",
"default": "",
"visible": true,
"dataType": "list",
"editable": true,
"required": true,
"inputType": "nestedselect",
"description": "",
"placeholder": "Select Medium",
"renderingHints": {
"class": "sb-g-col-lg-1"
}
},
{
"code": "gradeLevel",
"name": "Class",
"label": "Class",
"default": "",
"visible": true,
"dataType": "list",
"editable": true,
"required": true,
"inputType": "nestedselect",
"description": "Class",
"placeholder": "Select Class",
"renderingHints": {
"class": "sb-g-col-lg-1"
}
},
{
"code": "subject",
"name": "Subject",
"label": "Subject",
"default": "",
"visible": true,
"dataType": "list",
"editable": true,
"required": true,
"inputType": "nestedselect",
"description": "",
"placeholder": "Select Subject",
"renderingHints": {
"class": "sb-g-col-lg-1"
}
}
]
}
}
}'
This will create the fields to be shown while creating the project. Fields or field properties can be overridden, by passing the
channel: *
to the request
Project Creation Form- Channel Level
Project creation form either k-12/tpd can be updated for a channel level by passing the channel value in the Project creation form.
K-12 Framework CURL to create form at channel Level
TPD Framework CURL to create form at channel Level
Asset framework metadata form- System Level
For K-12 Framework Fields
Board(org framework)
Medium (org framework)
Class (org framework)
Subject (org framework)
For TPD Framework Fields
Medium (org framework)
Class (org framework)
Subject (org framework)
K-12 Framework CURL to create form System Level:
Here context_type has to be defined with the required framework that is k-12/tpd which are currently in the system. Operation should be create. Once the form is created , it can be udpated/ read through form API’s.
Required framework fields such has board, medium, grade, subject, topic and learning outcome can be defined in the form. Sample curl is given below. This form can be at system level and it can be for channel level by passing the channel ID while creation of the Form.
Tpd Framework CURL to create form System Level
For all channels → K-12 framework type → show Board, Medium, GradeLevel, Subject and Topic (Some tenants can update form to have LO)
For all channels → TPD framework type → show Medium, GradeLevel, Subject
A asset metadata will be combination of the both framework and primary object category definition’s child and update metadata form.
Asset framework metadata form- Channel Level
K-12 Form Asset Create form API curl
TPD Form Asset Create form API curl channel Level