diff --git a/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionActor.scala b/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionActor.scala index 89d32184a..5e1eb12ca 100644 --- a/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionActor.scala +++ b/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionActor.scala @@ -58,8 +58,11 @@ class QuestionActor @Inject()(implicit oec: OntologyEngineContext) extends BaseA } def publish(request: Request): Future[Response] = { + val lastPublishedBy: String = request.getRequest.getOrDefault("lastPublishedBy", "").asInstanceOf[String] request.getRequest.put("identifier", request.getContext.get("identifier")) AssessmentManager.getValidatedNodeForPublish(request, "ERR_QUESTION_PUBLISH").map(node => { + if(StringUtils.isNotBlank(lastPublishedBy)) + node.getMetadata.put("lastPublishedBy", lastPublishedBy) AssessmentManager.pushInstructionEvent(node.getIdentifier, node) ResponseHandler.OK.putAll(Map[String, AnyRef]("identifier" -> node.getIdentifier.replace(".img", ""), "message" -> "Question is successfully sent for Publish").asJava) }) diff --git a/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionSetActor.scala b/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionSetActor.scala index b4a68317c..797b684d9 100644 --- a/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionSetActor.scala +++ b/assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionSetActor.scala @@ -1,8 +1,10 @@ package org.sunbird.actors import java.util + import javax.inject.Inject import org.apache.commons.collections4.CollectionUtils +import org.apache.commons.lang3.StringUtils import org.sunbird.`object`.importer.{ImportConfig, ImportManager} import org.sunbird.actor.core.BaseActor import org.sunbird.cache.impl.RedisCache @@ -65,13 +67,16 @@ class QuestionSetActor @Inject()(implicit oec: OntologyEngineContext) extends Ba } def publish(request: Request): Future[Response] = { + val lastPublishedBy: String = request.getRequest.getOrDefault("lastPublishedBy", "").asInstanceOf[String] request.getRequest.put("identifier", request.getContext.get("identifier")) request.put("mode", "edit") AssessmentManager.getValidatedNodeForPublish(request, "ERR_QUESTION_SET_PUBLISH").flatMap(node => { AssessmentManager.getQuestionSetHierarchy(request, node).map(hierarchyString => { AssessmentManager.validateQuestionSetHierarchy(hierarchyString.asInstanceOf[String], node.getMetadata.getOrDefault("createdBy", "").asInstanceOf[String]) + if(StringUtils.isNotBlank(lastPublishedBy)) + node.getMetadata.put("lastPublishedBy", lastPublishedBy) AssessmentManager.pushInstructionEvent(node.getIdentifier, node) - ResponseHandler.OK.putAll(Map[String, AnyRef]("identifier" -> node.getIdentifier.replace(".img", ""), "message" -> "Question is successfully sent for Publish").asJava) + ResponseHandler.OK.putAll(Map[String, AnyRef]("identifier" -> node.getIdentifier.replace(".img", ""), "message" -> "QuestionSet is successfully sent for Publish").asJava) }) }) } diff --git a/assessment-api/assessment-actors/src/main/scala/org/sunbird/managers/CopyManager.scala b/assessment-api/assessment-actors/src/main/scala/org/sunbird/managers/CopyManager.scala index dc73939e9..22aefc8f0 100644 --- a/assessment-api/assessment-actors/src/main/scala/org/sunbird/managers/CopyManager.scala +++ b/assessment-api/assessment-actors/src/main/scala/org/sunbird/managers/CopyManager.scala @@ -1,8 +1,7 @@ package org.sunbird.managers -import org.apache.commons.collections.CollectionUtils +import org.apache.commons.collections4.CollectionUtils import org.apache.commons.collections4.MapUtils -import org.apache.commons.lang.StringUtils import org.sunbird.common.{JsonUtils, Platform} import org.sunbird.common.dto.{Request, Response, ResponseHandler} import org.sunbird.common.exception.{ClientException, ServerException} @@ -14,11 +13,13 @@ import org.sunbird.graph.schema.DefinitionNode import org.sunbird.graph.utils.{NodeUtil, ScalaJsonUtils} import org.sunbird.telemetry.logger.TelemetryManager import org.sunbird.utils.{AssessmentConstants, BranchingUtil, HierarchyConstants} - import java.util -import java.util.concurrent.{CompletionException} +import java.util.concurrent.CompletionException import java.util.{Optional, UUID} -import scala.collection.JavaConversions.{mapAsScalaMap} + +import org.apache.commons.lang3.StringUtils + +import scala.collection.JavaConversions.mapAsScalaMap import scala.collection.JavaConverters._ import scala.concurrent.{ExecutionContext, Future} diff --git a/assessment-api/assessment-actors/src/main/scala/org/sunbird/utils/BranchingUtil.scala b/assessment-api/assessment-actors/src/main/scala/org/sunbird/utils/BranchingUtil.scala index fa9098816..791079d42 100644 --- a/assessment-api/assessment-actors/src/main/scala/org/sunbird/utils/BranchingUtil.scala +++ b/assessment-api/assessment-actors/src/main/scala/org/sunbird/utils/BranchingUtil.scala @@ -1,6 +1,6 @@ package org.sunbird.utils -import org.apache.commons.lang.StringUtils +import org.apache.commons.lang3.StringUtils import org.sunbird.common.dto.Request import java.util diff --git a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/CopySpec.scala b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/CopySpec.scala index 772a23d23..b5cbd725e 100644 --- a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/CopySpec.scala +++ b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/CopySpec.scala @@ -1,6 +1,6 @@ package org.sunbird.actors -import org.mortbay.util.StringUtil +import org.apache.commons.lang3.StringUtils import org.sunbird.common.dto.{Request, Response, ResponseParams} import org.sunbird.graph.dac.model.Node import org.sunbird.utils.AssessmentConstants @@ -105,7 +105,7 @@ object CopySpec { { put("code", "xyz") put("mimeType", { - if (StringUtil.endsWithIgnoreCase(objectType, AssessmentConstants.QUESTIONSET_SCHEMA_NAME)) { + if (StringUtils.endsWithIgnoreCase(objectType, AssessmentConstants.QUESTIONSET_SCHEMA_NAME)) { AssessmentConstants.QUESTIONSET_MIME_TYPE } else { AssessmentConstants.QUESTION_MIME_TYPE diff --git a/content-api/api-tests/Collections/Content V2 API Test.postman_collection.json b/content-api/api-tests/Collections/Content V2 API Test.postman_collection.json new file mode 100644 index 000000000..81e9d54fb --- /dev/null +++ b/content-api/api-tests/Collections/Content V2 API Test.postman_collection.json @@ -0,0 +1,13433 @@ +{ + "info": { + "_postman_id": "ec007894-70ee-4951-8e96-98f79de5908a", + "name": "Content V2 API Test", + "description": "The Content Management APIs allow you to create, manage and process content on the Sunbird platform. Content is the basic building block of the Knowledge Service. Some examples would be Videos, Audio, Pdfs, Html, ECML etc. The basic operations for this API include Create, Update, Read, Review, Publish.\n\nThe URL for Content Management API(s) is /content/v1.", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "Content Create ", + "item": [ + { + "name": "200 - With minimal required attribute", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.create\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.create\");", + "});", + "pm.test(\"ver should be 4.0\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "// Set global variable", + "pm.globals.set(\"content_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "200 - With identifier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"id should be api.content.create\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.create\");", + "});", + "pm.test(\"ver should be 4.0\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "// Result", + "pm.test(`identifier should be equal to ${JSON.parse(request.data).request.content.identifier}`, () => {", + " pm.expect(jsonResponse.result.identifier).to.eql(`${JSON.parse(request.data).request.content.identifier}`);", + "});", + "pm.test(`node_id should be equal to ${JSON.parse(request.data).request.content.identifier}`, () => {", + " pm.expect(jsonResponse.result.node_id).to.eql(`${JSON.parse(request.data).request.content.identifier}`);", + "});", + "", + "// Set global variable", + "pm.globals.set(\"content_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"identifier\": \"some_identifier\",\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "200 - With external fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.create\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.create\");", + "});", + "pm.test(\"ver should be 4.0\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "// Set global variable", + "pm.globals.set(\"content_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\",\n \"body\": \"{\\\"key\\\":\\\"value\\\"}\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "200 - Special character in name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.create\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.create\");", + "});", + "pm.test(\"ver should be 4.0\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "// Set global variable", + "pm.globals.set(\"content_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"~`S!@#$%^&*()_+=:;\\\"'<,>.?/\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + } + ] + }, + { + "name": "Content Read", + "item": [ + { + "name": "200 - Get all data except external data", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('content');", + " pm.expect(jsonResponse.result.content).to.be.an(\"object\")", + " pm.expect(jsonResponse.result.content).to.have.any.keys('identifier', 'versionKey', 'code', 'channel', 'mimeType', 'createdOn', 'primaryCategory', 'contentDisposition', 'contentEncoding', 'objectType', 'visibility', 'discussionForum', 'license', 'version', 'compatibilityLevel', 'name', 'status');", + " pm.expect(jsonResponse.result.content.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.content.versionKey).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.content.version).to.be.a(\"number\");", + " pm.expect(jsonResponse.result.content.channel).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.content.compatibilityLevel).to.be.a(\"number\");", + " pm.expect(jsonResponse.result.content.ownershipType).to.be.an(\"array\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.read\", () => {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.read\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "pm.test(`identifier should be equal to ${pm.globals.get(\"content_id\")}`, () => {", + " pm.expect(jsonResponse.result.content.identifier).to.eql(pm.globals.get(\"content_id\"));", + "});", + "pm.test(\"objectType should be Content\", () => {", + " pm.expect(jsonResponse.result.content.objectType).to.eql(\"Content\");", + "});", + "pm.test(\"visibility should be Default\", () => {", + " pm.expect(jsonResponse.result.content.visibility).to.eql(\"Default\");", + "});", + "pm.test(\"compatibilityLevel should be 1\", () => {", + " pm.expect(jsonResponse.result.content.compatibilityLevel).to.eql(1);", + "});", + "pm.test(\"status should be Draft\", () => {", + " pm.expect(jsonResponse.result.content.status).to.eql(\"Draft\");", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "// pm.globals.set('content_id', '');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/api/content/v2/read/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "read", + "{{content_id}}" + ] + }, + "description": "Fetch a particular Batch\nThis API is associated with fetching a particular batch on the Sunbird Platform.\nThe endpoint for Fetch a particular Batch is /batch/read/{Batch_ID}\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "200 - Get specific attributes by sending fields query params", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('content');", + " pm.expect(jsonResponse.result.content).to.be.an(\"object\")", + " pm.expect(jsonResponse.result.content).to.have.all.keys('identifier', 'primaryCategory', 'name', 'languageCode');", + " pm.expect(jsonResponse.result.content.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.content.versionKey).to.be.undefined;", + " pm.expect(jsonResponse.result.content.version).to.be.undefined;", + " pm.expect(jsonResponse.result.content.channel).to.be.undefined;", + " pm.expect(jsonResponse.result.content.compatibilityLevel).to.be.undefined;", + " pm.expect(jsonResponse.result.content.languageCode).to.be.an(\"array\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.read\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.read\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "pm.test(`identifier should be equal to ${pm.globals.get(\"content_id\")}`, () => {", + " pm.expect(jsonResponse.result.content.identifier).to.eql(pm.globals.get(\"content_id\"));", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "// pm.globals.set('content_id', '');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/api/content/v2/read/{{content_id}}?fields=name,primaryCategory,body", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "read", + "{{content_id}}" + ], + "query": [ + { + "key": "fields", + "value": "name,primaryCategory,body", + "description": "Fields param is used to get the external data in response, by default read API doesn't return external data. Also fields can be used to get the specific data only in response instead of getting all the data." + } + ] + }, + "description": "Fetch a particular Batch\nThis API is associated with fetching a particular batch on the Sunbird Platform.\nThe endpoint for Fetch a particular Batch is /batch/read/{Batch_ID}\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Content Update", + "item": [ + { + "name": "200 - Update existing data or add new data", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.update\", () => {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.update\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "pm.test(\"identifier should be equal to \" + pm.globals.get(\"content_id\"), () => {", + " pm.expect(jsonResponse.result.identifier).to.eql(pm.globals.get(\"content_id\"));", + "});", + "pm.test(\"node_id should be equal to \" + pm.globals.get(\"content_id\"), () => {", + " pm.expect(jsonResponse.result.node_id).to.eql(pm.globals.get(\"content_id\"));", + "});", + "", + "// Set global variable", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "// pm.globals.set('content_id');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"description\": \"dsd\",\n \"resourceType\": \"Learn\",\n \"framework\": \"ekstep_ncert_k-12\",\n \"name\": \"API DOCUMENTATION CONTENT\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + }, + "description": "This API is associated with updating a batch on the Sunbird Platform.\nThe endpoint for Course Batch Update is /batch/update\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "200 - Special character in name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.update\", () => {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.update\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "", + "pm.test(\"identifier should be equal to \" + pm.globals.get(\"content_id\"), () => {", + " pm.expect(jsonResponse.result.identifier).to.eql(pm.globals.get(\"content_id\"));", + "});", + "pm.test(\"node_id should be equal to \" + pm.globals.get(\"content_id\"), () => {", + " pm.expect(jsonResponse.result.node_id).to.eql(pm.globals.get(\"content_id\"));", + "});", + "", + "// Set global variable", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"description\": \"dsd\",\n \"name\": \"~`S!@#$%^&*()_+=:;\\\"'<,>.?/\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + }, + "description": "This API is associated with updating a batch on the Sunbird Platform.\nThe endpoint for Course Batch Update is /batch/update\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Content Reserve DIAL code", + "item": [ + { + "name": "Collection Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "pm.test(\"Test data type of the response and keys\", () => {", + " pm.expect(jsonResponse).to.be.an(\"object\").that.has.all.keys('id', 'ver', 'ts', 'params', 'responseCode', 'result');", + " pm.expect(jsonResponse.id).to.be.a(\"string\");", + " pm.expect(jsonResponse.ver).to.be.a(\"string\");", + " pm.expect(jsonResponse.ts).to.be.a(\"string\");", + " pm.expect(jsonResponse.responseCode).to.be.a(\"string\");", + " pm.expect(jsonResponse.params).to.be.an(\"object\").that.has.all.keys('resmsgid', 'msgid', 'err', 'status', 'errmsg');", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.null;", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.null;", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.create\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.create\");", + "});", + "pm.test(\"ver should be 4.0\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "pm.test(\"params.status should be successful\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"successful\");", + "});", + "pm.test(\"responseCode should be OK\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "", + "// Set global variable", + "pm.environment.set(\"collection_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Sample Collection\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.content-collection\",\n \"primaryCategory\": \"Digital Textbook\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Reserve DIAL code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Multiple scenarios handled at one place", + "pm.test(\"Response contains DIAL code\", function () {", + " const responseJson = pm.response.json();", + " var req = JSON.parse(request.data);", + " if(req.request.dialcodes.count > 1000){", + " pm.response.to.have.status(403);", + " } else {", + " const reservedDialcodes = responseJson.result.reservedDialcodes;", + " pm.expect(reservedDialcodes).not.null", + " _.forEach(JSON.parse(reservedDialcodes), function(value, key) {", + " const oldDialcode = pm.globals.get(\"new_dialcode\")", + " pm.globals.set(\"replaced_dialcode\", oldDialcode);", + " pm.globals.set(\"new_dialcode\", key);", + " });", + " console.log(pm.globals.get(\"replaced_dialcode\")); ", + " console.log(pm.globals.get(\"new_dialcode\"));", + " }", + " ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 3,\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Update Reserved DIAL code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Multiple scenarios handled at one place", + "pm.test(\"Response contains DIAL code\", function () {", + " const responseJson = pm.response.json();", + " var req = JSON.parse(request.data);", + " if(req.request.dialcodes.count > 1000){", + " pm.response.to.have.status(403);", + " } else {", + " const reservedDialcodes = responseJson.result.reservedDialcodes;", + " pm.expect(reservedDialcodes).not.null", + " }", + " ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 5,\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Reserve DIAL codes without qr spec", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Multiple scenarios handled at one place", + "pm.test(\"Response contains DIAL code\", function () {", + " const responseJson = pm.response.json();", + " var req = JSON.parse(request.data);", + " if(req.request.dialcodes.count > 1000){", + " pm.response.to.have.status(403);", + " } else {", + " const reservedDialcodes = responseJson.result.reservedDialcodes;", + " pm.expect(reservedDialcodes).not.null", + " }", + " ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 7\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + } + ], + "description": "The Content/Collection Reserve DIAL code APIs allow you to reserve DIAL codes to a content/collection on the Sunbird platform. Reserve DAIL code API was previously available as part of learning-service which has now been refactored into content-service.\n\nThe URLs for Content Reserve DIAL code API(s) are /content/v2/dialcode/reserve and /collection/v1/dialcode/reserve." + }, + { + "name": "Content Link DIAL code", + "item": [ + { + "name": "Link DIAL code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": [{\n \"identifier\": [\"{{collection_id}}\"],\n \"dialcode\": [\"{{new_dialcode}}\"]\n }]\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/link/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "link", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Update linked DIAL code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": [{\n \"identifier\": [\"{{collection_id}}\"],\n \"dialcode\": [\"{{replaced_dialcode}}\"]\n }]\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/link/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "link", + "{{collection_id}}" + ] + } + }, + "response": [] + } + ], + "description": "The Content/Collection Link DIAL code APIs allow you to link DIAL codes to content/collection/collection units on the Sunbird platform. Reserve DAIL code API was previously available as part of learning-service which has now been refactored into content-service.\n\nThe URLs for Content Link DIAL code API(s) are /content/v2/dialcode/link and /collection/v1/dialcode/link." + }, + { + "name": "Content Publish API", + "item": [ + { + "name": "Pre-requisite", + "item": [ + { + "name": "Collection Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.environment.set(\"collection_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Sample Collection\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.content-collection\",\n \"primaryCategory\": \"Digital Textbook\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "TOC Upload", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "fileUrl", + "value": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/hierarchy/do_113316820811522048194/createtoc.csv", + "type": "text" + } + ] + }, + "url": { + "raw": "{{host}}/api/collection/v1/import/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "import", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "PDF Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"pdf_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_2136088747812372481510/samplepdf.pdf\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "MP4 Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"mp4_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/mp4\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_21360643694649344011752/draftversion.mp4\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "WEBM Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"webm_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/webm\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_21360604894303027211507/big-buck-bunny_trailer.webm\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "HTML Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"html_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.html-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/do_21357841995316428811795/artifact/2.-ekiikrnn-kii-prkrti-output-3_1657521986480_1657522093104.zip\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "H5P Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"h5p_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.h5p-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/do_2136088263163084801476/artifact/1661233685237_do_2136088263163084801476.zip\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "ECML Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"ecml_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.ecml-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"body\": \"{\\\"theme\\\":{\\\"id\\\":\\\"theme\\\",\\\"version\\\":\\\"1.0\\\",\\\"startStage\\\":\\\"463caa09-b78e-412c-ae20-a2776c76b4a0\\\",\\\"stage\\\":[{\\\"x\\\":0,\\\"y\\\":0,\\\"w\\\":100,\\\"h\\\":100,\\\"id\\\":\\\"463caa09-b78e-412c-ae20-a2776c76b4a0\\\",\\\"rotate\\\":null,\\\"config\\\":{\\\"__cdata\\\":\\\"{\\\\\\\"opacity\\\\\\\":100,\\\\\\\"strokeWidth\\\\\\\":1,\\\\\\\"stroke\\\\\\\":\\\\\\\"rgba(255, 255, 255, 0)\\\\\\\",\\\\\\\"autoplay\\\\\\\":false,\\\\\\\"visible\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"#FFFFFF\\\\\\\",\\\\\\\"genieControls\\\\\\\":false,\\\\\\\"instructions\\\\\\\":\\\\\\\"\\\\\\\"}\\\"},\\\"manifest\\\":{\\\"media\\\":[]},\\\"shape\\\":[{\\\"type\\\":\\\"ellipse\\\",\\\"x\\\":15,\\\"y\\\":15,\\\"fill\\\":\\\"#00FF00\\\",\\\"w\\\":18,\\\"h\\\":32,\\\"stroke\\\":\\\"rgba(255, 255, 255, 0)\\\",\\\"strokeWidth\\\":1,\\\"opacity\\\":1,\\\"rotate\\\":0,\\\"r\\\":64.8,\\\"z-index\\\":0,\\\"id\\\":\\\"7e35536a-1e50-4ada-872e-416b04da61a0\\\",\\\"config\\\":{\\\"__cdata\\\":\\\"{\\\\\\\"opacity\\\\\\\":100,\\\\\\\"strokeWidth\\\\\\\":1,\\\\\\\"stroke\\\\\\\":\\\\\\\"rgba(255, 255, 255, 0)\\\\\\\",\\\\\\\"autoplay\\\\\\\":false,\\\\\\\"visible\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"#00FF00\\\\\\\",\\\\\\\"radius\\\\\\\":64.8}\\\"}}]}],\\\"manifest\\\":{\\\"media\\\":[{\\\"id\\\":\\\"d91cc898-8885-4642-9e55-d16bd502d946\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js\\\",\\\"type\\\":\\\"js\\\"},{\\\"id\\\":\\\"e02a792e-b75e-4eea-bae0-58666a4ee5c2\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html\\\",\\\"type\\\":\\\"js\\\"},{\\\"id\\\":\\\"org.ekstep.navigation\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js\\\",\\\"type\\\":\\\"plugin\\\"},{\\\"id\\\":\\\"org.ekstep.navigation_manifest\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/manifest.json\\\",\\\"type\\\":\\\"json\\\"}]},\\\"plugin-manifest\\\":{\\\"plugin\\\":[{\\\"id\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"type\\\":\\\"plugin\\\",\\\"depends\\\":\\\"\\\"}]},\\\"compatibilityVersion\\\":2}}\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "EPUB Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"epub_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/epub\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_2136085231556526081377/faulkner-sound-and-the-fury.epub\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Youtube Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"yt_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/x-youtube\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://www.youtube.com/watch?v=fkLcI4R7unE\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Plugin Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"plugin_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"org.ekstep.summary-test\",\n \"mimeType\": \"application/vnd.ekstep.plugin-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/org.ekstep.summary/artifact/org.ekstep.summary-1.0-1_1574060894628.zip\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + } + ] + }, + { + "name": "Test Cases", + "item": [ + { + "name": "Collection Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/publish/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "publish", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "PDF Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{pdf_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{pdf_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "MP4 Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{mp4_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{mp4_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "WEBM Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{webm_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{webm_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "HTML Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{html_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{html_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "H5P Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{h5p_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{h5p_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "EPUB Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{epub_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{epub_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "ECML Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{ecml_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{ecml_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Youtube Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{yt_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{yt_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Plugin Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{plugin_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{plugin_id}}" + ] + } + }, + "response": [] + } + ] + } + ], + "description": "The Content/Collection Publish APIs allow you to publish content/collection on the Sunbird platform. Publish API was previously available as part of learning-service which has now been refactored into content-service.\n\nThe URLs for Content Publish API(s) are /content/v2/publish and /collection/v1/publish." + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "//Verification", + "pm.test(\"Status code is 200\", () => {", + " pm.response.to.have.status(200)", + "});", + "//code name contains a string", + "tests[\"Status code name has string OK\"] = responseCode.name.has(\"OK\");", + "", + "// pm.test(\"Content-Encoding header is present\", () => {", + "// pm.response.to.have.header(\"Content-Encoding\");", + "// });", + "// pm.test(\"Content-Encoding header is gzip\", () => {", + "// pm.expect(pm.response.headers.get('Content-Encoding')).to.eql('gzip');", + "// });", + "", + "pm.test(\"Verify keys and data type of the params in positive scenario\", () => {", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.null;", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.null;", + "});", + "", + "pm.test(\"params.status should be \\\"successful\\\"\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"successful\");", + "});", + "pm.test(\"responseCode should be OK\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});" + ] + } + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "Content Create", + "item": [ + { + "name": "400 - missing channel", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Required Metadata channel not set\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Required Metadata channel not set');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"createdBy\": \"530b19ea-dc8d-4cc7-a4b5-0c0214c8113a\",\n \"resourceType\": \"Learn\",\n \"framework\": \"ekstep_ncert_k-12\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - empty channel", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Required Metadata channel not set\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Required Metadata channel not set');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"createdBy\": \"530b19ea-dc8d-4cc7-a4b5-0c0214c8113a\",\n \"resourceType\": \"Learn\",\n \"framework\": \"ekstep_ncert_k-12\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - missing name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Required Metadata name not set\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Required Metadata name not set');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - name: invalid datatype", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Metadata name should be a/an String value\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Metadata name should be a/an String value');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": 423432,\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - name empty", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Required Metadata name not set\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Required Metadata name not set');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - missing code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Required Metadata code not set\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Required Metadata code not set');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - missing mimeType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Required Metadata mimeType not set\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Required Metadata mimeType not set');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - invalid mimeType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Metadata mimeType should be one of: [application/vnd.ekstep.ecml-archive, application/vnd.ekstep.html-archive, application/vnd.android.package-archive, application/vnd.ekstep.content-archive, application/vnd.ekstep.content-collection, application/vnd.ekstep.plugin-archive, application/vnd.ekstep.h5p-archive, application/epub, text/x-url, video/x-youtube, application/octet-stream, application/msword, application/pdf, image/jpeg, image/jpg, image/png, image/tiff, image/bmp, image/gif, image/svg+xml, video/avi, video/mpeg, video/quicktime, video/3gpp, video/mp4, video/ogg, video/webm, audio/mp3, audio/mp4, audio/mpeg, audio/ogg, audio/webm, audio/x-wav, audio/wav, application/json, application/quiz]\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Metadata mimeType should be one of: [application/vnd.ekstep.ecml-archive, application/vnd.ekstep.html-archive, application/vnd.android.package-archive, application/vnd.ekstep.content-archive, application/vnd.ekstep.content-collection, application/vnd.ekstep.plugin-archive, application/vnd.ekstep.h5p-archive, application/epub, text/x-url, video/x-youtube, application/octet-stream, application/msword, application/pdf, image/jpeg, image/jpg, image/png, image/tiff, image/bmp, image/gif, image/svg+xml, video/avi, video/mpeg, video/quicktime, video/3gpp, video/mp4, video/ogg, video/webm, audio/mp3, audio/mp4, audio/mpeg, audio/ogg, audio/webm, audio/x-wav, audio/wav, application/json, application/quiz]');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"some-mimeType\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - missing primaryCategory", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"VALIDATION_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"VALIDATION_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"primaryCategory is a mandatory parameter\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"primaryCategory is a mandatory parameter\");", + "});", + "", + "// Result", + "pm.test(\"result body should be empty\", () => {", + " pm.expect(jsonResponse.result).to.eql({});", + " pm.expect(jsonResponse.result).to.be.empty;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - Invalid subject", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors.\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"subject range data is empty from the given framework.\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('subject range data is empty from the given framework.');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"createdBy\": \"530b19ea-dc8d-4cc7-a4b5-0c0214c8113a\",\n \"resourceType\": \"Learn\",\n \"framework\": \"ekstep_ncert_k-12-erwe\",\n \"subject\": [\"test\"],\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "404 - Invalid primaryCategory", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 404\", () => {", + " pm.response.to.have.status(404)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Not Found\\\"\"] = responseCode.name.has(\"Not Found\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.be.null;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be RESOURCE_NOT_FOUND\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"RESOURCE_NOT_FOUND\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"404\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"404\");", + "});", + "pm.test(`params.errmsg should be \\\"Entry is not found in cassandra for content with identifier: obj-cat:${JSON.parse(request.data).request.content.primaryCategory}_content_all {}\\\"`, () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(`Entry is not found in cassandra for content with identifier: obj-cat:${JSON.parse(request.data).request.content.primaryCategory}_content_all {}`);", + "});", + "", + "// Result", + "pm.test(\"messages should be null\", () => {", + " pm.expect(jsonResponse.result.messages).to.eql(null);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "connection": true + } + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"createdBy\": \"530b19ea-dc8d-4cc7-a4b5-0c0214c8113a\",\n \"resourceType\": \"Learn\",\n \"framework\": \"ekstep_ncert_k-12\",\n \"primaryCategory\": \"aabaa\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"id should be api.content.create\", () => {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.create\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});" + ] + } + } + ] + }, + { + "name": "Content Read", + "item": [ + { + "name": "404 - Not Found", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Not Found\\\"\"] = responseCode.name.has(\"Not Found\");", + "", + "pm.test(\"Test data type of the response and keys\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.be.null;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"id should be api.content.read\", () => {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.read\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "pm.test(\"responseCode should be RESOURCE_NOT_FOUND\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"RESOURCE_NOT_FOUND\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"NOT_FOUND\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"NOT_FOUND\");", + "});", + "pm.test(\"params.status should be \\\"failed\\\"\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"failed\");", + "});", + "pm.test(`params.errmsg should be \\\"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: ${pm.globals.get('invalid_content_id')}\\\"`, () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(`Error! Node(s) doesn't Exists. | [Invalid Node Id.]: ${pm.globals.get('invalid_content_id')}`);", + "});", + "", + "// Result", + "pm.test(\"messages should be null\", () => {", + " pm.expect(jsonResponse.result.messages).to.eql(null);", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.globals.set('invalid_content_id', 'do_42353245436534');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/api/content/v2/read/{{invalid_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "read", + "{{invalid_content_id}}" + ] + }, + "description": "Fetch a particular Batch\nThis API is associated with fetching a particular batch on the Sunbird Platform.\nThe endpoint for Fetch a particular Batch is /batch/read/{Batch_ID}\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Content Update", + "item": [ + { + "name": "400 - Invalid versionKey", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string Bad Request\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Content-Encoding header should not present\", () => {", + " pm.response.to.not.have.header(\"Content-Encoding\");", + "});", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.be.null;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be CLIENT_ERROR\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be CLIENT_ERROR\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.status should be failed\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"failed\");", + "});", + "pm.test(\"params.errmsg should be \\\"Invalid version Key\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Invalid version Key\");", + "});", + "", + "// Result", + "pm.test(\"messages should be null\", () => {", + " pm.expect(jsonResponse.result.messages).to.eql(null);", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.globals.set('invalid-versionKey', '3534534543');", + "// pm.globals.set(\"content_id\", '');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{invalid-versionKey}}\",\n \"lastUpdatedBy\": \"874ed8a5-782e-4f6c-8f36-e0288455901e\",\n \"description\": \"dsd\",\n \"name\": \"API DOCUMENTATION CONTENT\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + }, + "description": "This API is associated with updating a batch on the Sunbird Platform.\nThe endpoint for Course Batch Update is /batch/update\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "400 - Empty name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 400\", () => {", + " pm.response.to.have.status(400)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.not.be.empty;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"CLIENT_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Validation Errors\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Validation Errors\");", + "});", + "", + "// Result", + "pm.test(\"result body should include messages \\\"Required Metadata name not set\\\"\", () => {", + " pm.expect(jsonResponse.result.messages).to.have.length(1)", + " pm.expect(jsonResponse.result.messages).to.include('Required Metadata name not set');", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"description\": \"dsd\",\n \"name\": \"\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + }, + "description": "This API is associated with updating a batch on the Sunbird Platform.\nThe endpoint for Course Batch Update is /batch/update\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "404 - Invalid content id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 404\", () => {", + " pm.response.to.have.status(404)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Not Found\\\"\"] = responseCode.name.has(\"Not Found\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.be.null;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be RESOURCE_NOT_FOUND\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"RESOURCE_NOT_FOUND\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be NOT_FOUND\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"NOT_FOUND\");", + "});", + "pm.test(`params.errmsg should be \\\"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: ${pm.globals.get(\"invalid_content_id\")}\\\"`, () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(`Error! Node(s) doesn't Exists. | [Invalid Node Id.]: ${pm.globals.get(\"invalid_content_id\")}`);", + "});", + "", + "// Result", + "pm.test(\"messages should be null\", () => {", + " pm.expect(jsonResponse.result.messages).to.eql(null);", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.globals.set(\"invalid_content_id\", 'do_21357909972698726412211');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"lastUpdatedBy\": \"874ed8a5-782e-4f6c-8f36-e0288455901e\",\n \"description\": \"dsd\",\n \"name\": \"API DOCUMENTATION CONTENT\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{invalid_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{invalid_content_id}}" + ] + }, + "description": "This API is associated with updating a batch on the Sunbird Platform.\nThe endpoint for Course Batch Update is /batch/update\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + }, + { + "name": "404 - Invalid primaryCategory", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 404\", () => {", + " pm.response.to.have.status(404)", + "});", + "//code name contains a string", + "tests[\"Status code name has string \\\"Not Found\\\"\"] = responseCode.name.has(\"Not Found\");", + "", + "pm.test(\"Verify keys and data type of the response result\", () => {", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('messages');", + " pm.expect(jsonResponse.result.messages).to.be.null;", + "});", + "", + "//Validation", + "// Response body", + "pm.test(\"responseCode should be RESOURCE_NOT_FOUND\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"RESOURCE_NOT_FOUND\");", + "});", + "", + "// Params", + "pm.test(\"params.err should be \\\"404\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"404\");", + "});", + "pm.test(\"params.status should be \\\"failed\\\"\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"failed\");", + "});", + "pm.test(`params.errmsg should be \\\"Entry is not found in cassandra for content with identifier: obj-cat:${JSON.parse(request.data).request.content.primaryCategory}_content_all {}\\\"`, () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(`Entry is not found in cassandra for content with identifier: obj-cat:${JSON.parse(request.data).request.content.primaryCategory}_content_all {}`);", + "});", + "", + "pm.test(\"messages should be null\", () => {", + " pm.expect(jsonResponse.result.messages).to.eql(null);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"description\": \"dsd\",\n \"name\": \"API DOCUMENTATION CONTENT\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + }, + "description": "This API is associated with updating a batch on the Sunbird Platform.\nThe endpoint for Course Batch Update is /batch/update\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty." + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "// pm.globals.set(\"content_id\", '');" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "pm.test(\"id should be api.content.update\", () => {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.update\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});" + ] + } + } + ] + }, + { + "name": "Content Reserve DIAL code", + "item": [ + { + "name": "Reserve DIAL code with Invalid channel Id in header", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_CHANNEL\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_CHANNEL\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "dummy" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 3,\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Reserve DIAL code with Zero count", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_COUNT_RANGE\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_COUNT_RANGE\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 0,\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Reserve DIAL code with negative count", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_COUNT_RANGE\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_COUNT_RANGE\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": -2,\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Reserve DIAL code with count greater than max limit(250)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_COUNT_RANGE\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_COUNT_RANGE\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 251,\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Reserve DIAL code with invalid collection Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response throws RESOURCE_NOT_FOUND\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"RESOURCE_NOT_FOUND\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"NOT_FOUND\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 25,\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/reserve/do_dummy_id", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "reserve", + "do_dummy_id" + ] + } + }, + "response": [] + } + ], + "description": "The Content/Collection Reserve DIAL code APIs allow you to reserve DIAL codes to a content/collection on the Sunbird platform. Reserve DAIL code API was previously available as part of learning-service which has now been refactored into content-service.\n\nThe URLs for Content Reserve DIAL code API(s) are /content/v2/dialcode/reserve and /collction/v1/dialcode/reserve." + }, + { + "name": "Content Link DIAL code", + "item": [ + { + "name": "Link DIAL code with invalid collection id in the URL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response throws RESOURCE_NOT_FOUND\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"RESOURCE_NOT_FOUND\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"NOT_FOUND\") ", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": [{\n \"identifier\": [\"{{collection_id}}\"],\n \"dialcode\": [\"{{new_dialcode}}\"]\n }]\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/link/do_dummy_id", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "link", + "do_dummy_id" + ] + } + }, + "response": [] + }, + { + "name": "Link DIAL code with invalid collection id in the request body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response throws RESOURCE_NOT_FOUND\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"RESOURCE_NOT_FOUND\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_DIALCODE_LINK\") ", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": [{\n \"identifier\": [\"do_dummy_Id\"],\n \"dialcode\": [\"{{new_dialcode}}\"]\n }]\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/link/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "link", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Link DIAL code with invalid DIAL code in the request body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response throws RESOURCE_NOT_FOUND\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"RESOURCE_NOT_FOUND\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_DIALCODE_LINK\") ", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": [{\n \"identifier\": [\"{{collection_id}}\"],\n \"dialcode\": [\"DUMMY\"]\n }]\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/dialcode/link/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "dialcode", + "link", + "{{collection_id}}" + ] + } + }, + "response": [] + } + ], + "description": "The Content/Collection Link DIAL code APIs allow you to link DIAL codes to content/collection/collection units on the Sunbird platform. Reserve DAIL code API was previously available as part of learning-service which has now been refactored into content-service.\n\nThe URLs for Content Link DIAL code API(s) are /content/v2/dialcode/link and /collection/v1/dialcode/link" + }, + { + "name": "Content Publish API", + "item": [ + { + "name": "Pre-requisite", + "item": [ + { + "name": "Collection Create wo hierarchy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.environment.set(\"collection_id_wo_hierarchy\", jsonResponse.result.identifier);", + "pm.globals.set(\"collection_id_wo_hierarchy\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Sample Collection\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.content-collection\",\n \"primaryCategory\": \"Digital Textbook\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "PDF Content wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"pdf_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "MP4 Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"mp4_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/mp4\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "WEBM Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"webm_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/webm\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "HTML Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"html_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.html-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "H5P Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"h5p_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.h5p-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "ECML Content Create invalid body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"ecml_content_id_invalid_body\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.ecml-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"body\": \"dummy\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "ECML Content Create wo body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"ecml_content_id_wo_body\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.ecml-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "EPUB Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"epub_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/epub\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Youtube Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"yt_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/x-youtube\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Plugin Create wo artifact", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"plugin_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"test-plugin\",\n \"mimeType\": \"application/vnd.ekstep.plugin-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + } + ] + }, + { + "name": "Test Cases", + "item": [ + { + "name": "Invalid Content ID Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/do_dummy_id", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "do_dummy_id" + ] + } + }, + "response": [] + }, + { + "name": "Invalid Collection ID Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/publish/do_dummy_id", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "publish", + "do_dummy_id" + ] + } + }, + "response": [] + }, + { + "name": "PDF Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{pdf_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{pdf_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "MP4 Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{mp4_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{mp4_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "WEBM Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{webm_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{webm_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "HTML Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{html_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{html_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "H5P Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{h5p_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{h5p_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "EPUB Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{epub_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{epub_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "Youtube Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{yt_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{yt_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "Plugin Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{plugin_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{plugin_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "Collection Publish without hierarchy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_COLLECTION_REVIEW\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_COLLECTION_REVIEW\") ", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 40000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/collection/v1/publish/{{collection_id_wo_hierarchy}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "collection", + "v1", + "publish", + "{{collection_id_wo_hierarchy}}" + ] + } + }, + "response": [] + }, + { + "name": "ECML Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 2000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{ecml_content_id_wo_body}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{ecml_content_id_wo_body}}" + ] + } + }, + "response": [] + }, + { + "name": "ECML Content Publish invalid Body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"INVALID_CONTENT_BODY\") ", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/publish/{{ecml_content_id_invalid_body}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "publish", + "{{ecml_content_id_invalid_body}}" + ] + } + }, + "response": [] + } + ] + } + ], + "description": "The Content/Collection Publish APIs allow you to publish content/collection on the Sunbird platform. Publish API was previously available as part of learning-service which has now been refactored into content-service.\n\nThe URLs for Content Publish API(s) are /content/v2/publish and /collection/v1/publish." + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "//Verification", + "// pm.test(\"Content-Encoding header should not present\", () => {", + "// pm.response.to.not.have.header(\"Content-Encoding\");", + "// });", + "", + "pm.test(\"Verify keys and data type of the params in negative scenario\", () => {", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.a(\"string\");", + "});", + "", + "pm.test(\"params.status should be \\\"failed\\\"\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"failed\");", + "});", + "" + ] + } + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "pm.test(\"Validate keys and data type of the response body\", () => {", + " let jsonResponse = pm.response.json();", + " pm.expect(jsonResponse).to.be.an(\"object\").that.has.all.keys('id', 'ver', 'ts', 'params', 'responseCode', 'result');", + " pm.expect(jsonResponse.id).to.be.a(\"string\");", + " pm.expect(jsonResponse.ver).to.be.a(\"string\");", + " pm.expect(jsonResponse.ts).to.be.a(\"string\");", + " pm.expect(jsonResponse.params).to.be.an(\"object\").that.has.all.keys('resmsgid', 'msgid', 'err', 'status', 'errmsg');", + " pm.expect(jsonResponse.responseCode).to.be.a(\"string\");", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + "});" + ] + } + } + ] +} \ No newline at end of file diff --git a/content-api/api-tests/Collections/Content V2.postman_collection.json b/content-api/api-tests/Collections/Content V2.postman_collection.json new file mode 100644 index 000000000..baf4d7f39 --- /dev/null +++ b/content-api/api-tests/Collections/Content V2.postman_collection.json @@ -0,0 +1,1228 @@ +{ + "info": { + "_postman_id": "95bee03d-d782-47da-89f9-cc70bb0a267e", + "name": "Content V2", + "description": "The Content Management APIs allow you to create, manage and process content on the Sunbird platform. Content is the basic building block of the Knowledge Service. Some examples would be Videos, Audio, Pdfs, Html, ECML etc. The basic operations for this API include Create, Update, Read, Review, Publish.\n\n* Each of the endpoints serve a different purpose, so which one to use depends on what you want to do\n* The operations include CRUD (Create, Update, Read and Delete) operations and other operations such as upload, publish, flag, link DIAL code, etc.\n* The URL for Content Management API(s) is /content/v2.\n \n\nFor more details refer [here](https://knowlg.sunbird.org/learn/readme)\n\nAPI tests", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "1419050" + }, + "item": [ + { + "name": "Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "pm.test(\"Test data type of the response and keys\", () => {", + " pm.expect(jsonResponse).to.be.an(\"object\").that.has.all.keys('id', 'ver', 'ts', 'params', 'responseCode', 'result');", + " pm.expect(jsonResponse.id).to.be.a(\"string\");", + " pm.expect(jsonResponse.ver).to.be.a(\"string\");", + " pm.expect(jsonResponse.ts).to.be.a(\"string\");", + " pm.expect(jsonResponse.responseCode).to.be.a(\"string\");", + " pm.expect(jsonResponse.params).to.be.an(\"object\").that.has.all.keys('resmsgid', 'msgid', 'err', 'status', 'errmsg');", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.null;", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.null;", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.create\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.create\");", + "});", + "pm.test(\"ver should be 4.0\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "pm.test(\"params.status should be successful\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"successful\");", + "});", + "pm.test(\"responseCode should be OK\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "", + "// Set global variable", + "pm.globals.set(\"content_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Content Read", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", () => {", + " pm.response.to.have.status(200)", + "});", + "", + "//code name contains a string", + "tests[\"Status code name has string OK\"] = responseCode.name.has(\"OK\");", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "pm.test(\"Test data type of the response and keys\", () => {", + " pm.expect(jsonResponse).to.be.an(\"object\").that.has.all.keys('id', 'ver', 'ts', 'params', 'responseCode', 'result');", + " pm.expect(jsonResponse.id).to.be.a(\"string\");", + " pm.expect(jsonResponse.ver).to.be.a(\"string\");", + " pm.expect(jsonResponse.ts).to.be.a(\"string\");", + " pm.expect(jsonResponse.responseCode).to.be.a(\"string\");", + " pm.expect(jsonResponse.params).to.be.an(\"object\").that.has.all.keys('resmsgid', 'msgid', 'err', 'status', 'errmsg');", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.null;", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.null;", + " pm.expect(jsonResponse.result).to.be.an(\"object\").that.has.all.keys('content');", + " pm.expect(jsonResponse.result.content).to.be.an(\"object\")", + " pm.expect(jsonResponse.result.content).to.have.any.keys('identifier', 'versionKey', 'code', 'channel', 'mimeType', 'createdOn', 'primaryCategory', 'contentDisposition', 'contentEncoding', 'objectType', 'visibility', 'discussionForum', 'license', 'version', 'compatibilityLevel', 'name', 'status');", + " pm.expect(jsonResponse.result.content.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.content.versionKey).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.content.version).to.be.a(\"number\");", + " pm.expect(jsonResponse.result.content.channel).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.content.compatibilityLevel).to.be.a(\"number\");", + " pm.expect(jsonResponse.result.content.ownershipType).to.be.an(\"array\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.read\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.read\");", + "});", + "pm.test(\"ver should be 4.0\", () => {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "pm.test(\"params.status should be successful\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"successful\");", + "});", + "pm.test(\"responseCode should be OK\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "pm.test(\"identifier should be equal to \" + pm.globals.get(\"content_id\"), () => {", + " pm.expect(jsonResponse.result.content.identifier).to.eql(pm.globals.get(\"content_id\"));", + "});", + "pm.test(\"objectType should be Content\", () => {", + " pm.expect(jsonResponse.result.content.objectType).to.eql(\"Content\");", + "});", + "pm.test(\"visibility should be Default\", () => {", + " pm.expect(jsonResponse.result.content.visibility).to.eql(\"Default\");", + "});", + "pm.test(\"compatibilityLevel should be 1\", () => {", + " pm.expect(jsonResponse.result.content.compatibilityLevel).to.eql(1);", + "});", + "pm.test(\"status should be Draft\", () => {", + " pm.expect(jsonResponse.result.content.status).to.eql(\"Draft\");", + "});", + "", + "pm.globals.set(\"versionKey\", jsonResponse.result.content.versionKey);" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "// pm.globals.set('content_id', 'do_213584064677732352111');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + } + ], + "url": { + "raw": "{{host}}/api/content/v2/read/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "read", + "{{content_id}}" + ] + }, + "description": "This API is associated with viewing and reading out the content on the Sunbird Platform. You need to provide a valid content Id value in {{content_id}} field of API URL." + }, + "response": [ + { + "name": "Content Read - 200 OK", + "originalRequest": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + } + ], + "url": { + "raw": "{{host}}/api/content/v2/read/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "read", + "{{content_id}}" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:44:16 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999996" + }, + { + "key": "request-time", + "value": "26" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "28" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "32" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "14" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.read\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:44:16ZZ\",\n \"params\": {\n \"resmsgid\": \"2c23c136-d4eb-4c88-897b-7077bd2894cd\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"content\": {\n \"ownershipType\": [\n \"createdBy\"\n ],\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"interceptionPoints\": {},\n \"credentials\": {\n \"enabled\": \"No\"\n },\n \"channel\": \"channel_id\",\n \"language\": [\n \"English\"\n ],\n \"mimeType\": \"application/pdf\",\n \"idealScreenSize\": \"normal\",\n \"createdOn\": \"2022-07-19T06:42:53.248+0000\",\n \"objectType\": \"Content\",\n \"primaryCategory\": \"Explanation Content\",\n \"contentDisposition\": \"inline\",\n \"lastUpdatedOn\": \"2022-07-19T06:42:53.248+0000\",\n \"contentEncoding\": \"identity\",\n \"contentType\": \"ClassroomTeachingVideo\",\n \"dialcodeRequired\": \"No\",\n \"identifier\": \"do_21358408067678208014\",\n \"lastStatusChangedOn\": \"2022-07-19T06:42:53.248+0000\",\n \"audience\": [\n \"Student\"\n ],\n \"os\": [\n \"All\"\n ],\n \"visibility\": \"Default\",\n \"consumerId\": \"ab35de9d-2a45-410a-901f-82a25e05af6d\",\n \"discussionForum\": {\n \"enabled\": \"No\"\n },\n \"mediaType\": \"content\",\n \"osId\": \"org.ekstep.quiz.app\",\n \"languageCode\": [\n \"en\"\n ],\n \"version\": 2,\n \"versionKey\": \"1658212973248\",\n \"license\": \"CC BY 4.0\",\n \"idealScreenDensity\": \"hdpi\",\n \"framework\": \"NCF\",\n \"compatibilityLevel\": 1,\n \"name\": \"Untitled Content\",\n \"status\": \"Draft\"\n }\n }\n}" + }, + { + "name": "Content Read - 404 Not Found", + "originalRequest": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + } + ], + "url": { + "raw": "{{host}}/api/content/v2/read/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "read", + "{{content_id}}" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:36:38 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "59" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "61" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "74" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "116" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.read\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:36:38ZZ\",\n \"params\": {\n \"resmsgid\": \"e8f48807-bff1-45c0-8eeb-760dcf7f98cf\",\n \"msgid\": null,\n \"err\": \"NOT_FOUND\",\n \"status\": \"failed\",\n \"errmsg\": \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_213584064677732352111\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Content Update", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "pm.test(\"Test data type of the response and keys\", () => {", + " pm.expect(jsonResponse).to.be.an(\"object\").that.has.all.keys('id', 'ver', 'ts', 'params', 'responseCode', 'result');", + " pm.expect(jsonResponse.id).to.be.a(\"string\");", + " pm.expect(jsonResponse.ver).to.be.a(\"string\");", + " pm.expect(jsonResponse.ts).to.be.a(\"string\");", + " pm.expect(jsonResponse.responseCode).to.be.a(\"string\");", + " pm.expect(jsonResponse.params).to.be.an(\"object\").that.has.all.keys('resmsgid', 'msgid', 'err', 'status', 'errmsg');", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.null;", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.null;", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + " pm.expect(jsonResponse.result).to.have.all.keys('identifier', 'node_id', 'versionKey');", + " pm.expect(jsonResponse.result.identifier).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.node_id).to.be.a(\"string\");", + " pm.expect(jsonResponse.result.versionKey).to.be.a(\"string\");", + "});", + "", + "//Validation", + "pm.test(\"id should be api.content.update\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.update\");", + "});", + "pm.test(\"ver should be 4.0\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"4.0\");", + "});", + "pm.test(\"params.status should be successful\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"successful\");", + "});", + "pm.test(\"responseCode should be OK\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "pm.test(\"identifier should be equal to \" + pm.globals.get(\"content_id\"), function () {", + " pm.expect(jsonResponse.result.identifier).to.eql(pm.globals.get(\"content_id\"));", + "});", + "pm.test(\"node_id should be equal to \" + pm.globals.get(\"content_id\"), function () {", + " pm.expect(jsonResponse.result.node_id).to.eql(pm.globals.get(\"content_id\"));", + "});", + "", + "// Set global variable", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "// pm.globals.set('versionKey', '3534534543');", + "// pm.globals.set(\"content_id\", 'do_213584064677732352111');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"lastUpdatedBy\": \"874ed8a5-782e-4f6c-8f36-e0288455901e\",\n \"description\": \"dsd\",\n \"name\": \"API DOCUMENTATION CONTENT\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + }, + "description": "This API is associated with updating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Update - 200 OK", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"lastUpdatedBy\": \"874ed8a5-782e-4f6c-8f36-e0288455901e\",\n \"description\": \"dsd\",\n \"name\": \"API DOCUMENTATION CONTENT\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:44:37 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "87" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "88" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "92" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.update\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:44:37ZZ\",\n \"params\": {\n \"resmsgid\": \"767eada1-6342-4503-ad0d-b18aea711aab\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658213077381\"\n }\n}" + }, + { + "name": "Content Update - 400 Bad Request", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"lastUpdatedBy\": \"874ed8a5-782e-4f6c-8f36-e0288455901e\",\n \"description\": \"dsd\",\n \"name\": \"API DOCUMENTATION CONTENT\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:38:11 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "269" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "33" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "35" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "38" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "12" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.update\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:38:11ZZ\",\n \"params\": {\n \"resmsgid\": \"0237c6eb-9d37-474f-aed5-c83aee24116b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Invalid version Key\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": null\n }\n}" + }, + { + "name": "Content Update - 404 Not Found", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"versionKey\": \"{{versionKey}}\",\n \"lastUpdatedBy\": \"874ed8a5-782e-4f6c-8f36-e0288455901e\",\n \"description\": \"dsd\",\n \"name\": \"API DOCUMENTATION CONTENT\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/update/{{content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "update", + "{{content_id}}" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:39:22 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999996" + }, + { + "key": "request-time", + "value": "12" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "14" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "116" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.update\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:39:22ZZ\",\n \"params\": {\n \"resmsgid\": \"e60a2a4d-c8f9-4f10-bc66-695e0f86d82c\",\n \"msgid\": null,\n \"err\": \"NOT_FOUND\",\n \"status\": \"failed\",\n \"errmsg\": \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_213584064677732352111\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + } + ] +} \ No newline at end of file diff --git a/content-api/api-tests/Collections/Publish API.postman_collection.json b/content-api/api-tests/Collections/Publish API.postman_collection.json new file mode 100644 index 000000000..d060dd489 --- /dev/null +++ b/content-api/api-tests/Collections/Publish API.postman_collection.json @@ -0,0 +1,9744 @@ +{ + "info": { + "_postman_id": "607f186e-f5e0-4d51-a4c6-02c534d1689c", + "name": "Publish API", + "description": "The Content/Collection Publish APIs allow you to publish content/collection on the Sunbird platform. Publish API was previously available as part of learning-service which has now been refactored into content-service.\n\nThe URL for Content Management API(s) is /content/v2/publish and /collection/v1/publish.", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Pre-requisite", + "item": [ + { + "name": "Collection Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.environment.set(\"collection_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Sample Collection\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.content-collection\",\n \"primaryCategory\": \"Digital Textbook\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "TOC Upload", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{user-token}}" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "fileUrl", + "value": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/hierarchy/do_113316820811522048194/createtoc.csv", + "type": "text" + } + ] + }, + "url": { + "raw": "{{host}}/collection/v4/import/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "import", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Collection Create wo hierarchy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.environment.set(\"collection_id_wo_hierarchy\", jsonResponse.result.identifier);", + "pm.globals.set(\"collection_id_wo_hierarchy\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Sample Collection\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.content-collection\",\n \"primaryCategory\": \"Digital Textbook\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "PDF Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"pdf_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_2136088747812372481510/samplepdf.pdf\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "PDF Content wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"pdf_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "MP4 Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"mp4_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/mp4\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_21360643694649344011752/draftversion.mp4\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "MP4 Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"mp4_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/mp4\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "WEBM Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"webm_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/webm\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_21360604894303027211507/big-buck-bunny_trailer.webm\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "WEBM Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"webm_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/webm\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "HTML Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"html_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.html-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/do_21357841995316428811795/artifact/2.-ekiikrnn-kii-prkrti-output-3_1657521986480_1657522093104.zip\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "HTML Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"html_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.html-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "H5P Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"h5p_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.h5p-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/do_2136088263163084801476/artifact/1661233685237_do_2136088263163084801476.zip\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "H5P Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"h5p_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.h5p-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "ECML Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"ecml_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.ecml-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"body\": \"{\\\"theme\\\":{\\\"id\\\":\\\"theme\\\",\\\"version\\\":\\\"1.0\\\",\\\"startStage\\\":\\\"463caa09-b78e-412c-ae20-a2776c76b4a0\\\",\\\"stage\\\":[{\\\"x\\\":0,\\\"y\\\":0,\\\"w\\\":100,\\\"h\\\":100,\\\"id\\\":\\\"463caa09-b78e-412c-ae20-a2776c76b4a0\\\",\\\"rotate\\\":null,\\\"config\\\":{\\\"__cdata\\\":\\\"{\\\\\\\"opacity\\\\\\\":100,\\\\\\\"strokeWidth\\\\\\\":1,\\\\\\\"stroke\\\\\\\":\\\\\\\"rgba(255, 255, 255, 0)\\\\\\\",\\\\\\\"autoplay\\\\\\\":false,\\\\\\\"visible\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"#FFFFFF\\\\\\\",\\\\\\\"genieControls\\\\\\\":false,\\\\\\\"instructions\\\\\\\":\\\\\\\"\\\\\\\"}\\\"},\\\"manifest\\\":{\\\"media\\\":[]},\\\"shape\\\":[{\\\"type\\\":\\\"ellipse\\\",\\\"x\\\":15,\\\"y\\\":15,\\\"fill\\\":\\\"#00FF00\\\",\\\"w\\\":18,\\\"h\\\":32,\\\"stroke\\\":\\\"rgba(255, 255, 255, 0)\\\",\\\"strokeWidth\\\":1,\\\"opacity\\\":1,\\\"rotate\\\":0,\\\"r\\\":64.8,\\\"z-index\\\":0,\\\"id\\\":\\\"7e35536a-1e50-4ada-872e-416b04da61a0\\\",\\\"config\\\":{\\\"__cdata\\\":\\\"{\\\\\\\"opacity\\\\\\\":100,\\\\\\\"strokeWidth\\\\\\\":1,\\\\\\\"stroke\\\\\\\":\\\\\\\"rgba(255, 255, 255, 0)\\\\\\\",\\\\\\\"autoplay\\\\\\\":false,\\\\\\\"visible\\\\\\\":true,\\\\\\\"color\\\\\\\":\\\\\\\"#00FF00\\\\\\\",\\\\\\\"radius\\\\\\\":64.8}\\\"}}]}],\\\"manifest\\\":{\\\"media\\\":[{\\\"id\\\":\\\"d91cc898-8885-4642-9e55-d16bd502d946\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js\\\",\\\"type\\\":\\\"js\\\"},{\\\"id\\\":\\\"e02a792e-b75e-4eea-bae0-58666a4ee5c2\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html\\\",\\\"type\\\":\\\"js\\\"},{\\\"id\\\":\\\"org.ekstep.navigation\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js\\\",\\\"type\\\":\\\"plugin\\\"},{\\\"id\\\":\\\"org.ekstep.navigation_manifest\\\",\\\"plugin\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"src\\\":\\\"/content-plugins/org.ekstep.navigation-1.0/manifest.json\\\",\\\"type\\\":\\\"json\\\"}]},\\\"plugin-manifest\\\":{\\\"plugin\\\":[{\\\"id\\\":\\\"org.ekstep.navigation\\\",\\\"ver\\\":\\\"1.0\\\",\\\"type\\\":\\\"plugin\\\",\\\"depends\\\":\\\"\\\"}]},\\\"compatibilityVersion\\\":2}}\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "ECML Content Create invalid body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"ecml_content_id_invalid_body\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.ecml-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"body\": \"dummy\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "ECML Content Create wo body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"ecml_content_id_wo_body\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.ecml-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "EPUB Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"epub_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/epub\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_2136085231556526081377/faulkner-sound-and-the-fury.epub\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "EPUB Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"epub_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/epub\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Youtube Content Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"yt_content_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/x-youtube\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://www.youtube.com/watch?v=fkLcI4R7unE\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Youtube Content Create wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"yt_content_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"video/x-youtube\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Plugin Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"plugin_id\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"org.ekstep.summary-test\",\n \"mimeType\": \"application/vnd.ekstep.plugin-archive\",\n \"primaryCategory\": \"Explanation Content\",\n \"artifactUrl\": \"https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/org.ekstep.summary/artifact/org.ekstep.summary-1.0-1_1574060894628.zip\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + }, + { + "name": "Plugin Create wo artifact", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.globals.set(\"plugin_id_wo_artifact\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"test-plugin\",\n \"mimeType\": \"application/vnd.ekstep.plugin-archive\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [ + { + "name": "Content Create - 200 OK", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:42:53 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999995" + }, + { + "key": "request-time", + "value": "34" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "36" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "40" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "41" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:42:53ZZ\",\n \"params\": {\n \"resmsgid\": \"a06bcfc7-23b6-494a-8a63-bbdee8c6e373\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"identifier\": \"do_21358408067678208014\",\n \"node_id\": \"do_21358408067678208014\",\n \"versionKey\": \"1658212973248\"\n }\n}" + }, + { + "name": "Content Create - 400 Bad Request", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"Explanation Content\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:28:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "297" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999998" + }, + { + "key": "request-time", + "value": "11" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "18" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "125" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:28:26ZZ\",\n \"params\": {\n \"resmsgid\": \"7efe066b-39e0-4f03-a569-0e9f19e8822b\",\n \"msgid\": null,\n \"err\": \"CLIENT_ERROR\",\n \"status\": \"failed\",\n \"errmsg\": \"Validation Errors\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {\n \"messages\": [\n \"Required Metadata name not set\"\n ]\n }\n}" + }, + { + "name": "Content Create - 404 Not Found", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Untitled Content\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/pdf\",\n \"primaryCategory\": \"abcd\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/api/content/v2/create", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "content", + "v2", + "create" + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 19 Jul 2022 06:33:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "1000000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "999997" + }, + { + "key": "request-time", + "value": "16" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "23" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "115" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.create\",\n \"ver\": \"4.0\",\n \"ts\": \"2022-07-19T06:33:43ZZ\",\n \"params\": {\n \"resmsgid\": \"78745a2e-004b-4422-99e4-e2494387b3d4\",\n \"msgid\": null,\n \"err\": \"404\",\n \"status\": \"failed\",\n \"errmsg\": \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"\n },\n \"responseCode\": \"RESOURCE_NOT_FOUND\",\n \"result\": {\n \"messages\": null\n }\n}" + } + ] + } + ] + }, + { + "name": "Positive", + "item": [ + { + "name": "Content Publish API", + "item": [ + { + "name": "Collection Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "PDF Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{pdf_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{pdf_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "MP4 Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{mp4_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{mp4_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "WEBM Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{webm_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{webm_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "HTML Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{html_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{html_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "H5P Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{h5p_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{h5p_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "EPUB Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{epub_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{epub_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "ECML Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{ecml_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{ecml_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Youtube Content Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{yt_content_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{yt_content_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Plugin Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{plugin_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{plugin_id}}" + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "//Verification", + "pm.test(\"Status code is 200\", () => {", + " pm.response.to.have.status(200)", + "});", + "//code name contains a string", + "tests[\"Status code name has string OK\"] = responseCode.name.has(\"OK\");", + "", + "// pm.test(\"Content-Encoding header is present\", () => {", + "// pm.response.to.have.header(\"Content-Encoding\");", + "// });", + "// pm.test(\"Content-Encoding header is gzip\", () => {", + "// pm.expect(pm.response.headers.get('Content-Encoding')).to.eql('gzip');", + "// });", + "", + "pm.test(\"Verify keys and data type of the params in positive scenario\", () => {", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.null;", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.null;", + "});", + "", + "pm.test(\"params.status should be \\\"successful\\\"\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"successful\");", + "});", + "pm.test(\"responseCode should be OK\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});" + ] + } + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "Content Publish API", + "item": [ + { + "name": "Invalid Content ID Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/do_dummy_id", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "do_dummy_id" + ] + } + }, + "response": [] + }, + { + "name": "Invalid Collection ID Publish", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/do_dummy_id", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "do_dummy_id" + ] + } + }, + "response": [] + }, + { + "name": "PDF Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{pdf_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{pdf_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "MP4 Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{mp4_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{mp4_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "WEBM Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{webm_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{webm_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "HTML Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{html_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{html_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "H5P Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{h5p_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{h5p_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "EPUB Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{epub_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{epub_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "Youtube Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{yt_content_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{yt_content_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "Plugin Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{plugin_id_wo_artifact}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{plugin_id_wo_artifact}}" + ] + } + }, + "response": [] + }, + { + "name": "Collection Publish without hierarchy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_COLLECTION_REVIEW\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_COLLECTION_REVIEW\") ", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 40000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/publish/{{collection_id_wo_hierarchy}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "publish", + "{{collection_id_wo_hierarchy}}" + ] + } + }, + "response": [] + }, + { + "name": "ECML Content Publish wo artifactUrl", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"VALIDATOR_ERROR\") ", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 2000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{ecml_content_id_wo_body}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{ecml_content_id_wo_body}}" + ] + } + }, + "response": [] + }, + { + "name": "ECML Content Publish invalid Body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws CLIENT_ERROR\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"INVALID_CONTENT_BODY\") ", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"lastPublishedBy\": \"Testing\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/publish/{{ecml_content_id_invalid_body}}", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "publish", + "{{ecml_content_id_invalid_body}}" + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "//Verification", + "// pm.test(\"Content-Encoding header should not present\", () => {", + "// pm.response.to.not.have.header(\"Content-Encoding\");", + "// });", + "", + "pm.test(\"Verify keys and data type of the params in negative scenario\", () => {", + " pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.msgid).to.be.null;", + " pm.expect(jsonResponse.params.err).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.a(\"string\");", + "});", + "", + "pm.test(\"params.status should be \\\"failed\\\"\", () => {", + " pm.expect(jsonResponse.params.status).to.eql(\"failed\");", + "});", + "" + ] + } + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "pm.test(\"Validate keys and data type of the response body\", () => {", + " let jsonResponse = pm.response.json();", + " pm.expect(jsonResponse).to.be.an(\"object\").that.has.all.keys('id', 'ver', 'ts', 'params', 'responseCode', 'result');", + " pm.expect(jsonResponse.id).to.be.a(\"string\");", + " pm.expect(jsonResponse.ver).to.be.a(\"string\");", + " pm.expect(jsonResponse.ts).to.be.a(\"string\");", + " pm.expect(jsonResponse.params).to.be.an(\"object\").that.has.all.keys('resmsgid', 'msgid', 'err', 'status', 'errmsg');", + " pm.expect(jsonResponse.responseCode).to.be.a(\"string\");", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + "});" + ] + } + } + ] +} \ No newline at end of file diff --git a/content-api/api-tests/Collections/Release DIAL Code API.postman_collection.json b/content-api/api-tests/Collections/Release DIAL Code API.postman_collection.json new file mode 100644 index 000000000..2e825716c --- /dev/null +++ b/content-api/api-tests/Collections/Release DIAL Code API.postman_collection.json @@ -0,0 +1,907 @@ +{ + "info": { + "_postman_id": "d76732b8-56b7-4a54-84f1-4c43e694dcd9", + "name": "Release DIAL Code API", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Pre-requisite", + "item": [ + { + "name": "Collection Create", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.environment.set(\"collection_id\", jsonResponse.result.identifier);", + "pm.globals.set(\"versionKey\", jsonResponse.result.versionKey);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Sample Collection\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.content-collection\",\n \"primaryCategory\": \"Digital Textbook\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [] + }, + { + "name": "Collection Create wo reserved DIAL codes", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json()", + "", + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "// Set global variable", + "pm.environment.set(\"collection_id_wo_reserved_dial_codes\", jsonResponse.result.identifier);", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disabledSystemHeaders": {} + }, + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "The Content Type entity is the media type of the resource.Possible media types can be application/json." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "description": "Represents the authorized User ID to execute the API." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "description": "To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here." + }, + { + "key": "X-Channel-Id", + "value": "{{channel_id}}", + "type": "text", + "description": "Represents a physical location (e.g: state) uniquely to which the user belongs." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": {\n \"name\": \"Sample Collection\",\n \"code\": \"1242e9ea-660a-4536-a142-cc242a7a4162\",\n \"mimeType\": \"application/vnd.ekstep.content-collection\",\n \"primaryCategory\": \"Digital Textbook\"\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/content/v4/create", + "host": [ + "{{host}}" + ], + "path": [ + "content", + "v4", + "create" + ] + }, + "description": "This API is associated with creating content on the Sunbird Platform. Mandatory fields (name, code, mimeType and primaryCategory) cannot be null or empty.\n\nThe body refers to the format of the request.\n\n* The body contains metadata about the content to be updated.\n* Please refer for supported [metadata](https://github.com/project-sunbird/knowledge-platform/blob/master/schemas/content/1.0/schema.json)" + }, + "response": [] + }, + { + "name": "TOC Upload", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "//Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200)", + "});", + "", + "const responseJson = pm.response.json();", + "const unitIdentifiers = _.values(responseJson.result.identifiers)", + "", + "pm.globals.set(\"unitA\", unitIdentifiers[_.size(unitIdentifiers) - 2]);", + "pm.globals.set(\"unitB\", unitIdentifiers[_.size(unitIdentifiers) - 3]);", + "pm.globals.set(\"unitC\", unitIdentifiers[_.size(unitIdentifiers) - 4]);", + "console.log(pm.globals.get(\"unitA\") + \", \" + pm.globals.get(\"unitB\") + \", \" + pm.globals.get(\"unitC\"))", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{user-token}}" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "fileUrl", + "value": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/hierarchy/do_113316820811522048194/createtoc.csv", + "type": "text" + } + ] + }, + "url": { + "raw": "{{host}}/collection/v4/import/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "import", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Reserve DIAL code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const responseJson = pm.response.json();", + "", + "var reservedDialcodesObj = JSON.parse(responseJson.result.reservedDialcodes);", + "const reservedDialCodesList = _.keys(reservedDialcodesObj)", + "", + "pm.globals.set(\"originalReservedDIALCodes\", reservedDialCodesList)", + "pm.globals.set(\"dialcodeA\", reservedDialCodesList[_.size(reservedDialCodesList) - 2]);", + "pm.globals.set(\"dialcodeB\", reservedDialCodesList[_.size(reservedDialCodesList) - 3]);", + "pm.globals.set(\"dialcodeC\", reservedDialCodesList[_.size(reservedDialCodesList) - 4]);", + "", + "console.log(pm.globals.get(\"dialcodeA\") + \", \" + pm.globals.get(\"dialcodeB\") + \", \" + pm.globals.get(\"dialcodeC\"))" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.globals.set(\"ReservedDialCodesCount\", 8);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": {{ReservedDialCodesCount}},\n \"qrCodeSpec\": {\n \"errorCorrectionLevel\": \"H\"\n }\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/reserve/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "reserve", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Link DIAL code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(function(){}, 1000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "x-authenticated-user-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"content\": [{\n \"identifier\": [\"{{unitA}}\"],\n \"dialcode\": [\"{{dialcodeA}}\"]\n },\n {\n \"identifier\": [\"{{unitB}}\"],\n \"dialcode\": [\"{{dialcodeB}}\"]\n },\n {\n \"identifier\": [\"{{unitC}}\"],\n \"dialcode\": [\"{{dialcodeC}}\"]\n }]\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/link/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "link", + "{{collection_id}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Positive", + "item": [ + { + "name": "Release DIAL code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response returns with reservedDialcodes with one less\", function () {", + " const responseJson = pm.response.json();", + " ", + " var reservedDialcodesObj = JSON.parse(responseJson.result.reservedDialcodes);", + " const reservedDialCodesList = _.keys(reservedDialcodesObj)", + " var expectedCount = pm.globals.get(\"ReservedDialCodesCount\")-1", + " console.log(\"expected Count:: \" + expectedCount)", + " console.log(\"returned Count:: \" + _.size(reservedDialCodesList))", + " pm.expect(_.size(reservedDialCodesList) == expectedCount)", + "", + " var orgReservedDIALList = pm.globals.get(\"originalReservedDIALCodes\")", + " var releasedDialcode = _.difference(orgReservedDIALList, reservedDialCodesList)", + " console.log(\"releasedDialcode:: \" + releasedDialcode)", + "", + " pm.expect((releasedDialcode != pm.globals.get(\"dialcodeA\")) && ", + " (releasedDialcode != pm.globals.get(\"dialcodeB\")) && ", + " (releasedDialcode != pm.globals.get(\"dialcodeC\")))", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 5\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "Release DIAL code Invalid Channel Id header", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_CHANNEL\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_CHANNEL\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "dummy" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 1\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Release DIAL code with Zero count", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_COUNT_RANGE\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_COUNT_RANGE\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 0\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Release DIAL code with negative count", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_COUNT_RANGE\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_COUNT_RANGE\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": -2\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Release DIAL code with count greater than max limit(250)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_INVALID_COUNT_RANGE\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_INVALID_COUNT_RANGE\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 251\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Release DIAL code with invalid collection Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response throws RESOURCE_NOT_FOUND\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"RESOURCE_NOT_FOUND\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"NOT_FOUND\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 25\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/do_dummy_id", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "do_dummy_id" + ] + } + }, + "response": [] + }, + { + "name": "Release DIAL code for collection wo reserved DIAL codes", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_CONTENT_MISSING_RESERVED_DIAL_CODES\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_CONTENT_MISSING_RESERVED_DIAL_CODES\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 2\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id_wo_reserved_dial_codes}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id_wo_reserved_dial_codes}}" + ] + } + }, + "response": [] + }, + { + "name": "Release DIAL code with count greater than reserved DIAL codes count", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 25\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Release DIAL code with count same as linked DIAL codes", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response throws ERR_ALL_DIALCODES_UTILIZED\", function () {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson.responseCode).equals(\"CLIENT_ERROR\")", + " ", + " const params = responseJson.params;", + " pm.expect(params.status).equals(\"failed\")", + " pm.expect(params.err).equals(\"ERR_ALL_DIALCODES_UTILIZED\") ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Channel-ID", + "value": "{{channel_id}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"dialcodes\": {\n \"count\": 2\n }\n }\n}" + }, + "url": { + "raw": "{{host}}/collection/v4/dialcode/release/{{collection_id}}", + "host": [ + "{{host}}" + ], + "path": [ + "collection", + "v4", + "dialcode", + "release", + "{{collection_id}}" + ] + } + }, + "response": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/content-api/api-tests/Reports/Content V2 API Test.postman_test_run.json b/content-api/api-tests/Reports/Content V2 API Test.postman_test_run.json new file mode 100644 index 000000000..aff0883c2 --- /dev/null +++ b/content-api/api-tests/Reports/Content V2 API Test.postman_test_run.json @@ -0,0 +1,2574 @@ +{ + "id": "489956f4-e5fd-4c92-8408-6a4598e10940", + "name": "Content V2 API Test", + "timestamp": "2022-07-27T05:30:40.864Z", + "collection_id": "1419050-58a713b4-b8bb-4885-9909-b23d253f8f31", + "folder_id": 0, + "environment_id": "1419050-b1be6ead-50b9-49a1-b0e2-95f479990dad", + "totalPass": 328, + "totalFail": 0, + "results": [ + { + "id": "2383265f-a48f-47dc-9538-e3c7a16b1d98", + "name": "200 - With minimal required attribute", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 229, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 229 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true + } + ] + }, + { + "id": "fdb1f5bc-f5b3-4c3c-b622-bd86a8f92b40", + "name": "200 - With identifier", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 61, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "identifier should be equal to some_identifier": true, + "node_id should be equal to some_identifier": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "identifier should be equal to some_identifier": { + "pass": 1, + "fail": 0 + }, + "node_id should be equal to some_identifier": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 61 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "identifier should be equal to some_identifier": true, + "node_id should be equal to some_identifier": true + } + ] + }, + { + "id": "67644d61-7797-4f54-82cf-d4b7711b5282", + "name": "200 - With external fields", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 84, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 84 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true + } + ] + }, + { + "id": "4fa811d0-1e33-493c-95fe-39bac77bae42", + "name": "200 - Special character in name", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 67, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 67 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.create": true, + "ver should be 4.0": true + } + ] + }, + { + "id": "5f38fbf3-1dd6-4f5a-8796-6ca07d837d25", + "name": "200 - Get all data ecxept external data", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/read/do_2135897074718965761132", + "time": 111, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.read": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true, + "objectType should be Content": true, + "visibility should be Default": true, + "compatibilityLevel should be 1": true, + "status should be Draft": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.read": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "identifier should be equal to do_2135897074718965761132": { + "pass": 1, + "fail": 0 + }, + "objectType should be Content": { + "pass": 1, + "fail": 0 + }, + "visibility should be Default": { + "pass": 1, + "fail": 0 + }, + "compatibilityLevel should be 1": { + "pass": 1, + "fail": 0 + }, + "status should be Draft": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 111 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.read": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true, + "objectType should be Content": true, + "visibility should be Default": true, + "compatibilityLevel should be 1": true, + "status should be Draft": true + } + ] + }, + { + "id": "6cad6c08-f73b-4d00-9395-b8cbcb3cafe0", + "name": "200 - Get specific attributes by sending fields query params", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/read/do_2135897074718965761132?fields=name,primaryCategory,body", + "time": 69, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.read": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.read": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "identifier should be equal to do_2135897074718965761132": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 69 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.read": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true + } + ] + }, + { + "id": "bcd0f26d-ca6b-4eb7-815a-e85c4044a829", + "name": "200 - Update existing data or add new data", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/update/do_2135897074718965761132", + "time": 558, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true, + "node_id should be equal to do_2135897074718965761132": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.update": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "identifier should be equal to do_2135897074718965761132": { + "pass": 1, + "fail": 0 + }, + "node_id should be equal to do_2135897074718965761132": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 558 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true, + "node_id should be equal to do_2135897074718965761132": true + } + ] + }, + { + "id": "1d43c4ab-ea8b-449c-8dca-aa7eda247bfa", + "name": "200 - Special character in name", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/update/do_2135897074718965761132", + "time": 575, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true, + "node_id should be equal to do_2135897074718965761132": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.update": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "identifier should be equal to do_2135897074718965761132": { + "pass": 1, + "fail": 0 + }, + "node_id should be equal to do_2135897074718965761132": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 575 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true, + "Verify keys and data type of the response result": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "identifier should be equal to do_2135897074718965761132": true, + "node_id should be equal to do_2135897074718965761132": true + } + ] + }, + { + "id": "6d2a8074-8afe-40ba-9e29-2376fc3db053", + "name": "400 - missing channel", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 21, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata channel not set\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Required Metadata channel not set\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 21 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata channel not set\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "59690e87-ff4d-4d1d-b549-0156afa7611b", + "name": "400 - empty channel", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 71, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata channel not set\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Required Metadata channel not set\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 71 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata channel not set\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "dd956c1e-35b6-4525-baaf-0b2a8ab5ab57", + "name": "400 - missing name", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 69, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata name not set\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Required Metadata name not set\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 69 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata name not set\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "c6c1b7fd-a278-4ef3-9d2e-6c76a53d1c33", + "name": "400 - name: invalid datatype", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 49, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Metadata name should be a/an String value\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Metadata name should be a/an String value\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 49 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Metadata name should be a/an String value\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "a1ac9342-84c0-4395-aa52-b8248007722d", + "name": "400 - name empty", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 48, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata name not set\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Required Metadata name not set\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 48 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata name not set\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "37e04040-1676-4dca-a674-54210b5990e2", + "name": "400 - missing code", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 67, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata code not set\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Required Metadata code not set\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 67 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata code not set\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "077b803b-7fbb-4264-823c-c41c0bac597d", + "name": "400 - missing mimeType", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 45, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata mimeType not set\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Required Metadata mimeType not set\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 45 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata mimeType not set\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "6a365695-00de-4d90-ab6f-4726e59b1898", + "name": "400 - invalid mimeType", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 69, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Metadata mimeType should be one of: [application/vnd.ekstep.ecml-archive, application/vnd.ekstep.html-archive, application/vnd.android.package-archive, application/vnd.ekstep.content-archive, application/vnd.ekstep.content-collection, application/vnd.ekstep.plugin-archive, application/vnd.ekstep.h5p-archive, application/epub, text/x-url, video/x-youtube, application/octet-stream, application/msword, application/pdf, image/jpeg, image/jpg, image/png, image/tiff, image/bmp, image/gif, image/svg+xml, video/avi, video/mpeg, video/quicktime, video/3gpp, video/mp4, video/ogg, video/webm, audio/mp3, audio/mp4, audio/mpeg, audio/ogg, audio/webm, audio/x-wav, audio/wav, application/json, application/quiz]\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Metadata mimeType should be one of: [application/vnd.ekstep.ecml-archive, application/vnd.ekstep.html-archive, application/vnd.android.package-archive, application/vnd.ekstep.content-archive, application/vnd.ekstep.content-collection, application/vnd.ekstep.plugin-archive, application/vnd.ekstep.h5p-archive, application/epub, text/x-url, video/x-youtube, application/octet-stream, application/msword, application/pdf, image/jpeg, image/jpg, image/png, image/tiff, image/bmp, image/gif, image/svg+xml, video/avi, video/mpeg, video/quicktime, video/3gpp, video/mp4, video/ogg, video/webm, audio/mp3, audio/mp4, audio/mpeg, audio/ogg, audio/webm, audio/x-wav, audio/wav, application/json, application/quiz]\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 69 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Metadata mimeType should be one of: [application/vnd.ekstep.ecml-archive, application/vnd.ekstep.html-archive, application/vnd.android.package-archive, application/vnd.ekstep.content-archive, application/vnd.ekstep.content-collection, application/vnd.ekstep.plugin-archive, application/vnd.ekstep.h5p-archive, application/epub, text/x-url, video/x-youtube, application/octet-stream, application/msword, application/pdf, image/jpeg, image/jpg, image/png, image/tiff, image/bmp, image/gif, image/svg+xml, video/avi, video/mpeg, video/quicktime, video/3gpp, video/mp4, video/ogg, video/webm, audio/mp3, audio/mp4, audio/mpeg, audio/ogg, audio/webm, audio/x-wav, audio/wav, application/json, application/quiz]\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "174eb09b-0d2d-4ef4-9109-e74e75472d28", + "name": "400 - missing primaryCategory", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 48, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"VALIDATION_ERROR\"": true, + "params.errmsg should be \"primaryCategory is a mandatory parameter\"": true, + "result body should be empty": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"VALIDATION_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"primaryCategory is a mandatory parameter\"": { + "pass": 1, + "fail": 0 + }, + "result body should be empty": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 48 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"VALIDATION_ERROR\"": true, + "params.errmsg should be \"primaryCategory is a mandatory parameter\"": true, + "result body should be empty": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "136c3218-e05b-418e-886a-d10129c996ba", + "name": "400 - Invalid subject", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 50, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors.\"": true, + "result body should include messages \"subject range data is empty from the given framework.\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors.\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"subject range data is empty from the given framework.\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 50 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors.\"": true, + "result body should include messages \"subject range data is empty from the given framework.\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "c4a3ef78-c5f3-4a82-ac3e-88ba8e2cc4b3", + "name": "404 - Invalid primaryCategory", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/create", + "time": 75, + "responseCode": { + "code": 404, + "name": "Not Found" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 404": true, + "Verify keys and data type of the response result": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be \"404\"": true, + "params.errmsg should be \"Entry is not found in cassandra for content with identifier: obj-cat:aabaa_content_all {}\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.create": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 404": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be RESOURCE_NOT_FOUND": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"404\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Entry is not found in cassandra for content with identifier: obj-cat:aabaa_content_all {}\"": { + "pass": 1, + "fail": 0 + }, + "messages should be null": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Not Found\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 75 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.create": true, + "ver should be 4.0": true, + "Status code is 404": true, + "Verify keys and data type of the response result": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be \"404\"": true, + "params.errmsg should be \"Entry is not found in cassandra for content with identifier: obj-cat:aabaa_content_all {}\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + } + ] + }, + { + "id": "59f831d2-df67-4297-9641-2304cea74637", + "name": "404 - Not Found", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/read/do_42353245436534", + "time": 65, + "responseCode": { + "code": 404, + "name": "Not Found" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 404": true, + "Test data type of the response and keys": true, + "id should be api.content.read": true, + "ver should be 4.0": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be \"NOT_FOUND\"": true, + "params.errmsg should be \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_42353245436534\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 404": { + "pass": 1, + "fail": 0 + }, + "Test data type of the response and keys": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.read": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "responseCode should be RESOURCE_NOT_FOUND": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"NOT_FOUND\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_42353245436534\"": { + "pass": 1, + "fail": 0 + }, + "messages should be null": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Not Found\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 65 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 404": true, + "Test data type of the response and keys": true, + "id should be api.content.read": true, + "ver should be 4.0": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be \"NOT_FOUND\"": true, + "params.errmsg should be \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_42353245436534\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + } + ] + }, + { + "id": "8be3bf77-e65e-4dab-9053-cf7400fd5aa5", + "name": "400 - Invalid versionKey", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/update/do_2135897074718965761132", + "time": 77, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Content-Encoding header should not present": true, + "Verify keys and data type of the response result": true, + "responseCode should be CLIENT_ERROR": true, + "params.err should be CLIENT_ERROR": true, + "params.status should be failed": true, + "params.errmsg should be \"Invalid version Key\"": true, + "messages should be null": true, + "Status code name has string Bad Request": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.update": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Content-Encoding header should not present": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be CLIENT_ERROR": { + "pass": 1, + "fail": 0 + }, + "params.err should be CLIENT_ERROR": { + "pass": 1, + "fail": 0 + }, + "params.status should be failed": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Invalid version Key\"": { + "pass": 1, + "fail": 0 + }, + "messages should be null": { + "pass": 1, + "fail": 0 + }, + "Status code name has string Bad Request": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 77 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Content-Encoding header should not present": true, + "Verify keys and data type of the response result": true, + "responseCode should be CLIENT_ERROR": true, + "params.err should be CLIENT_ERROR": true, + "params.status should be failed": true, + "params.errmsg should be \"Invalid version Key\"": true, + "messages should be null": true, + "Status code name has string Bad Request": true + } + ] + }, + { + "id": "d705cd83-e917-4be6-a755-e9c7d377c9c6", + "name": "400 - Empty name", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/update/do_2135897074718965761132", + "time": 42, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata name not set\"": true, + "Status code name has string \"Bad Request\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.update": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"CLIENT_ERROR\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Validation Errors\"": { + "pass": 1, + "fail": 0 + }, + "result body should include messages \"Required Metadata name not set\"": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Bad Request\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 42 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 400": true, + "Verify keys and data type of the response result": true, + "responseCode should be \"CLIENT_ERROR\"": true, + "params.err should be \"CLIENT_ERROR\"": true, + "params.errmsg should be \"Validation Errors\"": true, + "result body should include messages \"Required Metadata name not set\"": true, + "Status code name has string \"Bad Request\"": true + } + ] + }, + { + "id": "13158c62-e311-458c-a9ef-fabe24c065f6", + "name": "404 - Invalid content id", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/update/do_21357909972698726412211", + "time": 36, + "responseCode": { + "code": 404, + "name": "Not Found" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 404": true, + "Verify keys and data type of the response result": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be NOT_FOUND": true, + "params.errmsg should be \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_21357909972698726412211\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.update": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 404": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be RESOURCE_NOT_FOUND": { + "pass": 1, + "fail": 0 + }, + "params.err should be NOT_FOUND": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_21357909972698726412211\"": { + "pass": 1, + "fail": 0 + }, + "messages should be null": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Not Found\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 36 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 404": true, + "Verify keys and data type of the response result": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be NOT_FOUND": true, + "params.errmsg should be \"Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_21357909972698726412211\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + } + ] + }, + { + "id": "d05ba7e2-041f-4a54-9370-e5ecfd286a62", + "name": "404 - Invalid primaryCategory", + "url": "https://dev.knowlg.sunbird.org/api/content/v2/update/do_2135897074718965761132", + "time": 109, + "responseCode": { + "code": 404, + "name": "Not Found" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 404": true, + "Verify keys and data type of the response result": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be \"404\"": true, + "params.errmsg should be \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "id should be api.content.update": { + "pass": 1, + "fail": 0 + }, + "ver should be 4.0": { + "pass": 1, + "fail": 0 + }, + "Status code is 404": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the response result": { + "pass": 1, + "fail": 0 + }, + "responseCode should be RESOURCE_NOT_FOUND": { + "pass": 1, + "fail": 0 + }, + "params.err should be \"404\"": { + "pass": 1, + "fail": 0 + }, + "params.errmsg should be \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"": { + "pass": 1, + "fail": 0 + }, + "messages should be null": { + "pass": 1, + "fail": 0 + }, + "Status code name has string \"Not Found\"": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 109 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "id should be api.content.update": true, + "ver should be 4.0": true, + "Status code is 404": true, + "Verify keys and data type of the response result": true, + "responseCode should be RESOURCE_NOT_FOUND": true, + "params.err should be \"404\"": true, + "params.errmsg should be \"Entry is not found in cassandra for content with identifier: obj-cat:abcd_content_all {}\"": true, + "messages should be null": true, + "Status code name has string \"Not Found\"": true + } + ] + } + ], + "count": 1, + "totalTime": 2695, + "collection": { + "requests": [ + { + "id": "2383265f-a48f-47dc-9538-e3c7a16b1d98", + "method": "POST" + }, + { + "id": "fdb1f5bc-f5b3-4c3c-b622-bd86a8f92b40", + "method": "POST" + }, + { + "id": "67644d61-7797-4f54-82cf-d4b7711b5282", + "method": "POST" + }, + { + "id": "4fa811d0-1e33-493c-95fe-39bac77bae42", + "method": "POST" + }, + { + "id": "5f38fbf3-1dd6-4f5a-8796-6ca07d837d25", + "method": "GET" + }, + { + "id": "6cad6c08-f73b-4d00-9395-b8cbcb3cafe0", + "method": "GET" + }, + { + "id": "bcd0f26d-ca6b-4eb7-815a-e85c4044a829", + "method": "PATCH" + }, + { + "id": "1d43c4ab-ea8b-449c-8dca-aa7eda247bfa", + "method": "PATCH" + }, + { + "id": "6d2a8074-8afe-40ba-9e29-2376fc3db053", + "method": "POST" + }, + { + "id": "59690e87-ff4d-4d1d-b549-0156afa7611b", + "method": "POST" + }, + { + "id": "dd956c1e-35b6-4525-baaf-0b2a8ab5ab57", + "method": "POST" + }, + { + "id": "c6c1b7fd-a278-4ef3-9d2e-6c76a53d1c33", + "method": "POST" + }, + { + "id": "a1ac9342-84c0-4395-aa52-b8248007722d", + "method": "POST" + }, + { + "id": "37e04040-1676-4dca-a674-54210b5990e2", + "method": "POST" + }, + { + "id": "077b803b-7fbb-4264-823c-c41c0bac597d", + "method": "POST" + }, + { + "id": "6a365695-00de-4d90-ab6f-4726e59b1898", + "method": "POST" + }, + { + "id": "174eb09b-0d2d-4ef4-9109-e74e75472d28", + "method": "POST" + }, + { + "id": "136c3218-e05b-418e-886a-d10129c996ba", + "method": "POST" + }, + { + "id": "c4a3ef78-c5f3-4a82-ac3e-88ba8e2cc4b3", + "method": "POST" + }, + { + "id": "59f831d2-df67-4297-9641-2304cea74637", + "method": "GET" + }, + { + "id": "8be3bf77-e65e-4dab-9053-cf7400fd5aa5", + "method": "PATCH" + }, + { + "id": "d705cd83-e917-4be6-a755-e9c7d377c9c6", + "method": "PATCH" + }, + { + "id": "13158c62-e311-458c-a9ef-fabe24c065f6", + "method": "PATCH" + }, + { + "id": "d05ba7e2-041f-4a54-9370-e5ecfd286a62", + "method": "PATCH" + } + ] + } +} \ No newline at end of file diff --git a/content-api/api-tests/Reports/Publish API.postman_test_run.json b/content-api/api-tests/Reports/Publish API.postman_test_run.json new file mode 100644 index 000000000..d6d977823 --- /dev/null +++ b/content-api/api-tests/Reports/Publish API.postman_test_run.json @@ -0,0 +1,2679 @@ +{ + "id": "25eb49d4-fb87-4fdd-abb6-e860574ac33a", + "name": "Publish API", + "timestamp": "2022-08-23T08:43:52.665Z", + "collection_id": "13387833-607f186e-f5e0-4d51-a4c6-02c534d1689c", + "folder_id": 0, + "environment_id": "0e0b136d-70cc-437e-a0df-ccba162408d9", + "totalPass": 266, + "totalFail": 0, + "results": [ + { + "id": "80fd9644-56d3-4eb5-910f-c2f9a6bbcc39", + "name": "Collection Create", + "url": "http://localhost:9000/content/v4/create", + "time": 361, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 361 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "7c5475c1-7c6a-4ca5-b71f-37b05e719446", + "name": "TOC Upload", + "url": "http://localhost:9000/collection/v4/import/do_11360891275809587211", + "time": 961, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 961 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true + } + ] + }, + { + "id": "f00000f4-e316-4081-a994-ac9078ff9a1b", + "name": "Collection Create wo hierarchy", + "url": "http://localhost:9000/content/v4/create", + "time": 45, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 45 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "edfc8942-03f2-4b49-81d6-c29a1a01d2cb", + "name": "PDF Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 67, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 67 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "13c92a31-a1b0-4bd1-95a8-e1e46af2e61f", + "name": "PDF Content wo artifactUrl", + "url": "http://localhost:9000/content/v4/create", + "time": 38, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 38 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "637502c0-3bd9-427b-997e-d01372a846c5", + "name": "MP4 Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 47, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 47 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "e4adecc9-606a-4091-b4c1-e3d2e655c370", + "name": "MP4 Content Create wo artifactUrl", + "url": "http://localhost:9000/content/v4/create", + "time": 43, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 43 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "c0c3b560-fb40-4e22-accb-74498265940f", + "name": "WEBM Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 63, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 63 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "8bb660d5-4a55-42ec-9f63-285fddf01712", + "name": "WEBM Content Create wo artifactUrl", + "url": "http://localhost:9000/content/v4/create", + "time": 55, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 55 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "8ea033c2-ced7-4189-b1a9-d4ffa3e20196", + "name": "HTML Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 30, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 30 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "6df047f6-2ac2-4967-949c-f10d9f6decb4", + "name": "HTML Content Create wo artifactUrl", + "url": "http://localhost:9000/content/v4/create", + "time": 31, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 31 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "e4cee867-b30a-4426-b314-c81d8f28cb82", + "name": "H5P Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 41, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 41 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "ebe40740-4050-43ce-a316-892100ca0676", + "name": "H5P Content Create wo artifactUrl", + "url": "http://localhost:9000/content/v4/create", + "time": 25, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 25 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "2418c40f-9b7f-4e6e-90fe-9f0b3c04537d", + "name": "ECML Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 62, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 62 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "87ac52e6-5672-4198-b13c-01fd45cb3db5", + "name": "ECML Content Create invalid body", + "url": "http://localhost:9000/content/v4/create", + "time": 48, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 48 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "8cd499ee-3bcd-4efe-ada5-92b5f5ece200", + "name": "ECML Content Create wo body", + "url": "http://localhost:9000/content/v4/create", + "time": 45, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 45 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "b339d20a-19ed-4281-9831-c10c6383e386", + "name": "EPUB Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 39, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 39 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "869a5263-7711-4c53-bc38-0da493f4ece2", + "name": "EPUB Content Create wo artifactUrl", + "url": "http://localhost:9000/content/v4/create", + "time": 30, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 30 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "d71c64ed-ab39-477e-95de-9eeea47b7986", + "name": "Youtube Content Create", + "url": "http://localhost:9000/content/v4/create", + "time": 27, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 27 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "45065a85-6bf9-4cb5-9acc-2c06345f8a26", + "name": "Youtube Content Create wo artifactUrl", + "url": "http://localhost:9000/content/v4/create", + "time": 37, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 37 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "5a9bc533-ecb7-4fb8-ae48-75ea2180b040", + "name": "Plugin Create", + "url": "http://localhost:9000/content/v4/create", + "time": 41, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 41 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "b5dd8a58-9ab1-4833-b8bb-564eda36cbc9", + "name": "Plugin Create wo artifact", + "url": "http://localhost:9000/content/v4/create", + "time": 27, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 27 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true + } + ] + }, + { + "id": "f2342494-ae32-4093-8048-f852ad38223b", + "name": "Collection Publish", + "url": "http://localhost:9000/collection/v4/publish/do_11360891275809587211", + "time": 46, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 46 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "d7dcfe64-e0d3-48aa-a4ce-121f19eac58e", + "name": "PDF Content Publish", + "url": "http://localhost:9000/content/v4/publish/do_113608912769916928117", + "time": 65, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 65 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "79327a95-1346-4635-b8ab-a3427ff9d278", + "name": "MP4 Content Publish", + "url": "http://localhost:9000/content/v4/publish/do_113608912771776512119", + "time": 49, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 49 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "e203fc85-ac81-43d1-b744-054688acf98a", + "name": "WEBM Content Publish", + "url": "http://localhost:9000/content/v4/publish/do_113608912773750784121", + "time": 50, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 50 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "1f9def38-d148-49cc-a056-14bf1d72442f", + "name": "HTML Content Publish", + "url": "http://localhost:9000/collection/v4/publish/do_113608912775979008123", + "time": 56, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 56 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "af6b95b5-5466-4b36-bbf3-5e9762d900d0", + "name": "H5P Content Publish", + "url": "http://localhost:9000/collection/v4/publish/do_113608912777338880125", + "time": 46, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 46 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "1ac93190-744e-491e-aacd-cf8204b6a073", + "name": "EPUB Content Publish", + "url": "http://localhost:9000/collection/v4/publish/do_113608912781467648130", + "time": 40, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 40 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "9a2bbcf9-89d1-4af6-94a2-42c87774cdbf", + "name": "ECML Content Publish", + "url": "http://localhost:9000/collection/v4/publish/do_113608912778960896127", + "time": 844, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 844 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "113133ef-244f-46fc-b030-cf127e224ceb", + "name": "Youtube Content Publish", + "url": "http://localhost:9000/collection/v4/publish/do_113608912782786560132", + "time": 56, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 56 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "ab646ab4-85c5-4faf-867b-efb9f88f3154", + "name": "Plugin Publish", + "url": "http://localhost:9000/collection/v4/publish/org.ekstep.summary-test", + "time": 35, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in positive scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"successful\"": { + "pass": 1, + "fail": 0 + }, + "responseCode should be OK": { + "pass": 1, + "fail": 0 + }, + "Status code name has string OK": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 35 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Status code is 200": true, + "Verify keys and data type of the params in positive scenario": true, + "params.status should be \"successful\"": true, + "responseCode should be OK": true, + "Status code name has string OK": true + } + ] + }, + { + "id": "34908a0c-d5cf-48f9-9ab2-b851657949cf", + "name": "Invalid Content ID Publish", + "url": "http://localhost:9000/content/v4/publish/do_dummy_id", + "time": 37, + "responseCode": { + "code": 404, + "name": "Not Found" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 404": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 404": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 37 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 404": true + } + ] + }, + { + "id": "e048689b-3df0-4b72-a024-1b032090d353", + "name": "Invalid Collection ID Publish", + "url": "http://localhost:9000/collection/v4/publish/do_dummy_id", + "time": 34, + "responseCode": { + "code": 404, + "name": "Not Found" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 404": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 404": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 34 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 404": true + } + ] + }, + { + "id": "328e19c8-84f4-4a47-95d0-a4631db50b02", + "name": "PDF Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912770859008118", + "time": 49, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 49 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "371f42d7-4e91-467f-8dbd-700cc34982f1", + "name": "MP4 Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912772677632120", + "time": 80, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 80 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "e7e6b6d1-6312-4411-8231-59fa776f59cb", + "name": "WEBM Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912774955008122", + "time": 62, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 62 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "912c062c-8fe3-4159-b6fd-8b90c8fb1f10", + "name": "HTML Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912776773632124", + "time": 94, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 94 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "bfe28b75-08c8-4082-8bd4-3e7aa685c066", + "name": "H5P Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912778272768126", + "time": 48, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 48 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "78fe24b6-8442-426d-9ba9-fd968bbc2595", + "name": "EPUB Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912782188544131", + "time": 51, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 51 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "3125afd5-c8c4-4818-915f-0d1ad0b7ed9f", + "name": "Youtube Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912783646720133", + "time": 48, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 48 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "53dbf026-9d1d-4ee4-b80f-ff42a0dfb501", + "name": "Plugin Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/test-plugin", + "time": 43, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 43 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "2d04e34f-860a-43ae-b076-4c3b5a26363c", + "name": "Collection Publish without hierarchy", + "url": "http://localhost:9000/collection/v4/publish/do_113608912768622592116", + "time": 50, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws ERR_COLLECTION_REVIEW": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_COLLECTION_REVIEW": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 50 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws ERR_COLLECTION_REVIEW": true + } + ] + }, + { + "id": "b4ac53d8-d142-4487-a779-e9686caf972e", + "name": "ECML Content Publish wo artifactUrl", + "url": "http://localhost:9000/content/v4/publish/do_113608912780697600129", + "time": 43, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 43 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + }, + { + "id": "203d51fd-1ed1-48f3-8c53-dee83997cf6a", + "name": "ECML Content Publish invalid Body", + "url": "http://localhost:9000/content/v4/publish/do_113608912779886592128", + "time": 61, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + }, + "testPassFailCounts": { + "Content-Type header is present": { + "pass": 1, + "fail": 0 + }, + "Content-Type header is application/json": { + "pass": 1, + "fail": 0 + }, + "Validate keys and data type of the response body": { + "pass": 1, + "fail": 0 + }, + "Verify keys and data type of the params in negative scenario": { + "pass": 1, + "fail": 0 + }, + "params.status should be \"failed\"": { + "pass": 1, + "fail": 0 + }, + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws CLIENT_ERROR": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 61 + ], + "allTests": [ + { + "Content-Type header is present": true, + "Content-Type header is application/json": true, + "Validate keys and data type of the response body": true, + "Verify keys and data type of the params in negative scenario": true, + "params.status should be \"failed\"": true, + "Status code is 400": true, + "Response throws CLIENT_ERROR": true + } + ] + } + ], + "count": 1, + "totalTime": 4150, + "collection": { + "requests": [ + { + "id": "80fd9644-56d3-4eb5-910f-c2f9a6bbcc39", + "method": "POST" + }, + { + "id": "7c5475c1-7c6a-4ca5-b71f-37b05e719446", + "method": "POST" + }, + { + "id": "f00000f4-e316-4081-a994-ac9078ff9a1b", + "method": "POST" + }, + { + "id": "edfc8942-03f2-4b49-81d6-c29a1a01d2cb", + "method": "POST" + }, + { + "id": "13c92a31-a1b0-4bd1-95a8-e1e46af2e61f", + "method": "POST" + }, + { + "id": "637502c0-3bd9-427b-997e-d01372a846c5", + "method": "POST" + }, + { + "id": "e4adecc9-606a-4091-b4c1-e3d2e655c370", + "method": "POST" + }, + { + "id": "c0c3b560-fb40-4e22-accb-74498265940f", + "method": "POST" + }, + { + "id": "8bb660d5-4a55-42ec-9f63-285fddf01712", + "method": "POST" + }, + { + "id": "8ea033c2-ced7-4189-b1a9-d4ffa3e20196", + "method": "POST" + }, + { + "id": "6df047f6-2ac2-4967-949c-f10d9f6decb4", + "method": "POST" + }, + { + "id": "e4cee867-b30a-4426-b314-c81d8f28cb82", + "method": "POST" + }, + { + "id": "ebe40740-4050-43ce-a316-892100ca0676", + "method": "POST" + }, + { + "id": "2418c40f-9b7f-4e6e-90fe-9f0b3c04537d", + "method": "POST" + }, + { + "id": "87ac52e6-5672-4198-b13c-01fd45cb3db5", + "method": "POST" + }, + { + "id": "8cd499ee-3bcd-4efe-ada5-92b5f5ece200", + "method": "POST" + }, + { + "id": "b339d20a-19ed-4281-9831-c10c6383e386", + "method": "POST" + }, + { + "id": "869a5263-7711-4c53-bc38-0da493f4ece2", + "method": "POST" + }, + { + "id": "d71c64ed-ab39-477e-95de-9eeea47b7986", + "method": "POST" + }, + { + "id": "45065a85-6bf9-4cb5-9acc-2c06345f8a26", + "method": "POST" + }, + { + "id": "5a9bc533-ecb7-4fb8-ae48-75ea2180b040", + "method": "POST" + }, + { + "id": "b5dd8a58-9ab1-4833-b8bb-564eda36cbc9", + "method": "POST" + }, + { + "id": "f2342494-ae32-4093-8048-f852ad38223b", + "method": "POST" + }, + { + "id": "d7dcfe64-e0d3-48aa-a4ce-121f19eac58e", + "method": "POST" + }, + { + "id": "79327a95-1346-4635-b8ab-a3427ff9d278", + "method": "POST" + }, + { + "id": "e203fc85-ac81-43d1-b744-054688acf98a", + "method": "POST" + }, + { + "id": "1f9def38-d148-49cc-a056-14bf1d72442f", + "method": "POST" + }, + { + "id": "af6b95b5-5466-4b36-bbf3-5e9762d900d0", + "method": "POST" + }, + { + "id": "1ac93190-744e-491e-aacd-cf8204b6a073", + "method": "POST" + }, + { + "id": "9a2bbcf9-89d1-4af6-94a2-42c87774cdbf", + "method": "POST" + }, + { + "id": "113133ef-244f-46fc-b030-cf127e224ceb", + "method": "POST" + }, + { + "id": "ab646ab4-85c5-4faf-867b-efb9f88f3154", + "method": "POST" + }, + { + "id": "34908a0c-d5cf-48f9-9ab2-b851657949cf", + "method": "POST" + }, + { + "id": "e048689b-3df0-4b72-a024-1b032090d353", + "method": "POST" + }, + { + "id": "328e19c8-84f4-4a47-95d0-a4631db50b02", + "method": "POST" + }, + { + "id": "371f42d7-4e91-467f-8dbd-700cc34982f1", + "method": "POST" + }, + { + "id": "e7e6b6d1-6312-4411-8231-59fa776f59cb", + "method": "POST" + }, + { + "id": "912c062c-8fe3-4159-b6fd-8b90c8fb1f10", + "method": "POST" + }, + { + "id": "bfe28b75-08c8-4082-8bd4-3e7aa685c066", + "method": "POST" + }, + { + "id": "78fe24b6-8442-426d-9ba9-fd968bbc2595", + "method": "POST" + }, + { + "id": "3125afd5-c8c4-4818-915f-0d1ad0b7ed9f", + "method": "POST" + }, + { + "id": "53dbf026-9d1d-4ee4-b80f-ff42a0dfb501", + "method": "POST" + }, + { + "id": "2d04e34f-860a-43ae-b076-4c3b5a26363c", + "method": "POST" + }, + { + "id": "b4ac53d8-d142-4487-a779-e9686caf972e", + "method": "POST" + }, + { + "id": "203d51fd-1ed1-48f3-8c53-dee83997cf6a", + "method": "POST" + } + ] + } +} \ No newline at end of file diff --git a/content-api/api-tests/Reports/Release DIAL Code API.postman_test_run.json b/content-api/api-tests/Reports/Release DIAL Code API.postman_test_run.json new file mode 100644 index 000000000..0595d0940 --- /dev/null +++ b/content-api/api-tests/Reports/Release DIAL Code API.postman_test_run.json @@ -0,0 +1,488 @@ +{ + "id": "0f65eca4-84c1-4ad3-9ca7-4c0c035fe6a1", + "name": "Release DIAL Code API", + "timestamp": "2022-09-07T11:58:49.914Z", + "collection_id": "13387833-d76732b8-56b7-4a54-84f1-4c43e694dcd9", + "folder_id": 0, + "environment_id": "0e0b136d-70cc-437e-a0df-ccba162408d9", + "totalPass": 21, + "totalFail": 0, + "results": [ + { + "id": "32d3736c-e0f7-4d97-9230-4a4c8d8a80eb", + "name": "Collection Create", + "url": "http://localhost:9000/content/v4/create", + "time": 49, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Status code is 200": true + }, + "testPassFailCounts": { + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 49 + ], + "allTests": [ + { + "Status code is 200": true + } + ] + }, + { + "id": "ce3e135b-72fc-4561-badc-5094ecab1ab2", + "name": "Collection Create wo reserved DIAL codes", + "url": "http://localhost:9000/content/v4/create", + "time": 28, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Status code is 200": true + }, + "testPassFailCounts": { + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 28 + ], + "allTests": [ + { + "Status code is 200": true + } + ] + }, + { + "id": "1f0520aa-3f59-4c3e-be73-2574ea09a123", + "name": "TOC Upload", + "url": "http://localhost:9000/collection/v4/import/do_113619625412968448149", + "time": 533, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Status code is 200": true + }, + "testPassFailCounts": { + "Status code is 200": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 533 + ], + "allTests": [ + { + "Status code is 200": true + } + ] + }, + { + "id": "c7ebfb77-7f9e-483b-afd6-4b6b44067e8b", + "name": "Reserve DIAL code", + "url": "http://localhost:9000/collection/v4/dialcode/reserve/do_113619625412968448149", + "time": 1702, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": {}, + "testPassFailCounts": {}, + "times": [ + 1702 + ], + "allTests": [ + {} + ] + }, + { + "id": "5a0c02b8-ab74-4d12-9ce3-06ba874311b9", + "name": "Link DIAL code", + "url": "http://localhost:9000/collection/v4/dialcode/link/do_113619625412968448149", + "time": 199, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": {}, + "testPassFailCounts": {}, + "times": [ + 199 + ], + "allTests": [ + {} + ] + }, + { + "id": "48eaac17-ecf6-45e2-ad72-b95ef26d9e55", + "name": "Release DIAL code", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625412968448149", + "time": 101, + "responseCode": { + "code": 200, + "name": "OK" + }, + "tests": { + "Status code is 200": true, + "Response returns with reservedDialcodes with one less": true + }, + "testPassFailCounts": { + "Status code is 200": { + "pass": 1, + "fail": 0 + }, + "Response returns with reservedDialcodes with one less": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 101 + ], + "allTests": [ + { + "Status code is 200": true, + "Response returns with reservedDialcodes with one less": true + } + ] + }, + { + "id": "cec90850-4020-4b24-a4f3-76b2c52b9da6", + "name": "Release DIAL code Invalid Channel Id header", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625412968448149", + "time": 24, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Status code is 400": true, + "Response throws ERR_INVALID_CHANNEL": true + }, + "testPassFailCounts": { + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_INVALID_CHANNEL": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 24 + ], + "allTests": [ + { + "Status code is 400": true, + "Response throws ERR_INVALID_CHANNEL": true + } + ] + }, + { + "id": "60202782-e345-4c4c-8f1e-939cd7ee8f0b", + "name": "Release DIAL code with Zero count", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625412968448149", + "time": 30, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Status code is 400": true, + "Response throws ERR_INVALID_COUNT_RANGE": true + }, + "testPassFailCounts": { + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_INVALID_COUNT_RANGE": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 30 + ], + "allTests": [ + { + "Status code is 400": true, + "Response throws ERR_INVALID_COUNT_RANGE": true + } + ] + }, + { + "id": "28f49920-9a42-441b-90b6-34260a2cd834", + "name": "Release DIAL code with negative count", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625412968448149", + "time": 31, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Status code is 400": true, + "Response throws ERR_INVALID_COUNT_RANGE": true + }, + "testPassFailCounts": { + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_INVALID_COUNT_RANGE": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 31 + ], + "allTests": [ + { + "Status code is 400": true, + "Response throws ERR_INVALID_COUNT_RANGE": true + } + ] + }, + { + "id": "b0dd02cf-d5b8-44bb-acd7-367bdc5f9592", + "name": "Release DIAL code with count greater than max limit(250)", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625412968448149", + "time": 35, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Status code is 400": true, + "Response throws ERR_INVALID_COUNT_RANGE": true + }, + "testPassFailCounts": { + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_INVALID_COUNT_RANGE": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 35 + ], + "allTests": [ + { + "Status code is 400": true, + "Response throws ERR_INVALID_COUNT_RANGE": true + } + ] + }, + { + "id": "208caab7-3f00-47ab-ae97-838e9b4815b4", + "name": "Release DIAL code with invalid collection Id", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_dummy_id", + "time": 35, + "responseCode": { + "code": 404, + "name": "Not Found" + }, + "tests": { + "Status code is 404": true, + "Response throws RESOURCE_NOT_FOUND": true + }, + "testPassFailCounts": { + "Status code is 404": { + "pass": 1, + "fail": 0 + }, + "Response throws RESOURCE_NOT_FOUND": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 35 + ], + "allTests": [ + { + "Status code is 404": true, + "Response throws RESOURCE_NOT_FOUND": true + } + ] + }, + { + "id": "9a169a58-785e-468e-b8fe-014b0d3898d9", + "name": "Release DIAL code for collection wo reserved DIAL codes", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625413853184150", + "time": 55, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Status code is 400": true, + "Response throws ERR_CONTENT_MISSING_RESERVED_DIAL_CODES": true + }, + "testPassFailCounts": { + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_CONTENT_MISSING_RESERVED_DIAL_CODES": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 55 + ], + "allTests": [ + { + "Status code is 400": true, + "Response throws ERR_CONTENT_MISSING_RESERVED_DIAL_CODES": true + } + ] + }, + { + "id": "5d662783-fe26-41db-a2b6-66ed08be9430", + "name": "Release DIAL code with count greater than reserved DIAL codes count", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625412968448149", + "time": 31, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Status code is 400": true, + "Response throws ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES": true + }, + "testPassFailCounts": { + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 31 + ], + "allTests": [ + { + "Status code is 400": true, + "Response throws ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES": true + } + ] + }, + { + "id": "2610536f-2c69-41c1-be92-6df6b4a153dc", + "name": "Release DIAL code with count same as linked DIAL codes", + "url": "http://localhost:9000/collection/v4/dialcode/release/do_113619625412968448149", + "time": 89, + "responseCode": { + "code": 400, + "name": "Bad Request" + }, + "tests": { + "Status code is 400": true, + "Response throws ERR_ALL_DIALCODES_UTILIZED": true + }, + "testPassFailCounts": { + "Status code is 400": { + "pass": 1, + "fail": 0 + }, + "Response throws ERR_ALL_DIALCODES_UTILIZED": { + "pass": 1, + "fail": 0 + } + }, + "times": [ + 89 + ], + "allTests": [ + { + "Status code is 400": true, + "Response throws ERR_ALL_DIALCODES_UTILIZED": true + } + ] + } + ], + "count": 1, + "totalTime": 2942, + "collection": { + "requests": [ + { + "id": "32d3736c-e0f7-4d97-9230-4a4c8d8a80eb", + "method": "POST" + }, + { + "id": "ce3e135b-72fc-4561-badc-5094ecab1ab2", + "method": "POST" + }, + { + "id": "1f0520aa-3f59-4c3e-be73-2574ea09a123", + "method": "POST" + }, + { + "id": "c7ebfb77-7f9e-483b-afd6-4b6b44067e8b", + "method": "POST" + }, + { + "id": "5a0c02b8-ab74-4d12-9ce3-06ba874311b9", + "method": "POST" + }, + { + "id": "48eaac17-ecf6-45e2-ad72-b95ef26d9e55", + "method": "POST" + }, + { + "id": "cec90850-4020-4b24-a4f3-76b2c52b9da6", + "method": "POST" + }, + { + "id": "60202782-e345-4c4c-8f1e-939cd7ee8f0b", + "method": "POST" + }, + { + "id": "28f49920-9a42-441b-90b6-34260a2cd834", + "method": "POST" + }, + { + "id": "b0dd02cf-d5b8-44bb-acd7-367bdc5f9592", + "method": "POST" + }, + { + "id": "208caab7-3f00-47ab-ae97-838e9b4815b4", + "method": "POST" + }, + { + "id": "9a169a58-785e-468e-b8fe-014b0d3898d9", + "method": "POST" + }, + { + "id": "5d662783-fe26-41db-a2b6-66ed08be9430", + "method": "POST" + }, + { + "id": "2610536f-2c69-41c1-be92-6df6b4a153dc", + "method": "POST" + } + ] + } +} \ No newline at end of file diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala index 16ebcc64d..89d19882f 100644 --- a/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala +++ b/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala @@ -4,6 +4,7 @@ import java.util import java.util.concurrent.CompletionException import java.io.File import org.apache.commons.io.FilenameUtils + import javax.inject.Inject import org.apache.commons.lang3.StringUtils import org.sunbird.`object`.importer.{ImportConfig, ImportManager} @@ -15,6 +16,7 @@ import org.sunbird.common.{ContentParams, Platform, Slug} import org.sunbird.common.dto.{Request, Response, ResponseHandler} import org.sunbird.common.exception.ClientException import org.sunbird.content.dial.DIALManager +import org.sunbird.content.publish.mgr.PublishManager import org.sunbird.content.review.mgr.ReviewManager import org.sunbird.util.RequestUtil import org.sunbird.content.upload.mgr.UploadManager @@ -49,10 +51,13 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe case "flagContent" => flag(request) case "acceptFlag" => acceptFlag(request) case "linkDIALCode" => linkDIALCode(request) + case "reserveDialCode" => reserveDialCode(request) + case "releaseDialCode" => releaseDialCode(request) case "importContent" => importContent(request) case "systemUpdate" => systemUpdate(request) case "reviewContent" => reviewContent(request) case "rejectContent" => rejectContent(request) + case "publishContent" => publishContent(request) case _ => ERROR(request.getOperation) } } @@ -61,7 +66,7 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe populateDefaultersForCreation(request) RequestUtil.restrictProperties(request) DataNode.create(request, dataModifier).map(node => { - ResponseHandler.OK.put("identifier", node.getIdentifier).put("node_id", node.getIdentifier) + ResponseHandler.OK.put(ContentConstants.IDENTIFIER, node.getIdentifier).put("node_id", node.getIdentifier) .put("versionKey", node.getMetadata.get("versionKey")) }) } @@ -72,7 +77,7 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe request.getRequest.put("fields", fields) DataNode.read(request).map(node => { val metadata: util.Map[String, AnyRef] = NodeUtil.serialize(node, fields, node.getObjectType.toLowerCase.replace("image", ""), request.getContext.get("version").asInstanceOf[String]) - metadata.put("identifier", node.getIdentifier.replace(".img", "")) + metadata.put(ContentConstants.IDENTIFIER, node.getIdentifier.replace(".img", "")) val response: Response = ResponseHandler.OK if (responseSchemaName.isEmpty) { response.put("content", metadata) @@ -96,7 +101,7 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe if (StringUtils.isBlank(request.getRequest.getOrDefault("channel", "").asInstanceOf[String])) throw new ClientException("ERR_INVALID_CHANNEL", "Please Provide Channel!") DataNode.read(request).map(node => { val metadata: util.Map[String, AnyRef] = NodeUtil.serialize(node, fields, node.getObjectType.toLowerCase.replace("image", ""), request.getContext.get("version").asInstanceOf[String]) - metadata.put("identifier", node.getIdentifier.replace(".img", "")) + metadata.put(ContentConstants.IDENTIFIER, node.getIdentifier.replace(".img", "")) val response: Response = ResponseHandler.OK if (StringUtils.equalsIgnoreCase(metadata.getOrDefault("channel", "").asInstanceOf[String],request.getRequest.getOrDefault("channel", "").asInstanceOf[String])) { if (responseSchemaName.isEmpty) { @@ -119,19 +124,19 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe RequestUtil.restrictProperties(request) DataNode.update(request, dataModifier).map(node => { val identifier: String = node.getIdentifier.replace(".img", "") - ResponseHandler.OK.put("node_id", identifier).put("identifier", identifier) + ResponseHandler.OK.put("node_id", identifier).put(ContentConstants.IDENTIFIER, identifier) .put("versionKey", node.getMetadata.get("versionKey")) }) } def upload(request: Request): Future[Response] = { - val identifier: String = request.getContext.getOrDefault("identifier", "").asInstanceOf[String] + val identifier: String = request.getContext.getOrDefault(ContentConstants.IDENTIFIER, "").asInstanceOf[String] val readReq = new Request(request) - readReq.put("identifier", identifier) + readReq.put(ContentConstants.IDENTIFIER, identifier) readReq.put("fields", new util.ArrayList[String]) DataNode.read(readReq).map(node => { if (null != node & StringUtils.isNotBlank(node.getObjectType)) - request.getContext.put("schemaName", node.getObjectType.toLowerCase()) + request.getContext.put(ContentConstants.SCHEMA_NAME, node.getObjectType.toLowerCase()) UploadManager.upload(request, node) }).flatMap(f => f) } @@ -146,14 +151,14 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe val fileName: String = request.get("fileName").asInstanceOf[String] val filePath: String = request.getRequest.getOrDefault("filePath","").asInstanceOf[String] .replaceAll("^/+|/+$", "") - val identifier: String = request.get("identifier").asInstanceOf[String] + val identifier: String = request.get(ContentConstants.IDENTIFIER).asInstanceOf[String] validatePreSignedUrlRequest(`type`, fileName, filePath) DataNode.read(request).map(node => { val objectKey = if (StringUtils.isEmpty(filePath)) "content" + File.separator + `type` + File.separator + identifier + File.separator + Slug.makeSlug(fileName, true) else filePath + File.separator + "content" + File.separator + `type` + File.separator + identifier + File.separator + Slug.makeSlug(fileName, true) val expiry = Platform.config.getString("cloud_storage.upload.url.ttl") val preSignedURL = ss.getSignedURL(objectKey, Option.apply(expiry.toInt), Option.apply("w")) - ResponseHandler.OK().put("identifier", identifier).put("pre_signed_url", preSignedURL) + ResponseHandler.OK().put(ContentConstants.IDENTIFIER, identifier).put("pre_signed_url", preSignedURL) .put("url_expiry", expiry) }) recoverWith { case e: CompletionException => throw e.getCause } } @@ -176,22 +181,45 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe def linkDIALCode(request: Request): Future[Response] = DIALManager.link(request) + def reserveDialCode(request: Request): Future[Response] = DIALManager.reserveOrRelease(request, ContentConstants.RESERVE) + + def releaseDialCode(request: Request): Future[Response] = DIALManager.reserveOrRelease(request, ContentConstants.RELEASE) + def importContent(request: Request): Future[Response] = importMgr.importObject(request) def reviewContent(request: Request): Future[Response] = { - val identifier: String = request.getContext.getOrDefault("identifier", "").asInstanceOf[String] + val identifier: String = request.getContext.getOrDefault(ContentConstants.IDENTIFIER, "").asInstanceOf[String] val readReq = new Request(request) - readReq.put("identifier", identifier) - readReq.put("mode", "edit") + readReq.put(ContentConstants.IDENTIFIER, identifier) + readReq.put(ContentConstants.MODE, ContentConstants.EDIT_MODE) DataNode.read(readReq).map(node => { if (null != node & StringUtils.isNotBlank(node.getObjectType)) - request.getContext.put("schemaName", node.getObjectType.toLowerCase()) - if (StringUtils.equalsAnyIgnoreCase("Processing", node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + request.getContext.put(ContentConstants.SCHEMA_NAME, node.getObjectType.toLowerCase()) + if (StringUtils.equalsAnyIgnoreCase(ContentConstants.PROCESSING, node.getMetadata.getOrDefault(ContentConstants.STATUS, "").asInstanceOf[String])) throw new ClientException("ERR_NODE_ACCESS_DENIED", "Review Operation Can't Be Applied On Node Under Processing State") else ReviewManager.review(request, node) }).flatMap(f => f) } + def publishContent(request: Request): Future[Response] = { + val identifier: String = request.getContext.getOrDefault(ContentConstants.IDENTIFIER, "").asInstanceOf[String] + val publisher: String = request.getRequest.getOrDefault(ContentConstants.LAST_PUBLISHED_BY, "").asInstanceOf[String] + + if(publisher.isBlank) throw new ClientException("ERR_CONTENT_BLANK_PUBLISHER", "Publisher User Id is blank") + + val readReq = new Request(request) + readReq.put(ContentConstants.IDENTIFIER, identifier) + readReq.put(ContentConstants.MODE, ContentConstants.EDIT_MODE) + DataNode.read(readReq).map(node => { + if (null != node & StringUtils.isNotBlank(node.getObjectType)) + request.getContext.put(ContentConstants.SCHEMA_NAME, node.getObjectType.toLowerCase()) + if (StringUtils.equalsAnyIgnoreCase(ContentConstants.PROCESSING, node.getMetadata.getOrDefault(ContentConstants.STATUS, "").asInstanceOf[String])) + throw new ClientException("ERR_NODE_ACCESS_DENIED", "Publish Operation Can't Be Applied On Node Under Processing State") + node.getMetadata.put(ContentConstants.LAST_PUBLISHED_BY, publisher) + PublishManager.publish(request, node) + }).flatMap(f => f) + } + def populateDefaultersForCreation(request: Request) = { setDefaultsBasedOnMimeType(request, ContentParams.create.name) setDefaultLicense(request) @@ -243,6 +271,11 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe "Yes".equalsIgnoreCase(node.getMetadata.getOrDefault("trackable", new java.util.HashMap[String, AnyRef]).asInstanceOf[java.util.Map[String, AnyRef]].getOrDefault("enabled", "").asInstanceOf[String])) { node.getMetadata.put("contentType", "Course") } + + //TODO: Below fix to be reviewed when the fix for null to Stringify in ExternalStore.scala is implemented + if(node.getExternalData != null && node.getExternalData.containsKey("relational_metadata") && node.getExternalData.get("relational_metadata") == null) { + node.getExternalData.put("relational_metadata", "{}") + } node } @@ -257,7 +290,7 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe } def systemUpdate(request: Request): Future[Response] = { - val identifier = request.getContext.get("identifier").asInstanceOf[String] + val identifier = request.getContext.get(ContentConstants.IDENTIFIER).asInstanceOf[String] RequestUtil.validateRequest(request) RedisCache.delete(hierarchyPrefix + request.get("rootId")) @@ -275,21 +308,21 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe else DataNode.systemUpdate(request, response,"", None) }).map(node => { - ResponseHandler.OK.put("identifier", identifier).put("status", "success") + ResponseHandler.OK.put(ContentConstants.IDENTIFIER, identifier).put(ContentConstants.STATUS, "success") }) } def rejectContent(request: Request): Future[Response] = { RequestUtil.validateRequest(request) DataNode.read(request).map(node => { - val status = node.getMetadata.get("status").asInstanceOf[String] + val status = node.getMetadata.get(ContentConstants.STATUS).asInstanceOf[String] if (StringUtils.isBlank(status)) throw new ClientException("ERR_METADATA_ISSUE", "Content metadata error, status is blank for identifier:" + node.getIdentifier) if (StringUtils.equals("Review", status)) { - request.getRequest.put("status", "Draft") + request.getRequest.put(ContentConstants.STATUS, "Draft") request.getRequest.put("prevStatus", "Review") } else if (StringUtils.equals("FlagReview", status)) { - request.getRequest.put("status", "FlagDraft") + request.getRequest.put(ContentConstants.STATUS, "FlagDraft") request.getRequest.put("prevStatus", "FlagReview") } else new ClientException("ERR_INVALID_REQUEST", "Content not in Review status.") @@ -300,7 +333,7 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe RequestUtil.restrictProperties(request) DataNode.update(request).map(node => { val identifier: String = node.getIdentifier.replace(".img", "") - ResponseHandler.OK.put("node_id", identifier).put("identifier", identifier) + ResponseHandler.OK.put("node_id", identifier).put(ContentConstants.IDENTIFIER, identifier) }) }).flatMap(f => f) } diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALConstants.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALConstants.scala index be127079b..6d6c99e25 100644 --- a/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALConstants.scala +++ b/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALConstants.scala @@ -16,5 +16,13 @@ object DIALConstants { val AUTHORIZATION: String = "Authorization" val X_CHANNEL_ID: String = "X-Channel-Id" val VERSION_KEY: String = "versionKey" - + val RESERVED_DIALCODES: String = "reservedDialcodes" + val DISCUSSION_FORUM: String = "discussionForum" + val CREDENTIALS: String = "credentials" + val TRACKABLE: String = "trackable" + val PROCESS_ID: String = "processId" + val PUBLISHER: String = "publisher" + val BATCH_CODE: String = "batchCode" + val LIVE_STATUS: String = "Live" + val UNLISTED_STATUS: String = "Unlisted" } \ No newline at end of file diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALErrors.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALErrors.scala index 8d70cfc7c..c96e00f5e 100644 --- a/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALErrors.scala +++ b/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALErrors.scala @@ -5,6 +5,19 @@ object DIALErrors { //Error Codes val ERR_DIALCODE_LINK_REQUEST: String = "ERR_DIALCODE_LINK_REQUEST" val ERR_DIALCODE_LINK: String = "ERR_DIALCODE_LINK" + val ERR_INVALID_CHANNEL: String = "ERR_INVALID_CHANNEL" + val ERR_CONTENT_BLANK_OBJECT_ID: String = "ERR_CONTENT_BLANK_OBJECT_ID" + val ERR_CONTENT_MIMETYPE: String = "ERR_CONTENT_MIMETYPE" + val ERR_INVALID_COUNT: String = "ERR_INVALID_COUNT" + val ERR_INVALID_COUNT_RANGE: String = "ERR_INVALID_COUNT_RANGE" + val ERR_CONTENT_INVALID_OBJECT: String = "ERR_CONTENT_INVALID_OBJECT" + val ERR_DUPLICATE_DIAL_CODES: String = "ERR_DUPLICATE_DIAL_CODES" + val ERR_DIALCODE_CONTENT_LINK_FIELDS_MISSING: String = "ERR_DIALCODE_CONTENT_LINK_FIELDS_MISSING" + val ERR_CONTENT_RETIRED_OBJECT_ID: String = "ERR_CONTENT_RETIRED_OBJECT_ID" + val ERR_CONTENT_MISSING_RESERVED_DIAL_CODES: String = "ERR_CONTENT_MISSING_RESERVED_DIAL_CODES" + val ERR_ALL_DIALCODES_UTILIZED: String = "ERR_ALL_DIALCODES_UTILIZED" + val ERR_INVALID_OPERATION: String = "ERR_INVALID_OPERATION" + val ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES: String = "ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES" //Error Messages val ERR_INVALID_REQ_MSG: String = "Invalid Request! Please Provide Valid Request." @@ -13,4 +26,20 @@ object DIALErrors { val ERR_DIAL_NOT_FOUND_MSG: String = "DIAL Code Not Found With Id(s): " val ERR_CONTENT_NOT_FOUND_MSG: String = "Content Not Found With Id(s): " val ERR_SERVER_ERROR_MSG: String = "Something Went Wrong While Processing Your Request. Please Try Again After Sometime!" + val ERR_INVALID_CHANNEL_MSG: String = "Invalid Channel Id." + val ERR_CONTENT_BLANK_OBJECT_ID_MSG: String = "Content Id cannot be Blank." + val ERR_CONTENT_MIMETYPE_MSG: String = "Invalid mimeType." + val ERR_INVALID_COUNT_MSG: String = "Invalid dialcode count." + val ERR_INVALID_COUNT_RANGE_MSG: String = "Invalid dialcode count range. It should be between 1 to " + val ERR_DIAL_GEN_LIST_EMPTY_MSG: String = "Dialcode generated list is empty. Please Try Again After Sometime!" + val ERR_DIAL_GENERATION_MSG: String = "Error During generate Dialcode. Please Try Again After Sometime!" + val ERR_DIAL_INVALID_COUNT_RESPONSE = "No new DIAL Codes have been generated, as requested count is less or equal to existing reserved dialcode count." + val ERR_CONTENT_INVALID_OBJECT_MSG = "Invalid Request. Cannot update 'Live' content." + val ERR_DUPLICATE_DIAL_CODES_MSG: String = "QR Code should not be linked to multiple contents. Please validate: " + val ERR_DIALCODE_CONTENT_LINK_FIELDS_MISSING_MSG: String = "Required fields for content link dialcode are missing: " + val ERR_CONTENT_RETIRED_OBJECT_ID_MSG: String = "Invalid Request. Cannot update 'Retired' content." + val ERR_CONTENT_MISSING_RESERVED_DIAL_CODES_MSG: String = "Invalid Request. Content does not have reserved DIAL codes." + val ERR_ALL_DIALCODES_UTILIZED_MSG: String = "Error! All Reserved DIAL Codes are Utilized." + val ERR_INVALID_OPERATION_MSG: String = "Invalid operation request!" + val ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES_MSG: String = "Invalid Request. Count greater than reserved DIAL codes." } diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALManager.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALManager.scala index 487ac475c..2bffec273 100644 --- a/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALManager.scala +++ b/content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALManager.scala @@ -3,21 +3,27 @@ package org.sunbird.content.dial import org.apache.commons.lang3.StringUtils import org.sunbird.common.Platform import org.sunbird.common.dto.{Request, Response, ResponseHandler} -import org.sunbird.common.exception.{ClientException, ErrorCodes, ResourceNotFoundException, ResponseCode, ServerException} +import org.sunbird.common.exception._ +import org.sunbird.content.util.ContentConstants import org.sunbird.graph.OntologyEngineContext import org.sunbird.graph.dac.model.Node import org.sunbird.graph.nodes.DataNode +import org.sunbird.graph.utils.ScalaJsonUtils +import org.sunbird.managers.HierarchyManager +import org.sunbird.telemetry.logger.TelemetryManager + import java.util -import scala.collection.immutable.HashMap import scala.collection.JavaConverters._ +import scala.collection.immutable.{HashMap, Map} import scala.concurrent.{ExecutionContext, Future} object DIALManager { - val DIAL_SEARCH_API_URL = Platform.config.getString("dial_service.api.base_url") + "/dialcode/v3/search" - val DIAL_API_AUTH_KEY = "Bearer " + Platform.config.getString("dial_service.api.auth_key") - val PASSPORT_KEY = Platform.config.getString("graph.passport.key.base") + val DIAL_SEARCH_API_URL: String = Platform.config.getString("dial_service.api.base_url") + Platform.config.getString("dial_service.api.search") + val DIALCODE_GENERATE_URI: String = Platform.config.getString("dial_service.api.base_url") + Platform.config.getString("dial_service.api.generate") + val DIAL_API_AUTH_KEY: String = ContentConstants.BEARER + Platform.config.getString("dial_service.api.auth_key") + val PASSPORT_KEY: String = Platform.config.getString("graph.passport.key.base") def link(request: Request)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = { val linkType: String = request.getContext.getOrDefault(DIALConstants.LINK_TYPE, DIALConstants.CONTENT).asInstanceOf[String] @@ -52,13 +58,13 @@ object DIALManager { def validateAndGetRequestMap(channelId: String, requestList: List[Map[String, List[String]]])(implicit oec:OntologyEngineContext): Map[String, List[String]] = { var reqMap = HashMap[String, List[String]]() requestList.foreach(req => { - val contents: List[String] = req.get(DIALConstants.IDENTIFIER).get - val dialcodes: List[String] = req.get(DIALConstants.DIALCODE).get + val contents: List[String] = if(req.contains(DIALConstants.IDENTIFIER)) req(DIALConstants.IDENTIFIER) else throw new ClientException(DIALErrors.ERR_DIALCODE_CONTENT_LINK_FIELDS_MISSING, DIALErrors.ERR_DIALCODE_CONTENT_LINK_FIELDS_MISSING_MSG + DIALConstants.IDENTIFIER) + val dialcodes: List[String] = if(req.contains(DIALConstants.DIALCODE)) req(DIALConstants.DIALCODE) else throw new ClientException(DIALErrors.ERR_DIALCODE_CONTENT_LINK_FIELDS_MISSING, DIALErrors.ERR_DIALCODE_CONTENT_LINK_FIELDS_MISSING_MSG + DIALConstants.DIALCODE) validateReqStructure(dialcodes, contents) contents.foreach(id => reqMap += (id -> dialcodes)) }) if (Platform.getBoolean("content.link_dialcode.validation", true)) { - val dials = requestList.collect { case m if m.get(DIALConstants.DIALCODE).nonEmpty => m.get(DIALConstants.DIALCODE).get }.flatten + val dials = requestList.collect { case m if m.contains(DIALConstants.DIALCODE) => m(DIALConstants.DIALCODE) }.flatten validateDialCodes(channelId, dials) } reqMap @@ -73,7 +79,7 @@ object DIALManager { } def validateDialCodes(channelId: String, dialcodes: List[String])(implicit oec: OntologyEngineContext): Boolean = { - if (!dialcodes.isEmpty) { + if (dialcodes.nonEmpty) { val reqMap = new util.HashMap[String, AnyRef]() {{ put(DIALConstants.REQUEST, new util.HashMap[String, AnyRef]() {{ put(DIALConstants.SEARCH, new util.HashMap[String, AnyRef]() {{ @@ -81,9 +87,9 @@ object DIALManager { }}) }}) }} - val headerParam = HashMap[String, String](DIALConstants.X_CHANNEL_ID -> channelId, DIALConstants.AUTHORIZATION -> DIAL_API_AUTH_KEY).asJava + val headerParam = new util.HashMap[String, String]{put(DIALConstants.X_CHANNEL_ID, channelId); put(DIALConstants.AUTHORIZATION, DIAL_API_AUTH_KEY);} val searchResponse = oec.httpUtil.post(DIAL_SEARCH_API_URL, reqMap, headerParam) - if (searchResponse.getResponseCode.toString == "OK") { + if (searchResponse.getResponseCode.toString == ContentConstants.OK_RESPONSE_CODE) { val result = searchResponse.getResult if (dialcodes.distinct.size == result.get(DIALConstants.COUNT).asInstanceOf[Integer]) { return true @@ -101,7 +107,7 @@ object DIALManager { validateContents(requestMap, reqContext).map(result => { val futureList: List[Future[Node]] = requestMap.filter(x => !result.contains(x._1)).map(map => { val updateReqMap = new util.HashMap[String, AnyRef]() {{ - val dials: util.List[String] = if (!map._2.isEmpty) map._2.asJava else new util.ArrayList[String]() + val dials: util.List[String] = if (map._2.nonEmpty) map._2.asJava else new util.ArrayList[String]() put(DIALConstants.DIALCODES, dials) put(DIALConstants.VERSION_KEY, PASSPORT_KEY) }} @@ -116,11 +122,65 @@ object DIALManager { }).flatMap(f => f) } - //TODO: Complete the implementation - def linkCollection(objectId: String, requestMap: Map[String, List[String]], getContext: util.Map[String, AnyRef])(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = { - Future { - ResponseHandler.OK() - } + def linkCollection(objectId: String, requestMap: Map[String, List[String]], reqContext: util.Map[String, AnyRef])(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = { + val req = new Request() + req.setContext(reqContext) + req.put(ContentConstants.IDENTIFIER, objectId) + req.put(ContentConstants.MODE, ContentConstants.EDIT_MODE) + DataNode.read(req).flatMap(rootNode => { + val updateReq = getLinkUpdateRequest(req, rootNode, requestMap, objectId) + DataNode.update(updateReq).flatMap(response => { + req.getContext.put(ContentConstants.SCHEMA_NAME, ContentConstants.COLLECTION_SCHEMA_NAME) + req.getContext.put(ContentConstants.VERSION, ContentConstants.SCHEMA_VERSION) + req.put(ContentConstants.ROOT_ID, objectId) + HierarchyManager.getHierarchy(req).flatMap(getHierarchyResponse => { + val updatedChildrenHierarchy = getUpdatedChildrenHierarchy(getHierarchyResponse, requestMap) + val consolidatedUnitDIALMap = getConsolidatedUnitDIALMap(updatedChildrenHierarchy, requestMap, objectId) + validateDuplicateDIALCodes(consolidatedUnitDIALMap.filter(rec => rec._2.asInstanceOf[List[String]].nonEmpty)) + + val hierarchyReq = getHierarchyRequest(req, objectId, updatedChildrenHierarchy, rootNode) + oec.graphService.saveExternalProps(hierarchyReq).flatMap(rec => + getResponseCollectionLink(requestMap, consolidatedUnitDIALMap.keySet.toList, requestMap.keySet.diff(consolidatedUnitDIALMap.keySet).toList) + ) + }) + }) + }) + } + + def getUpdatedChildrenHierarchy(getHierarchyResponse: Response, requestMap: Map[String, List[String]]): List[util.Map[String, AnyRef]] = { + val collectionHierarchy = getHierarchyResponse.getResult.getOrDefault(ContentConstants.CONTENT, new java.util.HashMap[String, AnyRef]()).asInstanceOf[java.util.Map[String, AnyRef]] + val childrenHierarchy = collectionHierarchy.get(ContentConstants.CHILDREN).asInstanceOf[util.List[util.Map[String, AnyRef]]] + updateChildrenHierarchy(childrenHierarchy, requestMap) + } + + def getConsolidatedUnitDIALMap(updatedChildrenHierarchy: List[util.Map[String, AnyRef]], requestMap: Map[String, List[String]], objectId: String): Map[String, AnyRef] = { + val childrenDIALMap = getChildrenDIALMap(updatedChildrenHierarchy, requestMap) + if (!requestMap.contains(objectId)) childrenDIALMap else childrenDIALMap ++ Map(objectId -> requestMap(objectId)) + } + + def getHierarchyRequest(req: Request, objectId: String, updatedChildrenHierarchy: List[util.Map[String, AnyRef]], rootNode: Node): Request = { + val updatedHierarchy = new java.util.HashMap[String, AnyRef]() + updatedHierarchy.put(ContentConstants.IDENTIFIER, objectId) + updatedHierarchy.put(ContentConstants.CHILDREN, updatedChildrenHierarchy.asJava) + + val hierarchyReq = new Request(req) + hierarchyReq.put(ContentConstants.HIERARCHY, ScalaJsonUtils.serialize(updatedHierarchy)) + hierarchyReq.put(ContentConstants.IDENTIFIER, rootNode.getIdentifier) + + hierarchyReq + } + + def getLinkUpdateRequest(req: Request, rootNode: Node, requestMap: Map[String, List[String]], objectId: String): Request = { + val updateReq = new Request(req) + updateReq.put(ContentConstants.IDENTIFIER, rootNode.getIdentifier) + updateReq.put(DIALConstants.VERSION_KEY, rootNode.getMetadata.get("versionKey")) + + if(!requestMap.contains(objectId)) + updateReq.put(DIALConstants.DIALCODES, null) + else + updateReq.put(DIALConstants.DIALCODES, requestMap(objectId).toArray[String]) + + updateReq } def validateContents(requestMap: Map[String, List[String]], reqContext: util.Map[String, AnyRef])(implicit ec: ExecutionContext, oec:OntologyEngineContext): Future[List[String]] = { @@ -149,4 +209,275 @@ object DIALManager { }) } + def getResponseCollectionLink(requestMap: Map[String, List[String]], updatedUnits: List[String], invalidIds: List[String])(implicit ec: ExecutionContext): Future[Response] = { + val response = if (requestMap.keySet.size == updatedUnits.size) + ResponseHandler.OK + else if (invalidIds.nonEmpty && updatedUnits.isEmpty) + ResponseHandler.ERROR(ResponseCode.RESOURCE_NOT_FOUND, DIALErrors.ERR_DIALCODE_LINK, DIALErrors.ERR_CONTENT_NOT_FOUND_MSG + invalidIds.asJava) + else + ResponseHandler.ERROR(ResponseCode.PARTIAL_SUCCESS, DIALErrors.ERR_DIALCODE_LINK, DIALErrors.ERR_CONTENT_NOT_FOUND_MSG + invalidIds.asJava) + + Future(response) + } + + def updateChildrenHierarchy(childrenHierarchy: util.List[util.Map[String, AnyRef]], requestMap: Map[String, List[String]]): List[util.Map[String, AnyRef]] = { + childrenHierarchy.asScala.toList.map(child => { + if (requestMap.contains(child.get(ContentConstants.IDENTIFIER).toString) && StringUtils.equalsIgnoreCase(ContentConstants.PARENT, child.get(ContentConstants.VISIBILITY).toString)) { + if (requestMap.getOrElse(child.get(ContentConstants.IDENTIFIER).toString, List.empty).nonEmpty && requestMap(child.get(ContentConstants.IDENTIFIER).toString).exists(rec => rec.trim.nonEmpty)) + child.put(DIALConstants.DIALCODES, requestMap(child.get(ContentConstants.IDENTIFIER).toString)) + else + child.remove(DIALConstants.DIALCODES) + } + if(child.get(ContentConstants.CHILDREN)!=null) + updateChildrenHierarchy(child.get(ContentConstants.CHILDREN).asInstanceOf[util.List[util.Map[String, AnyRef]]], requestMap) + child + }) + } + + def getChildrenDIALMap(childrenHierarchy: List[util.Map[String, AnyRef]], requestMap: Map[String, List[String]]): Map[String, AnyRef] = { + childrenHierarchy.map(child => { + val subChildrenDIALMap = if(child.get(ContentConstants.CHILDREN)!=null) + getChildrenDIALMap(child.get(ContentConstants.CHILDREN).asInstanceOf[util.List[util.Map[String, AnyRef]]].asScala.toList, requestMap) + else Map.empty[String, String] + + val childDIALMap = if(requestMap.contains(child.get(ContentConstants.IDENTIFIER).toString) && child.get(DIALConstants.DIALCODES)!=null) + Map(child.get(ContentConstants.IDENTIFIER).toString -> child.get(DIALConstants.DIALCODES)) + else if(requestMap.contains(child.get(ContentConstants.IDENTIFIER).toString)) + Map(child.get(ContentConstants.IDENTIFIER).toString -> List.empty) + else Map.empty + + subChildrenDIALMap ++ childDIALMap + }).filter(msg => msg.nonEmpty).flatten.toMap[String, AnyRef] + } + + def validateDuplicateDIALCodes(unitDIALCodesMap: Map[String, AnyRef]): Unit = { + val duplicateDIALCodes = unitDIALCodesMap.flatMap(mapRec => mapRec._2.asInstanceOf[List[String]].flatMap(listRec => { + val dupUnitsList: List[String] = unitDIALCodesMap.flatMap(loopMapRec => if(loopMapRec._1 != mapRec._1 && loopMapRec._2.asInstanceOf[List[String]].contains(listRec)) { + List(loopMapRec._1, mapRec._1) + } else List.empty[String]).filter(unitRec => unitRec.nonEmpty).toList + Map(listRec -> dupUnitsList.toSet) + })).filter(unitRec => unitRec._2.nonEmpty) + + if (duplicateDIALCodes.nonEmpty) + throw new ClientException(DIALErrors.ERR_DUPLICATE_DIAL_CODES, DIALErrors.ERR_DUPLICATE_DIAL_CODES_MSG + duplicateDIALCodes) + } + + def reserveOrRelease(request: Request, operation: String)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = { + val channelId: String = request.getContext.getOrDefault(DIALConstants.CHANNEL, "").asInstanceOf[String] + val contentId: String = request.get(ContentConstants.IDENTIFIER).asInstanceOf[String] + + if (contentId == null || contentId.isEmpty) throw new ClientException(DIALErrors.ERR_CONTENT_BLANK_OBJECT_ID, DIALErrors.ERR_CONTENT_BLANK_OBJECT_ID_MSG) + + val req = new Request() + req.setContext(request.getContext) + req.put(DIALConstants.IDENTIFIER, contentId) + req.put(ContentConstants.ROOT_ID, contentId) + req.put(ContentConstants.MODE, ContentConstants.EDIT_MODE) + DataNode.read(req).flatMap(rootNode => { + val contentMetadata = rootNode.getMetadata + + validateChannel(contentMetadata.get(DIALConstants.CHANNEL).asInstanceOf[String], channelId) + validateContentForReserveAndReleaseDialcodes(contentMetadata) + validateCountForReservingAndReleasingDialCode(request.getRequest.get(DIALConstants.DIALCODES).asInstanceOf[util.Map[String, AnyRef]]) + + operation match { + case ContentConstants.RESERVE => reserve(request, channelId, contentId, rootNode, contentMetadata) + case ContentConstants.RELEASE => release(request, contentId, rootNode, contentMetadata) + case _ => throw new ClientException(DIALErrors.ERR_INVALID_OPERATION, DIALErrors.ERR_INVALID_OPERATION_MSG) + } + }) + } + + def reserve(request: Request, channelId: String, contentId: String, rootNode: Node, contentMetadata: util.Map[String, AnyRef])(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = { + validateContentStatus(contentMetadata) + + val reservedDialCodes = if(contentMetadata.containsKey(DIALConstants.RESERVED_DIALCODES)) ScalaJsonUtils.deserialize[Map[String, Integer]](contentMetadata.get(DIALConstants.RESERVED_DIALCODES).asInstanceOf[String]) else Map.empty[String, Integer] + val updateDialCodes = getUpdateDIALCodes(reservedDialCodes, request, channelId, contentId) + + if(updateDialCodes.size > reservedDialCodes.size) { + val updateReq = getDIALReserveUpdateRequest(request, rootNode, updateDialCodes) + DataNode.update(updateReq).map(updatedNode => { + val response = ResponseHandler.OK() + val updatedSuccessResponse = getDIALReserveUpdateResponse(response, updateDialCodes.size.asInstanceOf[Integer], contentId, updatedNode) + updatedSuccessResponse.getResult.put(DIALConstants.VERSION_KEY, updatedNode.getMetadata.get(DIALConstants.VERSION_KEY)) + updatedSuccessResponse + }) + } else { + val errorResponse = ResponseHandler.ERROR(ResponseCode.CLIENT_ERROR, DIALErrors.ERR_INVALID_COUNT, DIALErrors.ERR_DIAL_INVALID_COUNT_RESPONSE) + val updatedErrorResponse = getDIALReserveUpdateResponse(errorResponse, reservedDialCodes.size.asInstanceOf[Integer], contentId, rootNode) + Future(updatedErrorResponse) + } + } + + def release(request: Request, contentId: String, rootNode: Node, contentMetadata: util.Map[String, AnyRef])(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = { + val reservedDialCodes = if(contentMetadata.containsKey(DIALConstants.RESERVED_DIALCODES)) ScalaJsonUtils.deserialize[Map[String, Integer]](contentMetadata.get(DIALConstants.RESERVED_DIALCODES).asInstanceOf[String]) + else throw new ClientException(DIALErrors.ERR_CONTENT_MISSING_RESERVED_DIAL_CODES, DIALErrors.ERR_CONTENT_MISSING_RESERVED_DIAL_CODES_MSG) + + val countInRequest = request.getRequest.get(DIALConstants.DIALCODES).asInstanceOf[util.Map[String, AnyRef]].get(DIALConstants.COUNT).asInstanceOf[Integer] + if(reservedDialCodes.keys.size < countInRequest) + throw new ClientException(DIALErrors.ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES, DIALErrors.ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES_MSG) + + populateAssignedDialCodes(contentId, contentMetadata, request).map(assignedDialCodes => { + val toReleaseDIALCodes = reservedDialCodes.keySet -- assignedDialCodes.toSet + + if(toReleaseDIALCodes.isEmpty) throw new ClientException(DIALErrors.ERR_ALL_DIALCODES_UTILIZED, DIALErrors.ERR_ALL_DIALCODES_UTILIZED_MSG) + + val reqDialcodesCount = request.getRequest.get(DIALConstants.DIALCODES).asInstanceOf[util.Map[String, AnyRef]].get(DIALConstants.COUNT).asInstanceOf[Integer] + + val updatedReleaseDialcodes = if (toReleaseDIALCodes.size > reqDialcodesCount) { + toReleaseDIALCodes.take(reqDialcodesCount) + } else toReleaseDIALCodes + + val updatedReserveDialCodes = reservedDialCodes.filter(rec => !updatedReleaseDialcodes.contains(rec._1)).keySet.zipWithIndex.map { case (dialCode, idx) => + (dialCode -> idx.asInstanceOf[Integer]) + }.toMap + + val updateReq = new Request() + updateReq.setContext(request.getContext) + updateReq.getContext.put(ContentConstants.IDENTIFIER, rootNode.getIdentifier) + updateReq.put(ContentConstants.IDENTIFIER, rootNode.getIdentifier) + updateReq.put(DIALConstants.VERSION_KEY,rootNode.getMetadata.get(ContentConstants.VERSION_KEY)) + updateReq.put(DIALConstants.RESERVED_DIALCODES, if(updatedReserveDialCodes.nonEmpty) updatedReserveDialCodes.asJava else null) + DataNode.update(updateReq).map(node => { + ResponseHandler.OK.putAll(Map(ContentConstants.IDENTIFIER -> node.getIdentifier.replace(ContentConstants.IMAGE_SUFFIX, ""), + ContentConstants.VERSION_KEY -> node.getMetadata.get(ContentConstants.VERSION_KEY), + DIALConstants.RESERVED_DIALCODES -> node.getMetadata.get(DIALConstants.RESERVED_DIALCODES)).asJava) + }) + }).flatMap(f=>f) + } + + def populateAssignedDialCodes(contentId: String, contentMetadata: util.Map[String, AnyRef], req: Request)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[List[String]] = { + val request = new Request() + request.setContext(req.getContext) + request.getContext.put(ContentConstants.SCHEMA_NAME, ContentConstants.COLLECTION_SCHEMA_NAME) + request.getContext.put(ContentConstants.VERSION, ContentConstants.SCHEMA_VERSION) + request.put(ContentConstants.ROOT_ID, contentMetadata.getOrDefault(ContentConstants.IDENTIFIER,"").asInstanceOf[String]) + request.put(ContentConstants.MODE, ContentConstants.EDIT_MODE) + + HierarchyManager.getHierarchy(request).flatMap(getImageHierarchyResponse => { + val imageCollectionHierarchy = getImageHierarchyResponse.getResult.getOrDefault(ContentConstants.CONTENT, new java.util.HashMap[String, AnyRef]()).asInstanceOf[java.util.Map[String, AnyRef]] + val imageChildrenHierarchy = imageCollectionHierarchy.get(ContentConstants.CHILDREN).asInstanceOf[util.List[util.Map[String, AnyRef]]].asScala.toList + val imageChildrenAssignedDIALList = getAssignedDIALcodes(imageChildrenHierarchy) + val contentImageAssignedDIALList = if(imageCollectionHierarchy.containsKey(DIALConstants.DIALCODES) && imageCollectionHierarchy.get(DIALConstants.DIALCODES) != null) { + val collectionDialCodeStr = ScalaJsonUtils.serialize(imageCollectionHierarchy.get(DIALConstants.DIALCODES)) + val collectionDialCode = ScalaJsonUtils.deserialize[List[String]](collectionDialCodeStr) + imageChildrenAssignedDIALList ++ collectionDialCode + } + else imageChildrenAssignedDIALList + + request.put(ContentConstants.ROOT_ID, contentId) + request.put(ContentConstants.MODE, "") + if(contentMetadata.getOrDefault(ContentConstants.IDENTIFIER,"").asInstanceOf[String].endsWith(ContentConstants.IMAGE_SUFFIX)) { + HierarchyManager.getHierarchy(request).flatMap(getHierarchyResponse => { + val collectionHierarchy = getHierarchyResponse.getResult.getOrDefault(ContentConstants.CONTENT, new java.util.HashMap[String, AnyRef]()).asInstanceOf[java.util.Map[String, AnyRef]] + val childrenHierarchy = collectionHierarchy.get(ContentConstants.CHILDREN).asInstanceOf[util.List[util.Map[String, AnyRef]]].asScala.toList + val childrenAssignedDIALList = getAssignedDIALcodes(childrenHierarchy) + val contentAssignedDIALList = if(collectionHierarchy.containsKey(DIALConstants.DIALCODES) && collectionHierarchy.get(DIALConstants.DIALCODES) != null) + childrenAssignedDIALList ++ collectionHierarchy.getOrDefault(DIALConstants.DIALCODES, List.empty[String]).asInstanceOf[List[String]] + else childrenAssignedDIALList + + Future(contentImageAssignedDIALList ++ contentAssignedDIALList) + }) + } else Future(contentImageAssignedDIALList) + }) + } + + def getAssignedDIALcodes(childrenHierarchy: List[util.Map[String, AnyRef]]): List[String] = { + childrenHierarchy.map(child => { + val subChildrenDIALMap = if(child.get(ContentConstants.CHILDREN)!=null) + getAssignedDIALcodes(child.get(ContentConstants.CHILDREN).asInstanceOf[util.List[util.Map[String, AnyRef]]].asScala.toList) + else List.empty[String] + + val childDIALMap = if(child.get(DIALConstants.DIALCODES)!=null) + child.get(DIALConstants.DIALCODES).asInstanceOf[util.List[String]].asScala.toList + else List.empty[String] + + subChildrenDIALMap ++ childDIALMap + }).filter(msg => msg.nonEmpty).flatten + } + + + def validateChannel(contentChannel: String, channelId: String): Unit = { + if(contentChannel == null || channelId == null || !contentChannel.equalsIgnoreCase(channelId)) + throw new ClientException(DIALErrors.ERR_INVALID_CHANNEL, DIALErrors.ERR_INVALID_CHANNEL_MSG) + } + + def validateContentForReserveAndReleaseDialcodes(metaData: util.Map[String, AnyRef]): Unit = { + val validMimeType = if (Platform.config.hasPath("reserve_dialcode.mimeType")) Platform.config.getStringList("reserve_dialcode.mimeType") else util.Arrays.asList(ContentConstants.COLLECTION_MIME_TYPE) + if (!validMimeType.contains(metaData.get(ContentConstants.MIME_TYPE))) throw new ClientException(DIALErrors.ERR_CONTENT_MIMETYPE, DIALErrors.ERR_CONTENT_MIMETYPE_MSG) + + val validContentStatus = if (Platform.config.hasPath("reserve_dialcode.valid_content_status")) Platform.config.getStringList("reserve_dialcode.valid_content_status") else util.Arrays.asList(ContentConstants.DRAFT, ContentConstants.LIVE) + if(!validContentStatus.contains(metaData.get(ContentConstants.STATUS).asInstanceOf[String])) throw new ClientException(DIALErrors.ERR_CONTENT_RETIRED_OBJECT_ID, DIALErrors.ERR_CONTENT_RETIRED_OBJECT_ID_MSG) + } + + def validateCountForReservingAndReleasingDialCode(requestDIALCodesMap: util.Map[String, AnyRef]): Unit = { + if (null == requestDIALCodesMap.get(DIALConstants.COUNT) || !requestDIALCodesMap.get(DIALConstants.COUNT).isInstanceOf[Integer]) throw new ClientException(DIALErrors.ERR_INVALID_COUNT, DIALErrors.ERR_INVALID_COUNT_MSG) + val count = requestDIALCodesMap.get(DIALConstants.COUNT).asInstanceOf[Integer] + val maxCount = if (Platform.config.hasPath("reserve_dialcode.max_count")) Platform.config.getInt("reserve_dialcode.max_count") else 250 + if (count < 1 || count > maxCount) throw new ClientException(DIALErrors.ERR_INVALID_COUNT_RANGE, DIALErrors.ERR_INVALID_COUNT_RANGE_MSG + maxCount + ".") + } + + def validateContentStatus(contentMetadata: util.Map[String, AnyRef]): Unit = { + if (contentMetadata.get(ContentConstants.STATUS).asInstanceOf[String].equalsIgnoreCase(DIALConstants.LIVE_STATUS) || contentMetadata.get(ContentConstants.STATUS).asInstanceOf[String].equalsIgnoreCase(DIALConstants.UNLISTED_STATUS)) + throw new ClientException(DIALErrors.ERR_CONTENT_INVALID_OBJECT, DIALErrors.ERR_CONTENT_INVALID_OBJECT_MSG) + } + + def getUpdateDIALCodes(reservedDialCodes: Map[String, Integer], request: Request, channelId: String, contentId: String)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Map[String, Integer] = { + val maxIndex: Integer = if (reservedDialCodes.nonEmpty) reservedDialCodes.max._2 else -1 + val dialCodes = reservedDialCodes.keySet + val reqDialcodesCount = request.getRequest.get(DIALConstants.DIALCODES).asInstanceOf[util.Map[String, AnyRef]].get(DIALConstants.COUNT).asInstanceOf[Integer] + + if (dialCodes.size < reqDialcodesCount) { + val newDialcodes = generateDialCodes(channelId, contentId, reqDialcodesCount - dialCodes.size, request.get(DIALConstants.PUBLISHER).asInstanceOf[String]) + val newDialCodesMap: Map[String, Integer] = newDialcodes.zipWithIndex.map { case (newDialCode, idx) => + (newDialCode -> (maxIndex + idx + 1).asInstanceOf[Integer]) + }.toMap + reservedDialCodes ++ newDialCodesMap + } else reservedDialCodes + } + + @throws[Exception] + private def generateDialCodes(channelId: String, contentId: String, dialcodeCount: Integer, publisher: String)(implicit oec: OntologyEngineContext): List[String] = { + val requestMap = new util.HashMap[String, AnyRef]() {{ + put(DIALConstants.REQUEST, new util.HashMap[String, AnyRef]() {{ + put(DIALConstants.DIALCODES, new util.HashMap[String, AnyRef]() {{ + put(DIALConstants.COUNT, dialcodeCount) + put(DIALConstants.PUBLISHER, publisher) + put(DIALConstants.BATCH_CODE, contentId) + }}) + }}) + }} + + val headerParam = new util.HashMap[String, String]{put(DIALConstants.X_CHANNEL_ID, channelId); put(DIALConstants.AUTHORIZATION, DIAL_API_AUTH_KEY);} + val generateResponse = oec.httpUtil.post(DIALCODE_GENERATE_URI, requestMap, headerParam) + if (generateResponse.getResponseCode == ResponseCode.OK || generateResponse.getResponseCode == ResponseCode.PARTIAL_SUCCESS) { + val generatedDialCodes = generateResponse.getResult.get(DIALConstants.DIALCODES).asInstanceOf[util.ArrayList[String]].asScala.toList + if (generatedDialCodes.nonEmpty) generatedDialCodes + else throw new ServerException(ErrorCodes.ERR_SYSTEM_EXCEPTION.name, DIALErrors.ERR_DIAL_GEN_LIST_EMPTY_MSG) + } + else if (generateResponse.getResponseCode eq ResponseCode.CLIENT_ERROR) { + throw new ClientException(generateResponse.getParams.getErr, generateResponse.getParams.getErrmsg) + } + else { + throw new ServerException(ErrorCodes.ERR_SYSTEM_EXCEPTION.name, DIALErrors.ERR_DIAL_GENERATION_MSG) + } + } + + def getDIALReserveUpdateRequest(req: Request, rootNode: Node, updateDialCodes: Map[String, Integer]): Request = { + val updateReq = new Request() + updateReq.setContext(req.getContext) + updateReq.getContext.put(ContentConstants.IDENTIFIER, rootNode.getIdentifier) + updateReq.put(ContentConstants.IDENTIFIER, rootNode.getIdentifier) + updateReq.put(DIALConstants.VERSION_KEY,rootNode.getMetadata.get("versionKey")) + updateReq.put(DIALConstants.RESERVED_DIALCODES, updateDialCodes.asJava) + updateReq + } + + def getDIALReserveUpdateResponse(response: Response, count: Integer, contentId: String, node: Node): Response = { + response.getResult.put(DIALConstants.COUNT, count) + response.getResult.put(ContentConstants.NODE_ID, contentId) + response.getResult.put(DIALConstants.RESERVED_DIALCODES, node.getMetadata.get(DIALConstants.RESERVED_DIALCODES)) + + response + } } diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/publish/mgr/PublishManager.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/publish/mgr/PublishManager.scala new file mode 100644 index 000000000..16a4e2f71 --- /dev/null +++ b/content-api/content-actors/src/main/scala/org/sunbird/content/publish/mgr/PublishManager.scala @@ -0,0 +1,102 @@ +package org.sunbird.content.publish.mgr + +import org.apache.commons.lang3.StringUtils +import org.sunbird.common.Platform +import org.sunbird.common.dto.ResponseParams.StatusType +import org.sunbird.common.dto.{Request, Response, ResponseParams} +import org.sunbird.common.exception.ClientException +import org.sunbird.content.util.ContentConstants +import org.sunbird.graph.OntologyEngineContext +import org.sunbird.graph.dac.model.Node +import org.sunbird.kafka.client.KafkaClient +import org.sunbird.mimetype.factory.MimeTypeManagerFactory +import org.sunbird.telemetry.util.LogTelemetryEventUtil + +import java.util +import scala.concurrent.{ExecutionContext, Future} + +object PublishManager { + + private val kfClient = new KafkaClient + + def publish(request: Request, node: Node)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[Response] = { + val identifier: String = node.getIdentifier + val mimeType = node.getMetadata.getOrDefault(ContentConstants.MIME_TYPE, "").asInstanceOf[String] + val mgr = MimeTypeManagerFactory.getManager(node.getObjectType, mimeType) + + val publishCheckList = request.getContext.getOrDefault(ContentConstants.PUBLIC_CHECK_LIST, List.empty[String]).asInstanceOf[List[String]] + if (publishCheckList.isEmpty) node.getMetadata.put(ContentConstants.PUBLIC_CHECK_LIST, null) + + val publishType = request.getContext.getOrDefault(ContentConstants.PUBLISH_TYPE, "").asInstanceOf[String] + node.getMetadata.put(ContentConstants.PUBLISH_TYPE, publishType) + + val publishFuture: Future[scala.collection.Map[String, AnyRef]] = mgr.publish(identifier, node) + publishFuture.map(result => { + // Push Instruction Event - Learning code has logic to send publish instruction to different topics based on mimeTypes. That logic is not implemented here due to deprecation of samza jobs. + pushInstructionEvent(identifier, node) + + val response = new Response + val param = new ResponseParams + param.setStatus(StatusType.successful.name) + response.setParams(param) + response.put(ContentConstants.PUBLISH_STATUS, s"Publish Event for Content Id '${node.getIdentifier}' is pushed Successfully!") + response.put(ContentConstants.NODE_ID, node.getIdentifier) + + Future(response) + }).flatMap(f => f) + } + + @throws[Exception] + private def pushInstructionEvent(identifier: String, node: Node): Unit = { + val actor: util.Map[String, AnyRef] = new util.HashMap[String, AnyRef] + val context: util.Map[String, AnyRef] = new util.HashMap[String, AnyRef] + val objectData: util.Map[String, AnyRef] = new util.HashMap[String, AnyRef] + val edata: util.Map[String, AnyRef] = new util.HashMap[String, AnyRef] + generateInstructionEventMetadata(actor, context, objectData, edata, node, identifier) + val beJobRequestEvent: String = LogTelemetryEventUtil.logInstructionEvent(actor, context, objectData, edata) + val topic: String = Platform.getString(ContentConstants.KAFKA_PUBLISH_TOPIC,"sunbirddev.publish.job.request") + if (StringUtils.isBlank(beJobRequestEvent)) throw new ClientException("BE_JOB_REQUEST_EXCEPTION", "Event is not generated properly.") + kfClient.send(beJobRequestEvent, topic) + } + + private def generateInstructionEventMetadata(actor: util.Map[String, AnyRef], context: util.Map[String, AnyRef], objectData: util.Map[String, AnyRef], edata: util.Map[String, AnyRef], node: Node, identifier: String): Unit = { + val metadata: util.Map[String, AnyRef] = node.getMetadata + + // actor + actor.put(ContentConstants.ID, node.getObjectType.toLowerCase() + "-publish") + actor.put(ContentConstants.TYPE, ContentConstants.SYSTEM) + + //context + context.put(ContentConstants.CHANNEL, metadata.get(ContentConstants.CHANNEL)) + context.put(ContentConstants.P_DATA, new util.HashMap[String, AnyRef]() {{ + put(ContentConstants.ID, ContentConstants.SUNBIRD_PLATFORM) + put(ContentConstants.VER, ContentConstants.SCHEMA_VERSION) + }}) + if (Platform.config.hasPath("cloud_storage.env")) { + val env: String = Platform.getString("cloud_storage.env", "dev") + context.put(ContentConstants.ENV, env) + } + + //objectData + objectData.put(ContentConstants.ID, identifier) + objectData.put(ContentConstants.VER, metadata.get(ContentConstants.VERSION_KEY)) + + //edata + getEData(metadata, edata, identifier, node.getObjectType) + } + + private def getEData(metadata: util.Map[String, AnyRef], edata: util.Map[String, AnyRef], identifier: String, objectType: String): Unit = { + val instructionEventMetadata = new util.HashMap[String, AnyRef] + edata.put(ContentConstants.PUBLISH_TYPE, metadata.get(ContentConstants.PUBLISH_TYPE)) + instructionEventMetadata.put(ContentConstants.PACKAGE_VERSION, metadata.getOrDefault(ContentConstants.PACKAGE_VERSION,0.asInstanceOf[AnyRef])) + instructionEventMetadata.put(ContentConstants.MIME_TYPE, metadata.get(ContentConstants.MIME_TYPE)) + instructionEventMetadata.put(ContentConstants.LAST_PUBLISHED_BY, metadata.get(ContentConstants.LAST_PUBLISHED_BY)) + instructionEventMetadata.put(ContentConstants.IDENTIFIER, identifier) + instructionEventMetadata.put(ContentConstants.OBJECT_TYPE, objectType) + edata.put(ContentConstants.METADATA, instructionEventMetadata) + edata.put(ContentConstants.ACTION, ContentConstants.PUBLISH) + edata.put(ContentConstants.CONTENT_TYPE, metadata.get(ContentConstants.CONTENT_TYPE)) + } +} + + diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/util/ContentConstants.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/util/ContentConstants.scala index 29889d0eb..6ddc98881 100644 --- a/content-api/content-actors/src/main/scala/org/sunbird/content/util/ContentConstants.scala +++ b/content-api/content-actors/src/main/scala/org/sunbird/content/util/ContentConstants.scala @@ -56,4 +56,27 @@ object ContentConstants { val LAST_UPDATED_ON:String = "lastUpdatedOn" val VERSION:String = "version" val COPY_SCHEME:String = "copyScheme" + val PARENT: String = "Parent" + val BEARER: String = "Bearer " + val OK_RESPONSE_CODE: String = "OK" + val PUBLIC_CHECK_LIST: String = "publishChecklist" + val PUBLISH_TYPE: String = "publish_type" + val PUBLISH_STATUS: String = "publishStatus" + val ID: String = "id" + val TYPE: String = "type" + val SYSTEM: String = "System" + val P_DATA: String = "pdata" + val SUNBIRD_PLATFORM: String = "org.sunbird.platform" + val VER: String = "ver" + val LAST_PUBLISHED_BY: String = "lastPublishedBy" + val OBJECT_TYPE: String = "objectType" + val ACTION: String = "action" + val PUBLISH: String = "publish" + val ENV: String = "env" + val KAFKA_PUBLISH_TOPIC: String = "kafka.publish.request.topic" + val PROCESSING: String = "Processing" + val RESERVE: String = "reserve" + val RELEASE: String = "release" + val DRAFT: String = "Draft" + val LIVE: String = "Live" } diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/util/CopyManager.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/util/CopyManager.scala index cbf52207d..f1c2f86cc 100644 --- a/content-api/content-actors/src/main/scala/org/sunbird/content/util/CopyManager.scala +++ b/content-api/content-actors/src/main/scala/org/sunbird/content/util/CopyManager.scala @@ -222,7 +222,7 @@ object CopyManager { protected def getFileNameFromURL(fileUrl: String): String = if (!FilenameUtils.getExtension(fileUrl).isEmpty) FilenameUtils.getBaseName(fileUrl) + "_" + System.currentTimeMillis + "." + FilenameUtils.getExtension(fileUrl) else FilenameUtils.getBaseName(fileUrl) + "_" + System.currentTimeMillis - protected def isInternalUrl(url: String)(implicit ss: StorageService): Boolean = url.contains(ss.getContainerName()) + protected def isInternalUrl(url: String)(implicit ss: StorageService): Boolean = url.contains(ss.getContainerName) def prepareHierarchyRequest(originHierarchy: util.Map[String, AnyRef], originNode: Node, node: Node, copyType: String, request: Request):util.HashMap[String, AnyRef] = { val children:util.List[util.Map[String, AnyRef]] = originHierarchy.get("children").asInstanceOf[util.List[util.Map[String, AnyRef]]] diff --git a/content-api/content-actors/src/test/resources/application.conf b/content-api/content-actors/src/test/resources/application.conf index 06d8e8d15..bacdabc13 100644 --- a/content-api/content-actors/src/test/resources/application.conf +++ b/content-api/content-actors/src/test/resources/application.conf @@ -394,6 +394,7 @@ channel.fetch.suggested_frameworks=true # Kafka configuration details kafka.topics.instruction="local.learning.job.request" +kafka.publish.request.topic = "local.publish.job.request" kafka.urls="localhost:9092" #Youtube Standard Licence Validation @@ -495,10 +496,19 @@ dial_service { api { base_url = "https://qa.ekstep.in/api" auth_key = "auth_key" + search = "/dialcode/v1/search" + generate = "/dialcode/v1/generate" } } content.link_dialcode.validation=true content.link_dialcode.max_limit=10 + + +reserve_dialcode { + mimeType = ["application/vnd.ekstep.content-collection", "application/pdf"] + max_count = 250 +} + # This is added to handle large artifacts sizes differently content.artifact.size.for_online=209715200 diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/actors/TestContentActor.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/actors/TestContentActor.scala index 40778e99f..fb9f22de2 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/actors/TestContentActor.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/actors/TestContentActor.scala @@ -93,7 +93,7 @@ class TestContentActor extends BaseSpec with MockFactory { val graphDB = mock[GraphService] (oec.graphService _).expects().returns(graphDB) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getValidNode())) - implicit val ss = mock[StorageService] + implicit val ss: StorageService = mock[StorageService] (ss.getSignedURL(_: String, _: Option[Int], _: Option[String])).expects(*, *, *).returns("cloud store url") val request = getContentRequest() request.getRequest.putAll(mapAsJavaMap(Map("fileName" -> "presigned_url", "filePath" -> "/data/cloudstore/", "type" -> "assets", "identifier" -> "do_1234"))) @@ -626,6 +626,184 @@ class TestContentActor extends BaseSpec with MockFactory { node } + it should "return success response for 'publishContent' for document mimeType" in { + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + implicit val ss = mock[StorageService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "application/pdf", "LearningResource", "Content", "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11316726916397465612760/artifact/sample.pdf") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("organisationBoardIds", new util.ArrayList[String](){{add("ncf_board_cbse")}}) + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert("successful".equals(response.getParams.getStatus)) + } + + it should "return success response for 'publishContent' for youtube mimeType" in { + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + implicit val ss = mock[StorageService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "video/x-youtube", "LearningResource", "Content", "https://www.youtube.com/watch?v=EtYU11qNciQ&t=612s") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("organisationBoardIds", new util.ArrayList[String](){{add("ncf_board_cbse")}}) + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert("successful".equals(response.getParams.getStatus)) + } + + it should "return success response for 'publishContent' for video mimeType" in { + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + implicit val ss = mock[StorageService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "video/mp4", "LearningResource", "Content", "https://ekstep-public-prod.s3-ap-south-1.amazonaws.com/content/do_312293067955650560231/artifact/itemupload_1500618666256.mp4") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("organisationBoardIds", new util.ArrayList[String](){{add("ncf_board_cbse")}}) + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert("successful".equals(response.getParams.getStatus)) + } + + it should "return success response for 'publishContent' for HTML mimeType" in { + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + implicit val ss = mock[StorageService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "application/vnd.ekstep.html-archive", "LearningResource", "Content", "https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/do_21357841995316428811795/artifact/2.-ekiikrnn-kii-prkrti-output-3_1657521986480_1657522093104.zip") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("organisationBoardIds", new util.ArrayList[String](){{add("ncf_board_cbse")}}) + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert("successful".equals(response.getParams.getStatus)) + } + + it should "return success response for 'publishContent' for H5P mimeType" in { + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + implicit val ss = mock[StorageService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "application/vnd.ekstep.h5p-archive", "LearningResource", "Content", "https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging/content/do_2135971978057482241406/artifact/1659814186163_do_2135971978057482241406.zip") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("organisationBoardIds", new util.ArrayList[String](){{add("ncf_board_cbse")}}) + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert("successful".equals(response.getParams.getStatus)) + } + + it should "return success response for 'publishContent' for Plugin mimeType" in { + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + implicit val ss = mock[StorageService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "application/vnd.ekstep.plugin-archive", "LearningResource", "Content", "https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/org.ekstep.summary/artifact/org.ekstep.summary-1.0-1_1574060894628.zip") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("organisationBoardIds", new util.ArrayList[String](){{add("ncf_board_cbse")}}) + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert("successful".equals(response.getParams.getStatus)) + } + + it should "return success response for 'publishContent' for Collection mimeType" in { + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + implicit val ss = mock[StorageService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getValidNode() + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_1234") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert("successful".equals(response.getParams.getStatus)) + } + + it should "through client exception for publish operation if node is under processing" in { + implicit val ss = mock[StorageService] + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "application/pdf", "LearningResource", "Content", "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11316726916397465612760/artifact/sample.pdf") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("status", "Processing") + node.getMetadata.put("organisationBoardIds", new util.ArrayList[String](){{add("ncf_board_cbse")}}) + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.getRequest.put("lastPublishedBy", "Support Team") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) + assert(response.getParams.getErr == "ERR_NODE_ACCESS_DENIED") + assert(response.getParams.getErrmsg == "Publish Operation Can't Be Applied On Node Under Processing State") + } + + it should "through client exception for publish operation if published by is not passed" in { + implicit val ss = mock[StorageService] + implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] + val graphDB = mock[GraphService] + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + val node = getNodeForReview("do_123", "application/pdf", "LearningResource", "Content", "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11316726916397465612760/artifact/sample.pdf") + node.getMetadata.put("contentType", "Resource") + node.getMetadata.put("status", "Review") + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + val request = getContentRequest() + request.getContext.put("identifier", "do_123") + request.setOperation("publishContent") + val response = callActor(request, Props(new ContentActor())) + assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) + assert(response.getParams.getErr == "ERR_CONTENT_BLANK_PUBLISHER") + assert(response.getParams.getErrmsg == "Publisher User Id is blank") + } + private def getNode(): Node = { val node = new Node() node.setIdentifier("do_1234") diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala index 6cfa80930..8b54cd6d6 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala @@ -1,23 +1,22 @@ package org.sunbird.content.dial -import java.util - import org.scalamock.matchers.Matchers import org.scalamock.scalatest.AsyncMockFactory import org.scalatest.AsyncFlatSpec -import org.sunbird.common.{HttpUtil, JsonUtils} -import org.sunbird.common.dto.{Request, Response} +import org.sunbird.common.dto.{Property, Request, Response} import org.sunbird.common.exception.{ClientException, ResourceNotFoundException, ResponseCode, ServerException} +import org.sunbird.common.{HttpUtil, JsonUtils} import org.sunbird.graph.dac.model.{Node, SearchCriteria} import org.sunbird.graph.{GraphService, OntologyEngineContext} +import java.util import scala.concurrent.Future class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory { implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] - val graphDB = mock[GraphService] - val httpUtil = mock[HttpUtil] + val graphDB: GraphService = mock[GraphService] + val httpUtil: HttpUtil = mock[HttpUtil] "getRequestData with list input" should "return request data as list with scala types" in { val reqMap : java.util.Map[String, AnyRef] = new util.HashMap[String, AnyRef](){{ @@ -52,8 +51,8 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory assert(result.isInstanceOf[List[AnyRef]]) assert(result.size==3) assert(result(1).nonEmpty) - assert(result(1).get("identifier").get.isInstanceOf[List[String]]) - assert(result(1).get("dialcode").get.isInstanceOf[List[String]]) + assert(result(1)("identifier").isInstanceOf[List[String]]) + assert(result(1)("dialcode").isInstanceOf[List[String]]) } "getRequestData with map input" should "return request data as list with scala types" in { @@ -72,9 +71,9 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory assert(null!=result && result.nonEmpty) assert(result.isInstanceOf[List[AnyRef]]) assert(result.size==1) - assert(result(0).nonEmpty) - assert(result(0).get("identifier").get.isInstanceOf[List[String]]) - assert(result(0).get("dialcode").get.isInstanceOf[List[String]]) + assert(result.head.nonEmpty) + assert(result.head("identifier").isInstanceOf[List[String]]) + assert(result.head("dialcode").isInstanceOf[List[String]]) } "getRequestData with invalid input" should "throw client exception" in { @@ -107,7 +106,6 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory val input = new util.ArrayList[String]() val result:List[String] = DIALManager.getList(input) assert(result.isEmpty) - assert(result.size==0) } "validateAndGetRequestMap with valid input" should "return the request map" in { @@ -117,10 +115,10 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory val result = DIALManager.validateAndGetRequestMap("test", input) assert(result.nonEmpty) assert(result.size==5) - assert(result.get("do_88888").get.contains("L4A6W8")) - assert(result.get("do_88888").get.contains("D2E1J9")) - assert(result.get("do_2222").get.size==1) - assert(result.get("do_2222").get.contains("R4X2P2")) + assert(result("do_88888").contains("L4A6W8")) + assert(result("do_88888").contains("D2E1J9")) + assert(result("do_2222").size==1) + assert(result("do_2222").contains("R4X2P2")) } "validateReqStructure with valid request" should "not throw any exception" in { @@ -185,23 +183,130 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getNode("do_1111"))) (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(getNode("do_1111"))) val request = getContentDIALRequest() - val resFuture = DIALManager.link(request) - resFuture.map(result => { + + DIALManager.link(request).map(result => { assert(result.getResponseCode.toString=="OK") }) } - "link DIAL with valid request for collections" should "update the collection content successfully" in { + "link DIAL with valid request for collections" should "update the collection successfully" in { (oec.httpUtil _).expects().returns(httpUtil) + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() (httpUtil.post(_: String, _:java.util.Map[String, AnyRef], _:java.util.Map[String, String])).expects(*, *, *).returns(getDIALSearchResponse) + + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + + val contentId = "do_1111" + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(getCassandraHierarchy(contentId))).anyNumberOfTimes() + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getNode(contentId))).anyNumberOfTimes() + (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(getNode(contentId))) + (graphDB.saveExternalProps(_: Request)).expects(*).returns(Future(new Response())) + (graphDB.getNodeProperty(_: String, _: String, _: String)).expects(*, *, *).returns(Future(new Property("versionKey", new org.neo4j.driver.internal.value.StringValue("1234")))) + val request = getCollectionDIALRequest() + val response = DIALManager.link(request) response.map(result => { assert(result.getResponseCode.toString=="OK") }) } - def getDIALSearchResponse():Response = { + "validateDuplicateDIALCodes with duplicate dial codes" should "throw client exception" in { + val exception = intercept[ClientException] { + DIALManager.validateDuplicateDIALCodes(Map("do_2222" -> List("E8B7Z6", "R4X2P2"), "do_1111" -> List("N4Z7D5", "E8B7Z6", "L4A6W8", "D2E1J9", "R4X2P2"))) + } + assert(exception.getErrCode == "ERR_DUPLICATE_DIAL_CODES") + } + + "link DIAL with valid node invalid unit Id for collections" should "update the collection partially" in { + (oec.httpUtil _).expects().returns(httpUtil) + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + (httpUtil.post(_: String, _:java.util.Map[String, AnyRef], _:java.util.Map[String, String])).expects(*, *, *).returns(getDIALSearchResponse) + + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val contentId = "do_1111" + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(getCassandraHierarchy(contentId))).anyNumberOfTimes() + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getNode(contentId))).anyNumberOfTimes() + (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(getNode(contentId))) + (graphDB.saveExternalProps(_: Request)).expects(*).returns(Future(new Response())) + (graphDB.getNodeProperty(_: String, _: String, _: String)).expects(*, *, *).returns(Future(new Property("versionKey", new org.neo4j.driver.internal.value.StringValue("1234")))) + + val request = getCollectionPartialSuccessRequest() + + val response = DIALManager.link(request) + response.map(result => { + assert(result.getResponseCode.toString=="PARTIAL_SUCCESS") + }) + } + + "link DIAL with invalid unit Id request for collection" should "respond with Resource not found message" in { + (oec.httpUtil _).expects().returns(httpUtil) + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + (httpUtil.post(_: String, _:java.util.Map[String, AnyRef], _:java.util.Map[String, String])).expects(*, *, *).returns(getDIALSearchResponse) + + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + val contentId = "do_1111" + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(getCassandraHierarchy(contentId))).anyNumberOfTimes() + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getNode(contentId))).anyNumberOfTimes() + (graphDB.getNodeProperty(_: String, _: String, _: String)).expects(*, *, *).returns(Future(new Property("versionKey", new org.neo4j.driver.internal.value.StringValue("1234")))) + (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(getNode(contentId))) + (graphDB.saveExternalProps(_: Request)).expects(*).returns(Future(new Response())) + + val request = getCollectionRNFRequest() + + val response = DIALManager.link(request) + response.map(result => { + assert(result.getResponseCode.toString=="RESOURCE_NOT_FOUND") + }) + } + + "reserve DIAL" should "update content with reservedDialcodes" in { + (oec.httpUtil _).expects().returns(httpUtil) + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + (httpUtil.post(_: String, _:java.util.Map[String, AnyRef], _:java.util.Map[String, String])).expects(*, *, *).returns(getGenerateDIALResponse) + + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + + val contentId: String = "do_123456" +// (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(new Response())).anyNumberOfTimes() + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getNode(contentId))).anyNumberOfTimes() +// (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getNode(contentId+".img"))).anyNumberOfTimes() + (graphDB.getNodeProperty(_: String, _: String, _: String)).expects(*, *, *).returns(Future(new Property("versionKey", new org.neo4j.driver.internal.value.StringValue("1234")))) + (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(getNode(contentId))) + + val request = getReserveDIALRequest(contentId) + + val response = DIALManager.reserveOrRelease(request, "reserve") + response.map(result => { + assert(result.getResponseCode.toString=="OK") + }) + } + + "release DIAL" should "update content with reservedDialcodes excluding the number of dialcodes mentioned in count" in { + (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() + + val nodes: util.List[Node] = getCategoryNode() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() + + val contentId: String = "do_123456" + (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(getReleaseNode(contentId))).anyNumberOfTimes() + (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(getCassandraHierarchy(contentId))).anyNumberOfTimes() + (graphDB.getNodeProperty(_: String, _: String, _: String)).expects(*, *, *).returns(Future(new Property("versionKey", new org.neo4j.driver.internal.value.StringValue("1234")))) + (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(getNode(contentId))) + + val request = getReleaseDIALRequest(contentId) + + val response = DIALManager.reserveOrRelease(request, "release") + response.map(result => { + assert(result.getResponseCode.toString=="OK") + }) + } + + def getDIALSearchResponse:Response = { val resString = "{\n \"id\": \"sunbird.dialcode.search\",\n \"ver\": \"3.0\",\n \"ts\": \"2020-04-21T19:39:14ZZ\",\n \"params\": {\n \"resmsgid\": \"1dfcc25b-6c37-49f8-a6c3-7185063e8752\",\n \"msgid\": null,\n \"err\": null,\n \"status\": \"successful\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"dialcodes\": [\n {\n \"dialcode_index\": 7609876,\n \"identifier\": \"N4Z7D5\",\n \"channel\": \"testr01\",\n \"batchcode\": \"testPub0001.20200421T193801\",\n \"publisher\": \"testPub0001\",\n \"generated_on\": \"2020-04-21T19:38:01.603+0000\",\n \"status\": \"Draft\",\n \"objectType\": \"DialCode\"\n },\n {\n \"dialcode_index\": 7610113,\n \"identifier\": \"E8B7Z6\",\n \"channel\": \"testr01\",\n \"batchcode\": \"testPub0001.20200421T193801\",\n \"publisher\": \"testPub0001\",\n \"generated_on\": \"2020-04-21T19:38:01.635+0000\",\n \"status\": \"Draft\",\n \"objectType\": \"DialCode\"\n },\n {\n \"dialcode_index\": 7610117,\n \"identifier\": \"R4X2P2\",\n \"channel\": \"testr01\",\n \"batchcode\": \"testPub0001.20200421T193801\",\n \"publisher\": \"testPub0001\",\n \"generated_on\": \"2020-04-21T19:38:01.637+0000\",\n \"status\": \"Draft\",\n \"objectType\": \"DialCode\"\n },\n {\n \"dialcode_index\": 7610961,\n \"identifier\": \"L4A6W8\",\n \"channel\": \"testr01\",\n \"batchcode\": \"testPub0001.20200421T193801\",\n \"publisher\": \"testPub0001\",\n \"generated_on\": \"2020-04-21T19:38:01.734+0000\",\n \"status\": \"Draft\",\n \"objectType\": \"DialCode\"\n },\n {\n \"dialcode_index\": 7611164,\n \"identifier\": \"D2E1J9\",\n \"channel\": \"testr01\",\n \"batchcode\": \"testPub0001.20200421T193801\",\n \"publisher\": \"testPub0001\",\n \"generated_on\": \"2020-04-21T19:38:01.759+0000\",\n \"status\": \"Draft\",\n \"objectType\": \"DialCode\"\n }\n ],\n \"count\": 5\n }\n}"; JsonUtils.deserialize(resString, classOf[Response]) } @@ -292,25 +397,16 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory put("dialcode", new util.ArrayList[String](){{ add("N4Z7D5") add("E8B7Z6") + add("L4A6W8") + add("D2E1J9") }}) }}) add(new util.HashMap[String, AnyRef](){{ put("identifier",new util.ArrayList[String](){{ add("do_2222") - add("do_3333") }}) put("dialcode", "R4X2P2") }}) - add(new util.HashMap[String, AnyRef](){{ - put("identifier",new util.ArrayList[String](){{ - add("do_4444") - add("do_5555") - }}) - put("dialcode", new util.ArrayList[String](){{ - add("L4A6W8") - add("D2E1J9") - }}) - }}) }}) }} reqMap @@ -323,6 +419,7 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory add(getNode("do_3333")) add(getNode("do_4444")) add(getNode("do_5555")) + add(getNode("do_123456")) }} result } @@ -348,6 +445,96 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory node } + def getReleaseNode(identifier: String): Node = { + val node = new Node() + node.setIdentifier(identifier) + node.setNodeType("DATA_NODE") + node.setObjectType("Content") + val reservedDialcodesMap = new util.HashMap[String, Int] (){ + put("V4M9H3", 0); + put("W1I5W9", 1); + put("P7W5F1", 2); + put("A8H7V2", 3); + } + + node.setMetadata(new util.HashMap[String, AnyRef]() { + { + put("identifier", identifier) + put("name", "Test Content") + put("code", "test.resource") + put("contentType", "Resource") + put("mimeType", "application/pdf") + put("status", "Draft") + put("channel", "test") + put("versionKey", "1234") + put("primaryCategory", "Learning Resource") + put("reservedDialcodes", JsonUtils.serialize(reservedDialcodesMap)) + } + }) + node + } + + def getCollectionPartialSuccessRequest(): Request = { + val request = new Request() + request.setObjectType("Content") + request.setContext(getContext()) + request.getContext.put("linkType","collection") + request.getContext.put("identifier","do_1111") + + val reqMap : java.util.Map[String, AnyRef] = new util.HashMap[String, AnyRef](){{ + put("content", new util.ArrayList[util.Map[String, AnyRef]](){{ + add(new util.HashMap[String, AnyRef](){{ + put("identifier","do_1111") + put("dialcode", new util.ArrayList[String](){{ + add("N4Z7D5") + add("E8B7Z6") + add("L4A6W8") + add("D2E1J9") + }}) + }}) + add(new util.HashMap[String, AnyRef](){{ + put("identifier",new util.ArrayList[String](){{ + add("do_22223") + }}) + put("dialcode", "R4X2P2") + }}) + + }}) + }} + + request.putAll(reqMap) + request + } + + def getCollectionRNFRequest(): Request = { + val request = new Request() + request.setObjectType("Content") + request.setContext(getContext()) + request.getContext.put("linkType","collection") + request.getContext.put("identifier","do_1111") + + val reqMap : java.util.Map[String, AnyRef] = new util.HashMap[String, AnyRef](){{ + put("content", new util.ArrayList[util.Map[String, AnyRef]](){{ + add(new util.HashMap[String, AnyRef](){{ + put("identifier",new util.ArrayList[String](){{ + add("do_22223") + }}) + put("dialcode", new util.ArrayList[String](){{ + add("N4Z7D5") + add("E8B7Z6") + add("L4A6W8") + add("D2E1J9") + add("R4X2P2") + }}) + }}) + + }}) + }} + + request.putAll(reqMap) + request + } + private def getCategoryDefinitionNode(identifier: String): Node = { val node = new Node() node.setIdentifier(identifier) @@ -383,4 +570,78 @@ class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory util.Arrays.asList(node) } + def getCassandraHierarchy(contentId: String): Response = { + val hierarchyString: String = + s"""{"ownershipType": ["createdBy"],"subject": ["Mathematics"],"channel": "0126825293972439041","organisation": ["Sunbird"], + |"language": ["English"],"mimeType": "application/vnd.ekstep.content-collection","objectType": "Content","gradeLevel": ["Class 4"], + |"primaryCategory": "Digital Textbook","children": [{"ownershipType": ["createdBy"],"parent": "$contentId","code": "do_1132828084877148161531", + |"keywords": [],"credentials": {"enabled": "No"},"channel": "0126825293972439041","description": "This chapter describes about human body", + |"language": ["English"],"mimeType": "application/vnd.ekstep.content-collection","idealScreenSize": "normal","createdOn": "2021-05-20T08:58:33.470+0000", + |"objectType": "Content","primaryCategory": "Textbook Unit","children": [{"ownershipType": ["createdBy"],"parent": "do_2222", + |"code": "do_1132828084876574721523","keywords": [],"credentials": {"enabled": "No"},"channel": "0126825293972439041", + |"description": "This section describes about various part of the body such as head, hands, legs etc.","language": ["English"], + |"mimeType": "application/vnd.ekstep.content-collection","idealScreenSize": "normal","createdOn": "2021-05-20T08:58:33.466+0000", + |"objectType": "Content","primaryCategory": "Textbook Unit","children": [{"ownershipType": ["createdBy"],"parent": "do_1132833371215134721712", + |"code": "do_1132828084876738561525","keywords": ["legs etc."],"credentials": {"enabled": "No"},"channel": "0126825293972439041","description": "xyz", + |"language": ["English"],"mimeType": "application/vnd.ekstep.content-collection","idealScreenSize": "normal","createdOn": "2021-05-20T08:58:33.475+0000", + |"objectType": "Content","primaryCategory": "Textbook Unit","children": [{"ownershipType": ["createdBy"],"parent": "do_1132833371215872001720", + |"previewUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/assets/do_1132339274094346241120/test-874-kb.mp4", + |"channel": "b00bc992ef25f1a9a8d63291e20efc8d", + |"downloadUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132339274094346241120/untitled-content_1616331971279_do_1132339274094346241120_14.0.ecar", + |"organisation": ["Sunbird"],"language": ["English"],"mimeType": "video/mp4","variants": {"spine": + |{"ecarUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132339274094346241120/untitled-content_1616331975047_do_1132339274094346241120_14.0_spine.ecar","size": 1381.0}},"objectType": "Content","primaryCategory": "Learning Resource","appId": "local.sunbird.portal","contentEncoding": "identity","artifactUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/assets/do_1132339274094346241120/test-874-kb.mp4", + |"lockKey": "34a029c4-ac81-4934-9792-11b7a57d6c13","sYS_INTERNAL_LAST_UPDATED_ON": "2021-03-21T13:20:24.579+0000","contentType": "Resource", + |"trackable": {"enabled": "No","autoBatch": "No"},"identifier": "do_1132339274094346241120","audience": ["Student"],"visibility": "Default", + |"consumerId": "273f3b18-5dda-4a27-984a-060c7cd398d3","index": 1,"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"], + |"lastPublishedBy": "8454cb21-3ce9-4e30-85b5-fade097880d8","version": 2,"license": "CC BY 4.0","prevState": "Live","size": 849897.0, + |"lastPublishedOn": "2021-03-21T13:06:11.272+0000","name": "Untitled Content","status": "Live","code": "a88b0257-670b-455b-98b8-6e359ebac009","credentials": {"enabled": "No"},"prevStatus": "Processing","description": "updated","streamingUrl": "https://sunbirddevmedia-inct.streaming.media.azure.net/9c0ebb33-af08-403f-afb4-eb24749f40a1/test-874-kb.ism/manifest(format=m3u8-aapl-v3)","idealScreenSize": "normal","createdOn": "2021-03-11T13:34:14.475+0000","contentDisposition": "inline","lastUpdatedOn": "2021-03-21T13:06:09.526+0000","dialcodeRequired": "No","lastStatusChangedOn": "2021-03-21T18:36:15.799+0530","createdFor": ["ORG_001"],"creator": "Reviewer User","os": ["All"],"se_FWIds": ["NCFCOPY"],"pkgVersion": 14.0,"versionKey": "1616331969523","idealScreenDensity": "hdpi","framework": "NCFCOPY","depth": 4,"s3Key": "ecar_files/do_1132339274094346241120/untitled-content_1616331971279_do_1132339274094346241120_14.0.ecar","createdBy": "95e4942d-cbe8-477d-aebd-ad8e6de4bfc8","compatibilityLevel": 1,"resourceType": "Learn"},{"ownershipType": ["createdBy"],"parent": "do_1132833371215872001720","unitIdentifiers": ["do_1132239562839900161634"],"copyright": "2021 MIT","previewUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_113223967141863424174-latest","plugins": [{"identifier": "org.sunbird.questionunit.quml","semanticVersion": "1.1"}],"subject": ["Hindi"],"channel": "01309282781705830427","downloadUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_113223967141863424174/esa_1614253812772_do_113223967141863424174_1.0.ecar","language": ["English"],"source": "https://dock.sunbirded.org/api/content/v1/read/do_1132239617341767681638","mimeType": "application/vnd.ekstep.ecml-archive","variants": {"spine": {"ecarUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_113223967141863424174/esa_1614253813394_do_113223967141863424174_1.0_spine.ecar","size": 24293.0}},"objectType": "Content","se_mediums": ["English"],"gradeLevel": ["Class 10"],"primaryCategory": "Exam Question","appId": "dev.dock.portal","contentEncoding": "gzip","artifactUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_113223967141863424174/artifact/1614253223147_do_1132239617341767681638.zip","sYS_INTERNAL_LAST_UPDATED_ON": "2021-02-25T11:50:16.032+0000","contentType": "Resource","se_gradeLevels": ["Class 10"],"trackable": {"enabled": "No","autoBatch": "No"},"identifier": "do_113223967141863424174","audience": ["Student"],"visibility": "Default","author": "anusha","maxQuestions": 1,"consumerId": "b7054510-3ca4-49fd-b373-b100b3f65e18","index": 2,"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"],"lastPublishedBy": "5a587cc1-e018-4859-a0a8-e842650b9d64","version": 2,"se_subjects": ["Hindi"],"license": "CC BY 4.0","prevState": "Review","size": 384798.0,"lastPublishedOn": "2021-02-25T11:50:12.771+0000","name": "esa","topic": ["तोप"],"status": "Live","code": "d19f43ce-753d-2c70-a9fd-70302af424a0","credentials": {"enabled": "No"},"prevStatus": "Processing","origin": "do_1132239617341767681638","streamingUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_113223967141863424174-latest","medium": ["English"],"idealScreenSize": "normal","createdOn": "2021-02-25T11:50:01.500+0000","se_boards": ["CBSE"],"processId": "2b00cca7-42d5-4e35-aa03-1c22dfe03de8","contentDisposition": "inline","lastUpdatedOn": "2021-02-25T11:50:12.678+0000","originData": {"identifier": "do_1132239617341767681638","repository": "https://dock.sunbirded.org/api/content/v1/read/do_1132239617341767681638"},"collectionId": "do_1132239562836049921627","dialcodeRequired": "No","editorVersion": 3,"lastStatusChangedOn": "2021-02-25T11:50:16.017+0000","creator": "anusha","os": ["All"],"questionCategories": ["SA"],"cloudStorageKey": "content/do_113223967141863424174/artifact/1614253223147_do_1132239617341767681638.zip","se_FWIds": ["ekstep_ncert_k-12"],"marks": "12","bloomsLevel": ["Apply"],"pkgVersion": 1.0,"versionKey": "1614253812678","idealScreenDensity": "hdpi","framework": "ekstep_ncert_k-12","depth": 4,"s3Key": "ecar_files/do_113223967141863424174/esa_1614253812772_do_113223967141863424174_1.0.ecar","lastSubmittedOn": "2021-02-25T11:50:11.539+0000","createdBy": "19ba0e4e-9285-4335-8dd0-f674bf03fa4d","se_topics": ["तोप"],"compatibilityLevel": 1,"itemSetPreviewUrl": "https://dockstorage.blob.core.windows.net/sunbird-content-dock/content/do_1132239617341767681638/artifact/do_1132239617341767681638_1614253222002.pdf","board": "CBSE","programId": "463cfa30-775c-11eb-8c56-93946e419809"}],"contentDisposition": "inline","lastUpdatedOn": "2021-05-20T08:58:33.475+0000","contentEncoding": "gzip","contentType": "TextBookUnit","dialcodeRequired": "Yes","identifier": "do_1132833371215872001720","lastStatusChangedOn": "2021-05-20T08:58:33.475+0000","audience": ["Student"],"os": ["All"],"visibility": "Parent","discussionForum": {"enabled": "Yes"},"index": 1,"mediaType": "content","osId": "org.ekstep.launcher","languageCode": ["en"],"version": 2,"versionKey": "1621501113475","license": "CC BY 4.0","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 3,"compatibilityLevel": 1,"name": "5.1.1 Key parts in the head","topic": [],"status": "Draft"},{"ownershipType": ["createdBy"],"parent": "do_1132833371215134721712","code": "do_1132828084876165121519","keywords": [],"credentials": {"enabled": "No"},"channel": "0126825293972439041","description": "","language": ["English"],"mimeType": "application/vnd.ekstep.content-collection","idealScreenSize": "normal","createdOn": "2021-05-20T08:58:33.473+0000","objectType": "Content","primaryCategory": "Textbook Unit","contentDisposition": "inline","lastUpdatedOn": "2021-05-20T08:58:33.473+0000","contentEncoding": "gzip","contentType": "TextBookUnit","dialcodeRequired": "No","identifier": "do_1132833371215708161718","lastStatusChangedOn": "2021-05-20T08:58:33.473+0000","audience": ["Student"],"os": ["All"],"visibility": "Parent","discussionForum": {"enabled": "Yes"},"index": 2,"mediaType": "content","osId": "org.ekstep.launcher","languageCode": ["en"],"version": 2,"versionKey": "1621501113473","license": "CC BY 4.0","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 3,"compatibilityLevel": 1,"name": "5.1.2 Other parts","topic": [],"status": "Draft"},{"ownershipType": ["createdBy"],"parent": "do_1132833371215134721712","unitIdentifiers": ["do_11323721176414617611924"],"copyright": "2021 MIT","organisationId": "e7328d77-42a7-44c8-84f4-8cfea235f07d","previewUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_1132372524622561281279-latest","plugins": [{"identifier": "org.sunbird.questionunit.quml","semanticVersion": "1.1"}],"subject": ["Mathematics"],"channel": "01309282781705830427","downloadUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132372524622561281279/untitled_1615875562931_do_1132372524622561281279_1.0.ecar","language": ["English"],"source": "https://dock.sunbirded.org/api/content/v1/read/do_11323724954450329611930","mimeType": "application/vnd.ekstep.ecml-archive","variants": {"spine": {"ecarUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132372524622561281279/untitled_1615875563539_do_1132372524622561281279_1.0_spine.ecar","size": 19563.0}},"objectType": "Content","se_mediums": ["English"],"gradeLevel": ["Class 5"],"primaryCategory": "Exam Question","appId": "dev.dock.portal","contentEncoding": "gzip","artifactUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_1132372524622561281279/artifact/1615875430184_do_11323724954450329611930.zip","sYS_INTERNAL_LAST_UPDATED_ON": "2021-03-16T06:19:26.162+0000","contentType": "Resource","se_gradeLevels": ["Class 5"],"trackable": {"enabled": "No","autoBatch": "No"},"identifier": "do_1132372524622561281279","audience": ["Student"],"visibility": "Default","author": "N18","maxQuestions": 1,"consumerId": "f73cfcc5-4d43-4fa0-8b81-46166c81bc2b","learningOutcome": ["identify the need to find area and perimeter of rectangle and square."],"index": 3,"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"],"lastPublishedBy": "5a587cc1-e018-4859-a0a8-e842650b9d64","version": 2,"se_subjects": ["Mathematics"],"license": "CC BY 4.0","prevState": "Review","size": 374996.0,"lastPublishedOn": "2021-03-16T06:19:22.931+0000","name": "Untitled","topic": ["Speed, Distance and Time"],"status": "Live","code": "2544c8b8-7946-b6c0-e1c7-ced4aee4ea8c","credentials": {"enabled": "No"},"prevStatus": "Processing","origin": "do_11323724954450329611930","streamingUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_1132372524622561281279-latest","medium": ["English"],"idealScreenSize": "normal","createdOn": "2021-03-16T06:19:04.712+0000","se_boards": ["CBSE"],"processId": "9995e013-a7c9-4da1-b2c9-2f59da33414a","contentDisposition": "inline","lastUpdatedOn": "2021-03-16T06:19:20.817+0000","originData": {"identifier": "do_11323724954450329611930","repository": "https://dock.sunbirded.org/api/content/v1/read/do_11323724954450329611930"},"collectionId": "do_11323721176353996811921","dialcodeRequired": "No","editorVersion": 3,"lastStatusChangedOn": "2021-03-16T06:19:26.147+0000","creator": "N18","os": ["All"],"questionCategories": ["MTF"],"cloudStorageKey": "content/do_1132372524622561281279/artifact/1615875430184_do_11323724954450329611930.zip","se_FWIds": ["ekstep_ncert_k-12"],"marks": "2","bloomsLevel": ["Apply"],"pkgVersion": 1.0,"versionKey": "1615875560817","idealScreenDensity": "hdpi","framework": "ekstep_ncert_k-12","depth": 3,"s3Key": "ecar_files/do_1132372524622561281279/untitled_1615875562931_do_1132372524622561281279_1.0.ecar","lastSubmittedOn": "2021-03-16T06:19:17.005+0000","createdBy": "60f91e9e-34ee-4f9f-a907-d312d0e8063e","se_topics": ["Speed, Distance and Time"],"compatibilityLevel": 1,"itemSetPreviewUrl": "https://dockstorage.blob.core.windows.net/sunbird-content-dock/content/do_11323724954450329611930/artifact/do_11323724954450329611930_1615875429226.pdf","board": "CBSE","programId": "800eb440-8613-11eb-a663-4f63bbe94184"}],"contentDisposition": "inline","lastUpdatedOn": "2021-05-20T08:58:33.466+0000","contentEncoding": "gzip","contentType": "TextBookUnit","dialcodeRequired": "Yes","identifier": "do_1132833371215134721712","lastStatusChangedOn": "2021-05-20T08:58:33.466+0000","audience": ["Student"],"os": ["All"],"visibility": "Parent","discussionForum": {"enabled": "Yes"},"index": 1,"mediaType": "content","osId": "org.ekstep.launcher","languageCode": ["en"],"version": 2,"versionKey": "1621501113466","license": "CC BY 4.0","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 2,"compatibilityLevel": 1,"name": "5.1 Parts of Body","topic": ["Role Of The Sense Organs"],"status": "Draft"},{"ownershipType": ["createdBy"],"parent": "do_2222","code": "do_1132828084877066241529","keywords": [],"credentials": {"enabled": "No"},"channel": "0126825293972439041","description": "","language": ["English"],"mimeType": "application/vnd.ekstep.content-collection","idealScreenSize": "normal","createdOn": "2021-05-20T08:58:33.476+0000","objectType": "Content","primaryCategory": "Textbook Unit","children": [{"ownershipType": ["createdBy"],"parent": "do_1132833371215953921722","code": "do_1132828084876492801521","keywords": ["test key","check"],"credentials": {"enabled": "No"},"channel": "0126825293972439041","description": "","language": ["English"],"mimeType": "application/vnd.ekstep.content-collection","idealScreenSize": "normal","createdOn": "2021-05-20T08:58:33.468+0000","objectType": "Content","primaryCategory": "Textbook Unit","children": [{"ownershipType": ["createdBy"],"parent": "do_1132833371215298561714","code": "do_1132828084876820481527","keywords": ["abcd","cgf"],"credentials": {"enabled": "No"},"channel": "0126825293972439041","description": "labeled new","language": ["English"],"mimeType": "application/vnd.ekstep.content-collection","idealScreenSize": "normal","createdOn": "2021-05-20T08:58:33.464+0000","objectType": "Content","primaryCategory": "Textbook Unit","children": [{"ownershipType": ["createdBy"],"parent": "do_1132833371214970881710","previewUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/assets/do_1132338069147811841118/test-874-kb.mp4","channel": "b00bc992ef25f1a9a8d63291e20efc8d","downloadUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132338069147811841118/untitled-content_1615468830522_do_1132338069147811841118_2.0.ecar","organisation": ["Sunbird"],"language": ["English"],"mimeType": "video/mp4","variants": {"spine": {"ecarUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132338069147811841118/untitled-content_1615468834470_do_1132338069147811841118_2.0_spine.ecar","size": 1361.0}},"objectType": "Content","primaryCategory": "Learning Resource","appId": "dev.sunbird.portal","contentEncoding": "identity","artifactUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/assets/do_1132338069147811841118/test-874-kb.mp4","lockKey": "d73707c8-9999-4fc9-9b34-0207f74faf43","sYS_INTERNAL_LAST_UPDATED_ON": "2021-03-12T08:10:31.335+0000","contentType": "Resource","trackable": {"enabled": "No","autoBatch": "No"},"identifier": "do_1132338069147811841118","audience": ["Student"],"visibility": "Default","consumerId": "273f3b18-5dda-4a27-984a-060c7cd398d3","index": 1,"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"],"lastPublishedBy": "8454cb21-3ce9-4e30-85b5-fade097880d8","version": 2,"license": "CC BY 4.0","prevState": "Live","size": 849876.0,"lastPublishedOn": "2021-03-11T13:20:30.514+0000","name": "Untitled Content","status": "Live","code": "9deb2c69-7240-472a-98e7-ed438e76262b","credentials": {"enabled": "No"},"prevStatus": "Processing","streamingUrl": "https://sunbirddevmedia-inct.streaming.media.azure.net/f17bccc5-cab3-4da8-a5eb-11d7211f1507/test-874-kb.ism/manifest(format=m3u8-aapl-v3)","idealScreenSize": "normal","createdOn": "2021-03-11T09:29:05.654+0000","contentDisposition": "inline","lastUpdatedOn": "2021-03-11T13:20:28.256+0000","dialcodeRequired": "No","lastStatusChangedOn": "2021-03-11T18:50:28.256+0530","createdFor": ["ORG_001"],"creator": "Reviewer User","os": ["All"],"se_FWIds": ["NCFCOPY"],"pkgVersion": 2.0,"versionKey": "1615455090358","idealScreenDensity": "hdpi","framework": "NCFCOPY","depth": 5,"s3Key": "ecar_files/do_1132338069147811841118/untitled-content_1615468830522_do_1132338069147811841118_2.0.ecar","createdBy": "95e4942d-cbe8-477d-aebd-ad8e6de4bfc8","compatibilityLevel": 1,"resourceType": "Learn"},{"ownershipType": ["createdBy"],"parent": "do_1132833371214970881710","unitIdentifiers": ["do_1132238266042040321422"],"copyright": "2021 MIT","previewUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_11322383952751820816-latest","plugins": [{"identifier": "org.sunbird.questionunit.quml","semanticVersion": "1.1"}],"subject": ["Hindi"],"channel": "01309282781705830427","downloadUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_11322383952751820816/sapractice_1614238238045_do_11322383952751820816_1.0.ecar","language": ["English"],"source": "https://dock.sunbirded.org/api/content/v1/read/do_1132238287156183041424","mimeType": "application/vnd.ekstep.ecml-archive","variants": {"spine": {"ecarUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_11322383952751820816/sapractice_1614238238800_do_11322383952751820816_1.0_spine.ecar","size": 13171.0}},"objectType": "Content","se_mediums": ["English"],"gradeLevel": ["Class 10"],"primaryCategory": "Exam Question","appId": "dev.dock.portal","contentEncoding": "gzip","artifactUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11322383952751820816/artifact/1614237122171_do_1132238287156183041424.zip","sYS_INTERNAL_LAST_UPDATED_ON": "2021-02-25T07:30:44.916+0000","contentType": "Resource","se_gradeLevels": ["Class 10"],"trackable": {"enabled": "No","autoBatch": "No"},"identifier": "do_11322383952751820816","audience": ["Student"],"visibility": "Default","author": "anusha","maxQuestions": 1,"consumerId": "273f3b18-5dda-4a27-984a-060c7cd398d3","index": 2,"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"],"lastPublishedBy": "5a587cc1-e018-4859-a0a8-e842650b9d64","version": 2,"se_subjects": ["Hindi"],"license": "CC BY 4.0","prevState": "Review","size": 362236.0,"lastPublishedOn": "2021-02-25T07:30:38.043+0000","name": "sa:practice","status": "Live","code": "f239c77e-ed71-9133-0145-7468a92bce79","credentials": {"enabled": "No"},"prevStatus": "Processing","origin": "do_1132238287156183041424","streamingUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_11322383952751820816-latest","medium": ["English"],"idealScreenSize": "normal","createdOn": "2021-02-25T07:30:23.577+0000","se_boards": ["CBSE"],"processId": "04d5aec9-ed09-4a57-963d-9fa654fecf8d","contentDisposition": "inline","lastUpdatedOn": "2021-02-25T07:30:37.956+0000","originData": {"identifier": "do_1132238287156183041424","repository": "https://dock.sunbirded.org/api/content/v1/read/do_1132238287156183041424"},"collectionId": "do_1132238266036551681415","dialcodeRequired": "No","editorVersion": 3,"lastStatusChangedOn": "2021-02-25T07:30:44.908+0000","creator": "anusha","os": ["All"],"questionCategories": ["SA"],"cloudStorageKey": "content/do_11322383952751820816/artifact/1614237122171_do_1132238287156183041424.zip","se_FWIds": ["ekstep_ncert_k-12"],"marks": "12","pkgVersion": 1.0,"versionKey": "1614238237956","idealScreenDensity": "hdpi","framework": "ekstep_ncert_k-12","depth": 5,"s3Key": "ecar_files/do_11322383952751820816/sapractice_1614238238045_do_11322383952751820816_1.0.ecar","lastSubmittedOn": "2021-02-25T07:30:36.709+0000","createdBy": "19ba0e4e-9285-4335-8dd0-f674bf03fa4d","compatibilityLevel": 1,"itemSetPreviewUrl": "https://dockstorage.blob.core.windows.net/sunbird-content-dock/content/do_1132238287156183041424/artifact/do_1132238287156183041424_1614237121022.pdf","board": "CBSE","programId": "94564340-7737-11eb-96e0-29a9f8ed81cf"},{"ownershipType": ["createdBy"],"parent": "do_1132833371214970881710","unitIdentifiers": ["do_11322165488232038412588"],"copyright": "2021 MIT","previewUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_1132216902566133761410-latest","plugins": [{"identifier": "org.sunbird.questionunit.quml","semanticVersion": "1.1"}],"subject": ["Environmental Studies"],"channel": "01309282781705830427","downloadUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132216902566133761410/mcqmcq_1613975872529_do_1132216902566133761410_1.0.ecar","language": ["English"],"source": "https://dock.sunbirded.org/api/content/v1/read/do_11322168163282944012605","mimeType": "application/vnd.ekstep.ecml-archive","variants": {"spine": {"ecarUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132216902566133761410/mcqmcq_1613975873161_do_1132216902566133761410_1.0_spine.ecar","size": 17182.0}},"objectType": "Content","se_mediums": ["English"],"gradeLevel": ["Class 10"],"primaryCategory": "Exam Question","appId": "dev.dock.portal","contentEncoding": "gzip","artifactUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_1132216902566133761410/artifact/1613975740738_do_11322168163282944012605.zip","sYS_INTERNAL_LAST_UPDATED_ON": "2021-02-22T06:37:55.328+0000","contentType": "Resource","se_gradeLevels": ["Class 10"],"trackable": {"enabled": "No","autoBatch": "No"},"identifier": "do_1132216902566133761410","audience": ["Student"],"visibility": "Default","author": "color4","maxQuestions": 1,"consumerId": "7411b6bd-89f3-40ec-98d1-229dc64ce77d","learningOutcome": ["Understand the importance of values in life"],"index": 3,"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"],"lastPublishedBy": "ae94b68c-a535-4dce-8e7a-fb9662b0ad68","version": 2,"se_subjects": ["Environmental Studies"],"license": "CC BY 4.0","prevState": "Review","size": 370363.0,"lastPublishedOn": "2021-02-22T06:37:52.529+0000","name": "MCQMCQ","topic": ["Animals"],"status": "Live","code": "0cbae0f8-e3eb-1d31-e2e5-0337dc7d697d","credentials": {"enabled": "No"},"prevStatus": "Processing","origin": "do_11322168163282944012605","streamingUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/ecml/do_1132216902566133761410-latest","medium": ["English"],"idealScreenSize": "normal","createdOn": "2021-02-22T06:37:41.405+0000","se_boards": ["CBSE"],"processId": "fbcec2af-cb7a-4ed1-8683-ff04b475947e","contentDisposition": "inline","lastUpdatedOn": "2021-02-22T06:37:52.447+0000","originData": {"identifier": "do_11322168163282944012605","repository": "https://dock.sunbirded.org/api/content/v1/read/do_11322168163282944012605"},"collectionId": "do_11322165488181248012584","dialcodeRequired": "No","editorVersion": 3,"lastStatusChangedOn": "2021-02-22T06:37:55.314+0000","creator": "color4","os": ["All"],"questionCategories": ["MCQ"],"cloudStorageKey": "content/do_1132216902566133761410/artifact/1613975740738_do_11322168163282944012605.zip","se_FWIds": ["ekstep_ncert_k-12"],"marks": "1","bloomsLevel": ["Understand"],"pkgVersion": 1.0,"versionKey": "1613975872447","idealScreenDensity": "hdpi","framework": "ekstep_ncert_k-12","depth": 5,"s3Key": "ecar_files/do_1132216902566133761410/mcqmcq_1613975872529_do_1132216902566133761410_1.0.ecar","lastSubmittedOn": "2021-02-22T06:37:51.179+0000","createdBy": "0ce5b67e-b48e-489b-a818-e938e8bfc14b","se_topics": ["Animals"],"compatibilityLevel": 1,"itemSetPreviewUrl": "https://dockstorage.blob.core.windows.net/sunbird-content-dock/content/do_11322168163282944012605/artifact/do_11322168163282944012605_1613975739805.pdf","board": "CBSE","programId": "b2433a00-74cd-11eb-9f3c-f39a9ab9f5ce"}],"contentDisposition": "inline","lastUpdatedOn": "2021-05-20T08:58:33.464+0000","contentEncoding": "gzip","contentType": "TextBookUnit","dialcodeRequired": "Yes","identifier": "do_1132833371214970881710","lastStatusChangedOn": "2021-05-20T08:58:33.464+0000","audience": ["Student"],"os": ["All"],"visibility": "Parent","discussionForum": {"enabled": "Yes"},"index": 1,"mediaType": "content","osId": "org.ekstep.launcher","languageCode": ["en"],"version": 2,"versionKey": "1621501113464","license": "CC BY 4.0","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 4,"compatibilityLevel": 1,"name": "dsffgdg","topic": [],"status": "Draft"}],"contentDisposition": "inline","lastUpdatedOn": "2021-05-20T08:58:33.468+0000","contentEncoding": "gzip","contentType": "TextBookUnit","dialcodeRequired": "No","identifier": "do_1132833371215298561714","lastStatusChangedOn": "2021-05-20T08:58:33.468+0000","audience": ["Student"],"os": ["All"],"visibility": "Parent","discussionForum": {"enabled": "Yes"},"index": 1,"mediaType": "content","osId": "org.ekstep.launcher","languageCode": ["en"],"version": 2,"versionKey": "1621501113468","license": "CC BY 4.0","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 3,"compatibilityLevel": 1,"name": "5.2.1 Respiratory System","topic": ["Look and say","Role Of The Sense Organs"],"status": "Draft"}],"contentDisposition": "inline","lastUpdatedOn": "2021-05-20T08:58:33.476+0000","contentEncoding": "gzip","contentType": "TextBookUnit","dialcodeRequired": "No","identifier": "do_1132833371215953921722","lastStatusChangedOn": "2021-05-20T08:58:33.476+0000","audience": ["Student"],"os": ["All"],"visibility": "Parent","discussionForum": {"enabled": "Yes"},"index": 2,"mediaType": "content","osId": "org.ekstep.launcher","languageCode": ["en"],"version": 2,"versionKey": "1621501113476","license": "CC BY 4.0","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 2,"compatibilityLevel": 1,"name": "5.2 Organ Systems","topic": [],"status": "Draft"},{"ownershipType": ["createdBy"],"parent": "do_2222","copyright": "Sunbird","previewUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/assets/do_1132344630588948481134/test-874-kb.mp4","subject": ["Math"],"channel": "b00bc992ef25f1a9a8d63291e20efc8d","downloadUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132344630588948481134/untitled-content_1615535618825_do_1132344630588948481134_2.0.ecar","organisation": ["Sunbird"],"showNotification": true,"language": ["English"],"mimeType": "video/mp4","variants": {"spine": {"ecarUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/ecar_files/do_1132344630588948481134/untitled-content_1615535619590_do_1132344630588948481134_2.0_spine.ecar","size": 35301.0}},"objectType": "Content","se_mediums": ["English"],"gradeLevel": ["Grade 1"],"appIcon": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_1132344630588948481134/artifact/2a4b8abd789184932399d222d03d9b5c.thumb.jpg","primaryCategory": "Learning Resource","appId": "dev.sunbird.portal","contentEncoding": "identity","artifactUrl": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/assets/do_1132344630588948481134/test-874-kb.mp4","lockKey": "1d28d983-2704-44bd-803e-5feb4e62da62","sYS_INTERNAL_LAST_UPDATED_ON": "2021-03-12T08:10:34.367+0000","contentType": "Resource","se_gradeLevels": ["Grade 1"],"trackable": {"enabled": "No","autoBatch": "No"},"identifier": "do_1132344630588948481134","lastUpdatedBy": "95e4942d-cbe8-477d-aebd-ad8e6de4bfc8","audience": ["Student"],"visibility": "Default","consumerId": "273f3b18-5dda-4a27-984a-060c7cd398d3","index": 3,"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"],"lastPublishedBy": "8454cb21-3ce9-4e30-85b5-fade097880d8","version": 2,"se_subjects": ["Math"],"license": "CC BY 4.0","prevState": "Review","size": 883817.0,"lastPublishedOn": "2021-03-12T07:53:38.825+0000","name": "Untitled Content","status": "Live","code": "8851e754-6e20-44d4-9070-e1a9664163ad","credentials": {"enabled": "No"},"prevStatus": "Review","description": "updated desrciption","streamingUrl": "https://sunbirddevmedia-inct.streaming.media.azure.net/40ae07aa-069e-4056-8f2b-014bc9a2d21b/test-874-kb.ism/manifest(format=m3u8-aapl-v3)","medium": ["English"],"posterImage": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11299104587967692816/artifact/2a4b8abd789184932399d222d03d9b5c.jpg","idealScreenSize": "normal","createdOn": "2021-03-12T07:44:01.371+0000","se_boards": ["NCERT"],"copyrightYear": 2020,"contentDisposition": "inline","licenseterms": "By creating any type of content (resources, books, courses etc.) on DIKSHA, you consent to publish it under the Creative Commons License Framework. Please choose the applicable creative commons license you wish to apply to your content.","lastUpdatedOn": "2021-03-12T07:53:38.505+0000","dialcodeRequired": "No","lastStatusChangedOn": "2021-03-12T07:53:38.494+0000","createdFor": ["ORG_001"],"creator": "Reviewer User","os": ["All"],"se_FWIds": ["NCFCOPY"],"pkgVersion": 2.0,"versionKey": "1615535618583","idealScreenDensity": "hdpi","framework": "NCFCOPY","depth": 2,"s3Key": "ecar_files/do_1132344630588948481134/untitled-content_1615535618825_do_1132344630588948481134_2.0.ecar","lastSubmittedOn": "2021-03-12T07:53:10.005+0000","createdBy": "95e4942d-cbe8-477d-aebd-ad8e6de4bfc8","compatibilityLevel": 1,"board": "NCERT","resourceType": "Learn"}],"contentDisposition": "inline","lastUpdatedOn": "2021-05-20T08:58:33.470+0000","contentEncoding": "gzip","contentType": "TextBookUnit","dialcodeRequired": "No","identifier": "do_2222","lastStatusChangedOn": "2021-05-20T08:58:33.470+0000","audience": ["Student"],"os": ["All"],"visibility": "Parent","discussionForum": {"enabled": "Yes"},"index": 1,"mediaType": "content","osId": "org.ekstep.launcher","languageCode": ["en"],"version": 2,"versionKey": "1621501113470","license": "CC BY 4.0","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 1,"compatibilityLevel": 1,"name": "5. Human Body","topic": [],"status": "Draft"}],"appId": "dev.sunbird.portal","contentEncoding": "gzip","sYS_INTERNAL_LAST_UPDATED_ON": "2021-05-20T09:12:06.988+0000","contentType": "TextBook","trackable": {"enabled": "No","autoBatch": "No"},"identifier": "$contentId","audience": ["Student"],"visibility": "Default","consumerId": "01814e02-fc27-4165-ae53-3d1816e55817","childNodes": ["do_1132339274094346241120","do_1132833371215872001720","do_1132833371215134721712","do_2222","do_113223967141863424174","do_1132833371214970881710","do_1132833371215708161718","do_1132372524622561281279","do_1132338069147811841118","do_1132833371215298561714","do_1132833371215953921722","do_11322383952751820816","do_1132216902566133761410","do_1132344630588948481134"],"discussionForum": {"enabled": "Yes"},"mediaType": "content","osId": "org.ekstep.quiz.app","languageCode": ["en"],"version": 2,"license": "CC BY 4.0","name": "TestCSVUpload","status": "Draft","code": "org.sunbird.yhqB6L","credentials": {"enabled": "No"},"description": "Enter description for TextBook","medium": ["English"],"idealScreenSize": "normal","createdOn": "2021-05-19T15:00:44.279+0000","contentDisposition": "inline","additionalCategories": ["Textbook"],"lastUpdatedOn": "2021-05-20T07:10:32.805+0000","dialcodeRequired": "No","lastStatusChangedOn": "2021-05-19T15:00:44.279+0000","createdFor": ["0126825293972439041"],"creator": "Book Creator","os": ["All"],"versionKey": "1621501113536","idealScreenDensity": "hdpi","framework": "tn_k-12","depth": 0,"createdBy": "8454cb21-3ce9-4e30-85b5-fade097880d8","compatibilityLevel": 1,"userConsent": "Yes","board": "State (Tamil Nadu)","resourceType": "Book"}""".stripMargin + val response = new Response + response.put("hierarchy", hierarchyString) + } + + def getReserveDIALRequest(identifier: String): Request = { + val request = new Request() + request.setObjectType("Content") + request.setContext(getContext()) + request.getContext.put("identifier",identifier) + request.put("identifier",identifier) + request.putAll(getReserveRequest()) + request + } + + def getReserveRequest():util.Map[String, AnyRef] = { + val reqMap : java.util.Map[String, AnyRef] = new util.HashMap[String, AnyRef](){ + put("dialcodes", new util.HashMap[String, AnyRef](){ + put("count", 12.asInstanceOf[Integer]) + put("qrCodeSpec", new util.HashMap[String, AnyRef](){ + put("errorCorrectionLevel", "H") + }) + }) + } + reqMap + } + + def getReleaseDIALRequest(identifier: String): Request = { + val request = new Request() + request.setObjectType("Content") + request.setContext(getContext()) + request.getContext.put("identifier",identifier) + request.put("identifier",identifier) + request.putAll(getReleaseRequest()) + request + } + + def getReleaseRequest():util.Map[String, AnyRef] = { + val reqMap : java.util.Map[String, AnyRef] = new util.HashMap[String, AnyRef](){ + put("dialcodes", new util.HashMap[String, AnyRef](){ + put("count", 2.asInstanceOf[Integer]) + }) + } + reqMap + } + + def getGenerateDIALResponse:Response = { + val resString = "{\"id\": \"api.dialcode.generate\",\"ver\": \"1.0\",\"ts\": \"2022-07-05T09:47:26.000Z\",\"params\": {\"resmsgid\": \"79eb8b00-fc47-11ec-af25-0f53946b16ec\",\"msgid\": \"79be1260-fc47-11ec-8c03-63ca5ce41074\",\"status\": \"successful\",\"err\": null,\"errmsg\": null},\"responseCode\": \"OK\",\"result\": {\"dialcodes\": [\"K2C3R6\",\"H2E8F9\"],\"count\": 2,\"batchcode\": \"do_11357423520695910411\",\"publisher\": null}}" + JsonUtils.deserialize(resString, classOf[Response]) + } } \ No newline at end of file diff --git a/content-api/content-service/app/controllers/v3/ContentController.scala b/content-api/content-service/app/controllers/v3/ContentController.scala index 05c5b2470..4534fe828 100644 --- a/content-api/content-service/app/controllers/v3/ContentController.scala +++ b/content-api/content-service/app/controllers/v3/ContentController.scala @@ -148,9 +148,27 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor: } def publish(identifier: String) = Action.async { implicit request => - val result = ResponseHandler.OK() - val response = JavaJsonUtils.serialize(result) - Future(Ok(response).as("application/json")) + val headers = commonHeaders() + val body = requestBody() + val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]]; + content.putAll(headers) + val contentRequest = getRequest(content, headers, "publishContent") + setRequestContext(contentRequest, version, objectType, schemaName) + contentRequest.getContext.put("identifier", identifier); + contentRequest.getContext.put("publish_type", "public"); + getResult(ApiId.PUBLISH_CONTENT_PUBLIC, contentActor, contentRequest) + } + + def publishUnlisted(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]]; + content.putAll(headers) + val contentRequest = getRequest(content, headers, "publishContent") + setRequestContext(contentRequest, version, objectType, schemaName) + contentRequest.getContext.put("identifier", identifier); + contentRequest.getContext.put("publish_type", "unlisted"); + getResult(ApiId.PUBLISH_CONTENT_UNLSTED, contentActor, contentRequest) } def review(identifier: String) = Action.async { implicit request => @@ -206,21 +224,23 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor: } def reserveDialCode(identifier: String) = Action.async { implicit request => - val result = ResponseHandler.OK() - val response = JavaJsonUtils.serialize(result) - Future(Ok(response).as("application/json")) + val headers = commonHeaders() + val body = requestBody() + body.putAll(headers) + body.putAll(Map("identifier" -> identifier).asJava) + val reserveDialCode = getRequest(body, headers, "reserveDialCode") + setRequestContext(reserveDialCode, version, objectType, schemaName) + getResult(ApiId.RESERVE_DIAL_CONTENT, contentActor, reserveDialCode) } def releaseDialcodes(identifier: String) = Action.async { implicit request => - val result = ResponseHandler.OK() - val response = JavaJsonUtils.serialize(result) - Future(Ok(response).as("application/json")) - } - - def publishUnlisted(identifier: String) = Action.async { implicit request => - val result = ResponseHandler.OK() - val response = JavaJsonUtils.serialize(result) - Future(Ok(response).as("application/json")) + val headers = commonHeaders() + val body = requestBody() + body.putAll(headers) + body.putAll(Map("identifier" -> identifier).asJava) + val releaseDialCode = getRequest(body, headers, "releaseDialCode") + setRequestContext(releaseDialCode, version, objectType, schemaName) + getResult(ApiId.RELEASE_DIAL_CONTENT, contentActor, releaseDialCode) } def upload(identifier: String, fileFormat: Option[String], validation: Option[String]) = Action.async { implicit request => diff --git a/content-api/content-service/app/controllers/v4/CollectionController.scala b/content-api/content-service/app/controllers/v4/CollectionController.scala index 2c649a219..f16a43c01 100644 --- a/content-api/content-service/app/controllers/v4/CollectionController.scala +++ b/content-api/content-service/app/controllers/v4/CollectionController.scala @@ -186,6 +186,26 @@ class CollectionController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentAc getResult(ApiId.LINK_DIAL_COLLECTION, contentActor, contentRequest, version = apiVersion) } + def reserveDialCode(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + body.putAll(headers) + body.putAll(Map("identifier" -> identifier).asJava) + val reserveDialCode = getRequest(body, headers, "reserveDialCode") + setRequestContext(reserveDialCode, version, objectType, schemaName) + getResult(ApiId.RESERVE_DIAL_COLLECTION, contentActor, reserveDialCode, version = apiVersion) + } + + def releaseDialCode(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + body.putAll(headers) + body.putAll(Map("identifier" -> identifier).asJava) + val releaseDialCode = getRequest(body, headers, "releaseDialCode") + setRequestContext(releaseDialCode, version, objectType, schemaName) + getResult(ApiId.RELEASE_DIAL_COLLECTION, contentActor, releaseDialCode, version = apiVersion) + } + def copy(identifier: String, mode: Option[String], copyType: String) = Action.async { implicit request => val headers = commonHeaders() val body = requestBody() @@ -254,5 +274,29 @@ class CollectionController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentAc getResult(ApiId.REVIEW_COLLECTION, contentActor, contentRequest, version = apiVersion) } + def publish(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]]; + content.putAll(headers) + val contentRequest = getRequest(content, headers, "publishContent") + setRequestContext(contentRequest, version, objectType, schemaName) + contentRequest.getContext.put("identifier", identifier); + contentRequest.getContext.put("publish_type", "public"); + getResult(ApiId.PUBLISH_CONTENT_PUBLIC, contentActor, contentRequest, version = apiVersion) + } + + def publishUnlisted(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]]; + content.putAll(headers) + val contentRequest = getRequest(content, headers, "publishContent") + setRequestContext(contentRequest, version, objectType, schemaName) + contentRequest.getContext.put("identifier", identifier); + contentRequest.getContext.put("publish_type", "unlisted"); + getResult(ApiId.PUBLISH_CONTENT_UNLSTED, contentActor, contentRequest, version = apiVersion) + } + } diff --git a/content-api/content-service/app/controllers/v4/ContentController.scala b/content-api/content-service/app/controllers/v4/ContentController.scala index ddf2dc45c..2bc6651a2 100644 --- a/content-api/content-service/app/controllers/v4/ContentController.scala +++ b/content-api/content-service/app/controllers/v4/ContentController.scala @@ -131,6 +131,26 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor: getResult(ApiId.LINK_DIAL_CONTENT, contentActor, contentRequest, version = apiVersion) } + def reserveDialCode(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + body.putAll(headers) + body.putAll(Map("identifier" -> identifier).asJava) + val reserveDialCode = getRequest(body, headers, "reserveDialCode") + setRequestContext(reserveDialCode, version, objectType, schemaName) + getResult(ApiId.RESERVE_DIAL_CONTENT, contentActor, reserveDialCode, version = apiVersion) + } + + def releaseDialCode(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + body.putAll(headers) + body.putAll(Map("identifier" -> identifier).asJava) + val releaseDialCode = getRequest(body, headers, "releaseDialCode") + setRequestContext(releaseDialCode, version, objectType, schemaName) + getResult(ApiId.RELEASE_DIAL_CONTENT, contentActor, releaseDialCode, version = apiVersion) + } + def upload(identifier: String, fileFormat: Option[String], validation: Option[String]) = Action.async { implicit request => val headers = commonHeaders() val content = requestFormData(identifier) @@ -208,4 +228,28 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor: getResult(ApiId.REJECT_CONTENT, contentActor, contentRequest, version = apiVersion) } + def publish(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]]; + content.putAll(headers) + val contentRequest = getRequest(content, headers, "publishContent") + setRequestContext(contentRequest, version, objectType, schemaName) + contentRequest.getContext.put("identifier", identifier); + contentRequest.getContext.put("publish_type", "public"); + getResult(ApiId.PUBLISH_CONTENT_PUBLIC, contentActor, contentRequest, version = apiVersion) + } + + def publishUnlisted(identifier: String) = Action.async { implicit request => + val headers = commonHeaders() + val body = requestBody() + val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]]; + content.putAll(headers) + val contentRequest = getRequest(content, headers, "publishContent") + setRequestContext(contentRequest, version, objectType, schemaName) + contentRequest.getContext.put("identifier", identifier); + contentRequest.getContext.put("publish_type", "unlisted"); + getResult(ApiId.PUBLISH_CONTENT_UNLSTED, contentActor, contentRequest, version = apiVersion) + } + } diff --git a/content-api/content-service/app/controllers/v4/EventController.scala b/content-api/content-service/app/controllers/v4/EventController.scala index 3b609d32b..1c5f2cc86 100644 --- a/content-api/content-service/app/controllers/v4/EventController.scala +++ b/content-api/content-service/app/controllers/v4/EventController.scala @@ -55,7 +55,7 @@ class EventController @Inject()(@Named(ActorNames.EVENT_ACTOR) eventActor: Actor } } - def publish(identifier: String): Action[AnyContent] = Action.async { implicit request => + override def publish(identifier: String): Action[AnyContent] = Action.async { implicit request => val headers = commonHeaders() val content = new java.util.HashMap[String, Object]() content.put("status", "Live") diff --git a/content-api/content-service/app/controllers/v4/EventSetController.scala b/content-api/content-service/app/controllers/v4/EventSetController.scala index e6729fae4..c1dd509c3 100644 --- a/content-api/content-service/app/controllers/v4/EventSetController.scala +++ b/content-api/content-service/app/controllers/v4/EventSetController.scala @@ -64,7 +64,7 @@ class EventSetController @Inject()(@Named(ActorNames.EVENT_SET_ACTOR) eventSetAc } } - def publish(identifier: String): Action[AnyContent] = Action.async { implicit request => + override def publish(identifier: String): Action[AnyContent] = Action.async { implicit request => val headers = commonHeaders() val content = new java.util.HashMap[String, Object]() content.put("identifier", identifier) diff --git a/content-api/content-service/app/utils/ApiId.scala b/content-api/content-service/app/utils/ApiId.scala index 7aa95ac57..e2efd2372 100644 --- a/content-api/content-service/app/utils/ApiId.scala +++ b/content-api/content-service/app/utils/ApiId.scala @@ -22,6 +22,8 @@ object ApiId { val SYSTEM_UPDATE_CONTENT = "api.content.system.update" val REVIEW_CONTENT = "api.content.review" val REJECT_CONTENT = "api.content.review.reject" + val PUBLISH_CONTENT_PUBLIC = "api.content.publish.public" + val PUBLISH_CONTENT_UNLSTED = "api.content.publish.unlisted" // Collection APIs val ADD_HIERARCHY = "api.content.hierarchy.add" @@ -29,6 +31,8 @@ object ApiId { val UPDATE_HIERARCHY = "api.content.hierarchy.update" val GET_HIERARCHY = "api.content.hierarchy.get" val LINK_DIAL_COLLECTION = "api.collection.dialcode.link" + val RESERVE_DIAL_CONTENT = "api.content.dialcode.reserve" + val RELEASE_DIAL_CONTENT = "api.content.dialcode.release" //License APIs val CREATE_LICENSE = "api.license.create" @@ -99,5 +103,6 @@ object ApiId { //Collection CSV APIs val IMPORT_CSV = "api.collection.import" val EXPORT_CSV = "api.collection.export" - + val RESERVE_DIAL_COLLECTION = "api.collection.dialcode.reserve" + val RELEASE_DIAL_COLLECTION = "api.collection.dialcode.release" } diff --git a/content-api/content-service/conf/application.conf b/content-api/content-service/conf/application.conf index 635d21da7..5a77be1c5 100644 --- a/content-api/content-service/conf/application.conf +++ b/content-api/content-service/conf/application.conf @@ -595,6 +595,7 @@ channel.fetch.suggested_frameworks=true content.h5p.library.path="https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/content/templates/h5p-library-v2.zip" kafka.topics.graph.event="sunbirddev.learning.graph.events" +kafka.publish.request.topic = "sunbirddev.publish.job.request" content.discard.status=["Draft","FlagDraft"] content.discard.remove_publish_data=["compatibilityLevel", "lastPublishedOn", "pkgVersion", "leafNodesCount", "downloadUrl", "variants"] @@ -603,8 +604,17 @@ dial_service { api { base_url = "https://qa.ekstep.in/api" auth_key = "auth_key" + search = "/dialcode/v1/search" + generate = "/api/dialcode/v1/generate" } } + +reserve_dialcode { + mimeType = ["application/vnd.ekstep.content-collection"] + max_count = 250 + valid_content_status = ["Draft","Live"] +} + content.link_dialcode.validation=true content.link_dialcode.max_limit=10 # This is added to handle large artifacts sizes differently diff --git a/content-api/content-service/conf/routes b/content-api/content-service/conf/routes index fc4c8ad83..86f74263d 100644 --- a/content-api/content-service/conf/routes +++ b/content-api/content-service/conf/routes @@ -20,7 +20,6 @@ POST /content/v3/bundle controllers.v3.ContentController POST /content/v3/flag/accept/:identifier controllers.v3.ContentController.acceptFlag(identifier:String) POST /content/v3/flag/reject/:identifier controllers.v3.ContentController.rejectFlag(identifier:String) POST /content/v3/publish/:identifier controllers.v3.ContentController.publish(identifier:String) -POST /content/v3/public/publish/:identifier controllers.v3.ContentController.publish(identifier:String) POST /content/v3/review/:identifier controllers.v3.ContentController.review(identifier:String) DELETE /content/v3/discard/:identifier controllers.v3.ContentController.discard(identifier:String) DELETE /content/v3/retire/:identifier controllers.v3.ContentController.retire(identifier:String) @@ -80,7 +79,9 @@ GET /collection/v4/hierarchy/:identifier/:bookmarkId controllers.v4.Coll POST /collection/v4/dialcode/link/:identifier controllers.v4.CollectionController.collectionLinkDialCode(identifier:String) POST /collection/v4/copy/:identifier controllers.v4.CollectionController.copy(identifier:String, mode:Option[String], type:String ?= "deep") PATCH /collection/v4/system/update/:identifier controllers.v4.CollectionController.systemUpdate(identifier:String) -POST /collection/v4/reject/:identifier controllers.v4.CollectionController.reviewReject(identifier:String) +POST /collection/v4/reject/:identifier controllers.v4.CollectionController.reviewReject(identifier:String) +POST /collection/v4/publish/:identifier controllers.v4.CollectionController.publish(identifier:String) +POST /collection/v4/unlisted/publish/:identifier controllers.v4.CollectionController.publishUnlisted(identifier:String) # Content v4 APIs POST /content/v4/create controllers.v4.ContentController.create @@ -99,6 +100,10 @@ DELETE /content/v4/retire/:identifier controllers.v4.ContentControl PATCH /content/v4/system/update/:identifier controllers.v4.ContentController.systemUpdate(identifier:String) POST /content/v4/review/:identifier controllers.v4.ContentController.review(identifier:String) POST /content/v4/reject/:identifier controllers.v4.ContentController.reviewReject(identifier:String) +POST /content/v4/dialcode/reserve/:identifier controllers.v4.ContentController.reserveDialCode(identifier:String) +POST /content/v4/dialcode/release/:identifier controllers.v4.ContentController.releaseDialCode(identifier:String) +POST /content/v4/publish/:identifier controllers.v4.ContentController.publish(identifier:String) +POST /content/v4/unlisted/publish/:identifier controllers.v4.ContentController.publishUnlisted(identifier:String) # App v4 APIs POST /app/v4/register controllers.v4.AppController.register @@ -129,4 +134,6 @@ GET /object/v4/read/:identifier controllers.v4.ObjectController # Collection V4 APIs POST /collection/v4/import/:collectionId controllers.v4.CollectionController.importCollection(collectionId:String) GET /collection/v4/export/:collectionId controllers.v4.CollectionController.exportCollection(collectionId:String, fileType:Option[String]) -POST /collection/v4/review/:identifier controllers.v4.CollectionController.review(identifier:String) \ No newline at end of file +POST /collection/v4/review/:identifier controllers.v4.CollectionController.review(identifier:String) +POST /collection/v4/dialcode/reserve/:identifier controllers.v4.CollectionController.reserveDialCode(identifier:String) +POST /collection/v4/dialcode/release/:identifier controllers.v4.CollectionController.releaseDialCode(identifier:String) \ No newline at end of file diff --git a/content-api/content-service/test/controllers/v4/CollectionSpec.scala b/content-api/content-service/test/controllers/v4/CollectionSpec.scala index ae90503db..ec0f38969 100644 --- a/content-api/content-service/test/controllers/v4/CollectionSpec.scala +++ b/content-api/content-service/test/controllers/v4/CollectionSpec.scala @@ -167,4 +167,27 @@ class CollectionSpec extends BaseSpec { status(result) must equalTo(OK) } } + + "Collection Controller with valid request " should { + "return success response for dialcode reserve API" in { + val controller = app.injector.instanceOf[controllers.v4.CollectionController] + val json: JsValue = Json.parse("""{"request": {"dialcodes": {"count": 5, "qrCodeSpec": { "errorCorrectionLevel": "H" }}}}""".stripMargin) + val fakeRequest = FakeRequest("POST", "/collection/v4/dialcode/reserve/do_123").withJsonBody(json) + val result = controller.reserveDialCode("do_123")(fakeRequest) + isOK(result) + status(result) must equalTo(OK) + } + } + + "Collection Controller with valid request " should { + "return success response for dialcode release API" in { + val controller = app.injector.instanceOf[controllers.v4.CollectionController] + val json: JsValue = Json.parse("""{"request": {"dialcodes": {"count": 1}}}""".stripMargin) + val fakeRequest = FakeRequest("POST", "/collection/v4/dialcode/release/do_123").withJsonBody(json) + val result = controller.releaseDialCode("do_123")(fakeRequest) + isOK(result) + status(result) must equalTo(OK) + } + } + } diff --git a/content-api/content-service/test/controllers/v4/ContentSpec.scala b/content-api/content-service/test/controllers/v4/ContentSpec.scala index aeb8e6238..e69c69181 100644 --- a/content-api/content-service/test/controllers/v4/ContentSpec.scala +++ b/content-api/content-service/test/controllers/v4/ContentSpec.scala @@ -191,4 +191,26 @@ class ContentSpec extends BaseSpec { } } + "Content Controller with valid request " should { + "return success response for dialcode reserve API" in { + val controller = app.injector.instanceOf[controllers.v4.ContentController] + val json: JsValue = Json.parse("""{"request": {"dialcodes": {"count": 5, "qrCodeSpec": { "errorCorrectionLevel": "H" }}}}""".stripMargin) + val fakeRequest = FakeRequest("POST", "/content/v4/dialcode/reserve/do_123").withJsonBody(json) + val result = controller.reserveDialCode("do_123")(fakeRequest) + isOK(result) + status(result) must equalTo(OK) + } + } + + "Content Controller with valid request " should { + "return success response for dialcode release API" in { + val controller = app.injector.instanceOf[controllers.v4.ContentController] + val json: JsValue = Json.parse("""{"request": {"dialcodes": {"count": 1}}}""".stripMargin) + val fakeRequest = FakeRequest("POST", "/content/v4/dialcode/release/do_123").withJsonBody(json) + val result = controller.releaseDialCode("do_123")(fakeRequest) + isOK(result) + status(result) must equalTo(OK) + } + } + } diff --git a/content-api/hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala b/content-api/hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala index 01c245c6a..fbb73934a 100644 --- a/content-api/hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala +++ b/content-api/hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala @@ -345,7 +345,7 @@ object UpdateHierarchyManager { if (MapUtils.isNotEmpty(childrenIdentifiersMap)) { val updatedNodeList = getTempNode(nodeList, rootId) :: List() updateHierarchyRelatedData(childrenIdentifiersMap.getOrElse(rootId, Map[String, Int]()), 1, - rootId, nodeList, childrenIdentifiersMap, updatedNodeList, request).map(finalEnrichedNodeList => { + rootId, nodeList, childrenIdentifiersMap, updatedNodeList, request, rootId).map(finalEnrichedNodeList => { TelemetryManager.info("Final enriched list size: " + finalEnrichedNodeList.size) val childNodeIds = finalEnrichedNodeList.map(node => node.getIdentifier.replaceAll(".img", "")).filterNot(id => StringUtils.containsIgnoreCase(rootId, id)).distinct TelemetryManager.info("Final enriched ids (childNodes): " + childNodeIds + " :: size: " + childNodeIds.size) @@ -368,7 +368,8 @@ object UpdateHierarchyManager { } @throws[Exception] - private def updateHierarchyRelatedData(childrenIds: Map[String, Int], depth: Int, parent: String, nodeList: List[Node], hierarchyStructure: Map[String, Map[String, Int]], enrichedNodeList: scala.collection.immutable.List[Node], request: Request)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[List[Node]] = { + private def updateHierarchyRelatedData(childrenIds: Map[String, Int], depth: Int, parent: String, nodeList: List[Node], hierarchyStructure: Map[String, Map[String, Int]], enrichedNodeList: scala.collection.immutable.List[Node], request: Request, rootId: String)(implicit oec: OntologyEngineContext, ec: ExecutionContext): Future[List[Node]] = { + val rootResourceChange: Boolean = if (Platform.config.hasPath("hierarchyUpdate.allow.resource.at.root.level")) Platform.config.getBoolean("hierarchyUpdate.allow.resource.at.root.level") else false val futures = childrenIds.map(child => { val id = child._1 val index = child._2 + 1 @@ -378,13 +379,19 @@ object UpdateHierarchyManager { val nxtEnrichedNodeList = tempNode :: enrichedNodeList if (MapUtils.isNotEmpty(hierarchyStructure.getOrDefault(child._1, Map[String, Int]()))) updateHierarchyRelatedData(hierarchyStructure.getOrDefault(child._1, Map[String, Int]()), - tempNode.getMetadata.get(HierarchyConstants.DEPTH).asInstanceOf[Int] + 1, id, nodeList, hierarchyStructure, nxtEnrichedNodeList, request) + tempNode.getMetadata.get(HierarchyConstants.DEPTH).asInstanceOf[Int] + 1, id, nodeList, hierarchyStructure, nxtEnrichedNodeList, request, rootId) else Future(nxtEnrichedNodeList) } else { // TelemetryManager.info("Get ContentNode as TempNode is null for ID: " + id) getContentNode(id, HierarchyConstants.TAXONOMY_ID).map(node => { - val parentNode: Node = nodeList.find(p => p.getIdentifier.equals(parent)).orNull + val parentNode: Node = if (rootResourceChange && nodeList.find(p => p.getIdentifier.equals(parent)).orNull == null) { + if (nodeList.find(p => p.getIdentifier.equals(rootId)).orNull == null) + nodeList.find(p => p.getIdentifier.equals(rootId + ".img")).orNull + else + nodeList.find(p => p.getIdentifier.equals(rootId)).orNull + } else + nodeList.find(p => p.getIdentifier.equals(parent)).orNull val nxtEnrichedNodeList = if (null != parentNode) { TelemetryManager.info(s"ObjectType for $parent is ${parentNode.getObjectType}...") val parentMetadata: java.util.Map[String, AnyRef] = NodeUtil.serialize(parentNode, new java.util.ArrayList[String](), parentNode.getObjectType.toLowerCase, "1.0") @@ -401,7 +408,7 @@ object UpdateHierarchyManager { enrichedNodeList } if (MapUtils.isNotEmpty(hierarchyStructure.getOrDefault(id, Map[String, Int]()))) { - updateHierarchyRelatedData(hierarchyStructure.getOrDefault(id, Map[String, Int]()), node.getMetadata.get(HierarchyConstants.DEPTH).asInstanceOf[Int] + 1, id, nodeList, hierarchyStructure, nxtEnrichedNodeList, request) + updateHierarchyRelatedData(hierarchyStructure.getOrDefault(id, Map[String, Int]()), node.getMetadata.get(HierarchyConstants.DEPTH).asInstanceOf[Int] + 1, id, nodeList, hierarchyStructure, nxtEnrichedNodeList, request, rootId) } else Future(nxtEnrichedNodeList) }).flatMap(f => f) recoverWith { case e: CompletionException => throw e.getCause } diff --git a/platform-modules/import-manager/pom.xml b/platform-modules/import-manager/pom.xml index 13c5fa70c..7914fcf5c 100644 --- a/platform-modules/import-manager/pom.xml +++ b/platform-modules/import-manager/pom.xml @@ -22,16 +22,6 @@ platform-telemetry 1.0-SNAPSHOT - - org.sunbird - mimetype-manager - 1.0-SNAPSHOT - - - org.sunbird - url-manager - 1.0-SNAPSHOT - org.sunbird graph-engine_2.11 diff --git a/platform-modules/mimetype-manager/pom.xml b/platform-modules/mimetype-manager/pom.xml index eb25c58f1..ea978cbd5 100644 --- a/platform-modules/mimetype-manager/pom.xml +++ b/platform-modules/mimetype-manager/pom.xml @@ -30,7 +30,7 @@ org.sunbird cloud-store-sdk - 1.3.0 + 1.4.3 org.scala-lang @@ -143,4 +143,4 @@ - \ No newline at end of file + diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala index 83fabffc8..3904888a0 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala @@ -1,16 +1,14 @@ package org.sunbird.cloudstore -import java.io.File - import org.apache.commons.lang3.StringUtils +import org.apache.tika.Tika import org.sunbird.cloud.storage.BaseStorageService -import org.sunbird.common.Platform -import org.sunbird.cloud.storage.factory.StorageConfig -import org.sunbird.cloud.storage.factory.StorageServiceFactory +import org.sunbird.cloud.storage.factory.{StorageConfig, StorageServiceFactory} +import org.sunbird.common.{Platform, Slug} import org.sunbird.common.exception.ServerException -import org.sunbird.common.Slug -import scala.concurrent.ExecutionContext +import java.io.File +import scala.concurrent.{ExecutionContext, Future} class StorageService { @@ -18,38 +16,39 @@ class StorageService { var storageService: BaseStorageService = null @throws[Exception] - def getService(): BaseStorageService = { + def getService: BaseStorageService = { if (null == storageService) { if (StringUtils.equalsIgnoreCase(storageType, "azure")) { val storageKey = Platform.config.getString("azure_storage_key") val storageSecret = Platform.config.getString("azure_storage_secret") - storageService = StorageServiceFactory.getStorageService(new StorageConfig(storageType, storageKey, storageSecret)) + storageService = StorageServiceFactory.getStorageService(StorageConfig(storageType, storageKey, storageSecret)) } else if (StringUtils.equalsIgnoreCase(storageType, "aws")) { val storageKey = Platform.config.getString("aws_storage_key") val storageSecret = Platform.config.getString("aws_storage_secret") - storageService = StorageServiceFactory.getStorageService(new StorageConfig(storageType, storageKey, storageSecret)) - } - else if (StringUtils.equalsIgnoreCase(storageType, "cephs3")) { - val storageKey = Platform.config.getString("cephs3_storage_key") - val storageSecret = Platform.config.getString("cephs3_storage_secret") - val endpoint = Platform.config.getString("cephs3_storage_endpoint") - storageService = StorageServiceFactory.getStorageService(new StorageConfig(storageType, storageKey, storageSecret, Option(endpoint))) - + storageService = StorageServiceFactory.getStorageService(StorageConfig(storageType, storageKey, storageSecret)) + } else if (StringUtils.equalsIgnoreCase(storageType, "gcloud")) { + val storageKey = Platform.config.getString("gcloud_client_key") + val storageSecret = Platform.config.getString("gcloud_private_secret") + storageService = StorageServiceFactory.getStorageService(StorageConfig(storageType, storageKey, storageSecret)) } +// else if (StringUtils.equalsIgnoreCase(storageType, "cephs3")) { +// val storageKey = Platform.config.getString("cephs3_storage_key") +// val storageSecret = Platform.config.getString("cephs3_storage_secret") +// val endpoint = Platform.config.getString("cephs3_storage_endpoint") +// storageService = StorageServiceFactory.getStorageService(new StorageConfig(storageType, storageKey, storageSecret, Option(endpoint))) +// } else throw new ServerException("ERR_INVALID_CLOUD_STORAGE", "Error while initialising cloud storage") } storageService } - def getContainerName(): String = { - if (StringUtils.equalsIgnoreCase(storageType, "azure")) - Platform.config.getString("azure_storage_container") - else if (StringUtils.equalsIgnoreCase(storageType, "aws")) - Platform.config.getString("aws_storage_container") - else if (StringUtils.equalsIgnoreCase(storageType, "cephs3")) - Platform.config.getString("cephs3_storage_container") - else - throw new ServerException("ERR_INVALID_CLOUD_STORAGE", "Container name not configured.") + def getContainerName: String = { + storageType match { + case "azure" => Platform.config.getString("azure_storage_container") + case "aws" => Platform.config.getString("aws_storage_container") + case "gcloud" => Platform.config.getString("gcloud_storage_bucket") + case _ => throw new ServerException("ERR_INVALID_CLOUD_STORAGE", "Container name not configured.") + } } def uploadFile(folderName: String, file: File, slug: Option[Boolean] = Option(true)): Array[String] = { @@ -62,11 +61,11 @@ class StorageService { def uploadDirectory(folderName: String, directory: File, slug: Option[Boolean] = Option(true)): Array[String] = { val slugFile = if (slug.getOrElse(true)) Slug.createSlugFile(directory) else directory val objectKey = folderName + File.separator - val url = getService.upload(getContainerName(), slugFile.getAbsolutePath, objectKey, Option.apply(true), Option.apply(1), Option.apply(5), Option.empty) + val url = getService.upload(getContainerName, slugFile.getAbsolutePath, objectKey, Option.apply(true), Option.apply(1), Option.apply(5), Option.empty) Array[String](objectKey, url) } - def uploadDirectoryAsync(folderName: String, directory: File, slug: Option[Boolean] = Option(true))(implicit ec: ExecutionContext) = { + def uploadDirectoryAsync(folderName: String, directory: File, slug: Option[Boolean] = Option(true))(implicit ec: ExecutionContext): Future[List[String]] = { val slugFile = if (slug.getOrElse(true)) Slug.createSlugFile(directory) else directory val objectKey = folderName + File.separator getService.uploadFolder(getContainerName, slugFile.getAbsolutePath, objectKey, Option.apply(false), None, None, 1) @@ -77,26 +76,34 @@ class StorageService { blob.contentLength } - def copyObjectsByPrefix(source: String, destination: String) = { + def copyObjectsByPrefix(source: String, destination: String): Unit = { getService.copyObjects(getContainerName, source, getContainerName, destination, Option.apply(true)) } - def deleteFile(key: String, isDirectory: Option[Boolean] = Option(false)) = { + def deleteFile(key: String, isDirectory: Option[Boolean] = Option(false)): Unit = { getService.deleteObject(getContainerName, key, isDirectory) } def getSignedURL(key: String, ttl: Option[Int], permission: Option[String]): String = { - getService().getSignedURL(getContainerName, key, ttl, permission) + storageType match { + case "gcloud" => getService.getPutSignedURL(getContainerName, key, ttl, permission, Option.apply(getMimeType(key))) + case _ => getService.getSignedURL (getContainerName, key, ttl, permission) + } } def getUri(key: String): String = { try { getService.getUri(getContainerName, key, Option.apply(false)) } catch { - case e:Exception => { - println("StorageService --> getUri --> Exception: " + e.getMessage) - "" - } + case e:Exception => + println("StorageService --> getUri --> Exception: " + e.getMessage) + "" } } + + def getMimeType(fileName: String): String = { + val tika: Tika = new Tika() + tika.detect(fileName) + } + } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/BaseMimeTypeManager.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/BaseMimeTypeManager.scala index 0d53fdbf1..94f9d2368 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/BaseMimeTypeManager.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/BaseMimeTypeManager.scala @@ -289,5 +289,9 @@ class BaseMimeTypeManager(implicit ss: StorageService) { Map("lastSubmittedOn"-> DateUtils.formatCurrentDate(), "reviewError" -> null, "status" -> newStatus) } + def getEnrichedPublishMetadata(status: String): Map[String, AnyRef] = { + Map("lastPublishedOn"-> DateUtils.formatCurrentDate(), "rejectReasons" -> null, "rejectComment" -> null, "publishError" -> null, "importError" -> null) + } + } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/MimeTypeManager.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/MimeTypeManager.scala index 3f3345074..5324fbe84 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/MimeTypeManager.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/MimeTypeManager.scala @@ -18,4 +18,7 @@ trait MimeTypeManager { @throws[Exception] def review(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] + + @throws[Exception] + def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/ApkMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/ApkMimeTypeMgrImpl.scala index ff19edd12..67f39cbfe 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/ApkMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/ApkMimeTypeMgrImpl.scala @@ -34,4 +34,8 @@ class ApkMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeManage Future(getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node, " |[APK file should be uploaded for further processing!]") + Future(getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/AssetMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/AssetMimeTypeMgrImpl.scala index ab1f9055c..aebf4c9c8 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/AssetMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/AssetMimeTypeMgrImpl.scala @@ -38,4 +38,7 @@ class AssetMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeMana Future(getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + Future(getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/CollectionMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/CollectionMimeTypeMgrImpl.scala index 597e4201b..0f833977d 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/CollectionMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/CollectionMimeTypeMgrImpl.scala @@ -34,6 +34,10 @@ class CollectionMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTyp validate(node).map(res => getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node).map(res => getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } + def validate(node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext) = { val req = new Request() req.setContext(Map[String, AnyRef]("schemaName" -> node.getObjectType.toLowerCase.replaceAll("image", ""), "version"->"1.0").asJava) diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DefaultMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DefaultMimeTypeMgrImpl.scala index c9f47e256..3e2cc01cf 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DefaultMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DefaultMimeTypeMgrImpl.scala @@ -40,4 +40,9 @@ class DefaultMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeMa validate(node, " | [Either artifactUrl is missing or invalid!]") Future(getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node, " | [Either artifactUrl is missing or invalid!]") + Future(getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DocumentMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DocumentMimeTypeMgrImpl.scala index 30442b670..e2ffe0612 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DocumentMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/DocumentMimeTypeMgrImpl.scala @@ -92,4 +92,8 @@ class DocumentMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeM Future(getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node, " | [Either artifactUrl is missing or invalid!]") + Future(getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/EcmlMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/EcmlMimeTypeMgrImpl.scala index f44c3e0e5..773ca2842 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/EcmlMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/EcmlMimeTypeMgrImpl.scala @@ -108,6 +108,14 @@ class EcmlMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeManag }) } + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node).map(result => { + if(result) { + getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String]) + } else throw new ServerException("ERR_NODE_REVIEW", "Something Went Wrong While Applying Review On Node Having Identifier : "+objectId) + }) + } + def validate(node: Node)(implicit ec: ExecutionContext, oec: OntologyEngineContext): Future[Boolean] = { val artifactUrl = node.getMetadata.getOrDefault("artifactUrl", "").asInstanceOf[String] val req = new Request() diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/H5PMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/H5PMimeTypeMgrImpl.scala index bea9318f2..5cb004f48 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/H5PMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/H5PMimeTypeMgrImpl.scala @@ -91,4 +91,9 @@ class H5PMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeManage validate(node, "| [H5P file should be uploaded for further processing!]") Future(getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node, "| [H5P file should be uploaded for further processing!]") + Future(getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/HtmlMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/HtmlMimeTypeMgrImpl.scala index 34014ebf3..4e3e35b57 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/HtmlMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/HtmlMimeTypeMgrImpl.scala @@ -42,4 +42,10 @@ class HtmlMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeManag validate(node, " | [HTML archive should be uploaded for further processing!]") Future(getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node, " | [HTML archive should be uploaded for further processing!]") + Future(getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } + } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/PluginMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/PluginMimeTypeMgrImpl.scala index ccda298b9..2fb9215e9 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/PluginMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/PluginMimeTypeMgrImpl.scala @@ -65,4 +65,10 @@ class PluginMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeMan throw new ClientException("VALIDATOR_ERROR", MISSING_REQUIRED_FIELDS + " | [Either artifactUrl is missing or invalid!]") Future(getEnrichedMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) } + + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + if(!isValidArtifact(node)) + throw new ClientException("VALIDATOR_ERROR", MISSING_REQUIRED_FIELDS + " | [Either artifactUrl is missing or invalid!]") + Future(getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String])) + } } diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/YouTubeMimeTypeMgrImpl.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/YouTubeMimeTypeMgrImpl.scala index 36c0e0015..82576823c 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/YouTubeMimeTypeMgrImpl.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/mimetype/mgr/impl/YouTubeMimeTypeMgrImpl.scala @@ -36,6 +36,14 @@ class YouTubeMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeMa Future(data ++ licenseData) } + override def publish(objectId: String, node: Node)(implicit ec: ExecutionContext, ontologyEngineContext: OntologyEngineContext): Future[Map[String, AnyRef]] = { + validate(node) + val license = node.getMetadata.getOrDefault("license", "").asInstanceOf[String] + val licenseData = if(StringUtils.isBlank(license)) validateAndGetLicense(node) else Map() + val data = getEnrichedPublishMetadata(node.getMetadata.getOrDefault("status", "").asInstanceOf[String]) + Future(data ++ licenseData) + } + def validate(node: Node): Unit = { if(isValidArtifact(node)) { val isValidYouTubeUrl = Pattern.matches(YOUTUBE_REGEX, node.getMetadata.get("artifactUrl").toString) diff --git a/platform-modules/mimetype-manager/src/test/scala/org/sunbird/cloudstore/StorageServiceTest.scala b/platform-modules/mimetype-manager/src/test/scala/org/sunbird/cloudstore/StorageServiceTest.scala index 7cd55d82e..071a9e20c 100644 --- a/platform-modules/mimetype-manager/src/test/scala/org/sunbird/cloudstore/StorageServiceTest.scala +++ b/platform-modules/mimetype-manager/src/test/scala/org/sunbird/cloudstore/StorageServiceTest.scala @@ -2,16 +2,54 @@ package org.sunbird.cloudstore import org.scalatest.{AsyncFlatSpec, Matchers} +import java.io.File + class StorageServiceTest extends AsyncFlatSpec with Matchers { val ss = new StorageService "getService" should "return a Storage Service" in { - val service = ss.getService() + val service = ss.getService assert(service != null) } "getContainerName" should "return the container name" in { - val container = ss.getContainerName() + val container = ss.getContainerName assert(container == "sunbird-content-dev") } + + "getSignedURL" should "return the signed url" in { + val objectKey = "content" + File.separator + "asset" + File.separator + "do_53245" + File.separator + "abc.png" + val preSignedURL = ss.getSignedURL(objectKey, Option.apply(600), Option.apply("w")) + assert(preSignedURL.contains(objectKey)) + } + + "getUri" should "return the signed url" in { + val uri = ss.getUri("content/abc.json") + assert(uri != null) + } + + "getMimeType" should "return the mimetype application/epub+zip for epub" in { + val result = ss.getMimeType("test.alert.epub") + assert(result == "application/epub+zip") + } + + "getMimeType" should "return the mimetype application/octet-stream for h5p" in { + val result = ss.getMimeType("test.alert.h5p") + assert(result == "application/octet-stream") + } + + "getMimeType" should "return the mimetype text/csv for csv" in { + val result = ss.getMimeType("test.alert.csv") + assert(result == "text/csv") + } + + "getMimeType" should "return the mimetype application/pdf for pdf" in { + val result = ss.getMimeType("test.alert.pdf") + assert(result == "application/pdf") + } + + "getMimeType" should "return the mimetype application/zip for zip" in { + val result = ss.getMimeType("test.alert.zip") + assert(result == "application/zip") + } } diff --git a/pom.xml b/pom.xml index f3f14193a..0558992df 100644 --- a/pom.xml +++ b/pom.xml @@ -17,15 +17,34 @@ 3.0.8 2.9.8 - - platform-core - ontology-engine - content-api - assessment-api - taxonomy-api - platform-modules - search-api - + + + knowlg-platform + + true + + + platform-core + ontology-engine + content-api + assessment-api + taxonomy-api + platform-modules + search-api + + + + knowlg-core + + false + + + platform-core + ontology-engine + platform-modules + + +