Migration script for svg templates (release-3.4.0)
Overview
As of release-3.4.0, all svg template creation and consumption is done using asset APIs.
This document talks about the APIs to be used to migrate the existing svg templates.
Steps
Create the svg template with same identifier and name, with below API
curl -L -X POST 'https://staging.ntp.net.in/api/asset/v1/create' \ -H 'X-Channel-Id: in.ekstep' \ -H 'x-authenticated-user-token: {{authToken}}' \ -H 'Authorization: Bearer {{api-key}}' \ -H 'Content-Type: application/json' \ --data-raw '{ "request": { "asset": { "identifier": "SVG_TEMPLATE_ID", "name": "SVG_TEMPLATE_NAME", "code": "SVG_TEMPLATE_NAME", "mimeType": "image/svg+xml", "license": "CC BY 4.0", "primaryCategory": "Certificate Template", "mediaType": "image", "certType": "cert template layout", "data": { "title": "SVG_TEMPLATE_NAME" } } } }'
Upload the svg template using below API.
curl -L -X POST 'https://staging.ntp.net.in/api/asset/v1/upload/SVG_TEMPLATE_ID' \ -H 'x-authenticated-user-token: {{authToken}}' \ -H 'Authorization: Bearer {{api-key}}' \ -F 'file=@/Users/pradyumna/Downloads/template-1.svg' // absolute path to template
To validate the data, we can use either read API as below, or we can do composite-search using
primaryCategory: Certificate Template
Read API: curl -L -X GET 'https://staging.ntp.net.in/api/asset/v1/read/SVG_TEMPLATE_ID' \ -H 'x-authenticated-user-token: {{authToken}}' \ -H 'Authorization: Bearer {{api-key}}'
NOTE: There are no changes to existing course batches containing svg template, as we are using the same templateIds.