{"_id":"598ae482c31a30000f737c91","project":"56439dfe9eebf70d00490d54","version":{"_id":"5864d2df79ce642d00f0fec7","project":"56439dfe9eebf70d00490d54","__v":4,"createdAt":"2016-12-29T09:09:51.074Z","releaseDate":"2016-12-29T09:09:51.074Z","categories":["5864d2df79ce642d00f0fec8","5864d2df79ce642d00f0fec9","5864d2df79ce642d00f0feca","5864d2df79ce642d00f0fecb","5864d2df79ce642d00f0fecc","5864d2df79ce642d00f0fecd","5864d2df79ce642d00f0fece","5864d2df79ce642d00f0fecf","5864d2df79ce642d00f0fed0","5864d2df79ce642d00f0fed1","5864d2df79ce642d00f0fed2","5864d2df79ce642d00f0fed3","5864d2df79ce642d00f0fed4","5864d2df79ce642d00f0fed5","5864d2df79ce642d00f0fed6","5864d2df79ce642d00f0fed7","5864d2df79ce642d00f0fed8","5864d2df79ce642d00f0fed9","5864d2df79ce642d00f0feda","5864d2df79ce642d00f0fedb","5864d2df79ce642d00f0fedc","5864d2df79ce642d00f0fedd","5864d2df79ce642d00f0fede","598aa64f4b6e990019b7a2d2","599bc76bc03fa2000f83db2a","599bcc3c3c5bf7000f3434fc"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"category":{"_id":"598aa64f4b6e990019b7a2d2","project":"56439dfe9eebf70d00490d54","version":"5864d2df79ce642d00f0fec7","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-08-09T06:06:07.239Z","from_sync":false,"order":19,"slug":"suggest-api","title":"Suggest API"},"user":"567b9bf2b56bac0d0019d914","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-08-09T10:31:30.874Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"As with any other API, you require appropriate access_token to work with Suggest API. Refer to [Authentication Flow](doc:authentication-flow) for necessary detail.\n\n\n[block:api-header]\n{\n  \"title\": \"Performance Based Suggestions API\"\n}\n[/block]\nResources suggested to users based on the performance of user at current collection in study are termed as performance-based suggestions. These are highly curated content items that are related to the assessment taken by user.\n\n**API End Point** \n{REST_END_POINT}/gooru-search/rest/v3/suggest/{type}\n\n**Method Type**\nPOST\n\n**Request Headers** \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Header\",\n    \"h-1\": \"Value\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"Authorization\",\n    \"0-1\": \"Token {TOKEN}\",\n    \"0-2\": \"Replace the {TOKEN} with actual value of access_token obtained from authentication.\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n**Path Variables**\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"h-0\": \"Name\",\n    \"h-1\": \"Data Type\",\n    \"h-2\": \"Value\",\n    \"h-3\": \"Description\",\n    \"0-2\": \"'resource'\",\n    \"0-3\": \"Denotes type of suggestions to surface. This provides future extensibility around suggestions.\"\n  },\n  \"cols\": 4,\n  \"rows\": 1\n}\n[/block]\n**Request Params**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Data Type\",\n    \"h-2\": \"Default\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"limit\",\n    \"0-1\": \"Integer\",\n    \"0-2\": \"3\",\n    \"0-3\": \"Number of maximum suggestions to return. Value can be anything between 1..10. \\n\\nMax limit is 10 suggestions.\"\n  },\n  \"cols\": 4,\n  \"rows\": 1\n}\n[/block]\n**Request Body**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key\",\n    \"h-1\": \"Data Type\",\n    \"h-2\": \"Value\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"context.context_type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"'collection-study'\",\n    \"0-3\": \"Indicates the type of user activity around which suggestions are to be made.\",\n    \"1-0\": \"context.context_area\",\n    \"1-1\": \"String\",\n    \"1-2\": \"'study-player'\",\n    \"1-3\": \"Indicates the application context of users' current activity.\",\n    \"2-0\": \"context.collection_id\",\n    \"2-1\": \"UUID\",\n    \"2-2\": \"ID of collection being studied by user\",\n    \"2-3\": \"ID of collection being studied by user around which suggestions will be made\",\n    \"3-0\": \"context.user_id\",\n    \"3-1\": \"UUID\",\n    \"3-2\": \"ID of current user\",\n    \"3-3\": \"Identifies the user in Gooru system\",\n    \"4-0\": \"metrics.score\",\n    \"4-1\": \"Number\",\n    \"4-2\": \"score at current assessment\",\n    \"4-3\": \"Indicates performance of user at the current assessment\",\n    \"5-0\": \"metrics.timespent\",\n    \"5-1\": \"Number\",\n    \"5-2\": \"amount of time spent in milliseconds at the current assessment\",\n    \"5-3\": \"Time spent by user at the assessment\"\n  },\n  \"cols\": 4,\n  \"rows\": 6\n}\n[/block]\nSample Call\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Curl -i -H \\\"Authorization:Token MTQ3NDM1NDIzMDk1OTowMjE5MDkwYy1hYmU2LTRhMDktOGM5Zi0zNDM5MTFmNWNkODY6YmE5NTZhOTctYWUxNS0xMWU1LWEzMDItZjhhOTYzMDY1OTc\\\" -XPOST ‘http://gooru.org/gooru-search/rest/v3/suggest/resource?limit=3’ -d ‘{ \\\"context\\\":{ \\\"context_type\\\":\\\"collection-study\\\", \\\"user_id\\\":\\\"3784de18-1361-4ef0-b0ae-5aca980cdfe3\\\", \\\"container_id\\\":\\\"4784de18-1361-4ef0-b0ae-5aca980cdfe3\\\", \\\"course_id\\\":\\\"5784de18-1361-4ef0-b0ae-5aca980cdfe3\\\", \\\"unit_id\\\":\\\"6784de18-1361-4ef0-b0ae-5aca980cdfe3\\\", \\\"lesson_id\\\":\\\"7784de18-1361-4ef0-b0ae-5aca980cdfe3\\\" }, \\\"metrics\\\":{\\\"score\\\": 34, \\\"timespent\\\": 173848} }’\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n**Response Structure**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key\",\n    \"h-1\": \"Data Type\",\n    \"h-2\": \"Value\",\n    \"0-0\": \"executionTime\",\n    \"0-1\": \"Number\",\n    \"0-2\": \"time spent in milliseconds\",\n    \"1-0\": \"suggestResults\",\n    \"1-1\": \"JSON Array\",\n    \"h-3\": \"Description\",\n    \"0-3\": \"Indicates time spent in surfacing suggestions.\",\n    \"1-2\": \"Array of resource objects.\",\n    \"1-3\": \"Each resource object is a JSON with the keys as:\\ntitle, contentFormat, contentSubFormat, description, url, curriculumInfo, etc. This is similar to Search response.\",\n    \"2-0\": \"suggestedType\",\n    \"2-1\": \"String\",\n    \"2-2\": \"'resource'\",\n    \"2-3\": \"Indicates the type of suggestions responded with - for now it is 'resource'.\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n**Sample Response**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\\"executionTime\\\":127,\\n\\\"suggestResults\\\":[{\\n  \\\"addDate\\\":1329341077000,\\n  \\\"usedInCollectionCount\\\":1, \\n  \\\"contentFormat\\\":\\\"resource\\\", \\n  \\\"contentSubFormat\\\":\\\"interactive_resource\\\", \\n  \\\"description\\\":\\\"Why do scientists use microscopes to study plant cells?\\\", \\n  \\\"gooruOid\\\":\\\"bd741800-4cb9-4e5d-8ceb-5f3ce581a9db\\\", \\n  \\\"grade\\\":null, \\n  \\\"hasFrameBreaker\\\":false, \\n  \\\"lastModified\\\":1329341077000, \\n  \\\"lastModifiedString\\\":\\\"2012-02-15T21:24:37Z\\\",\\n  \\\"license\\\":{ \\n    \\\"code\\\":\\\"CC0 1.0\\\", \\n    \\\"icon\\\":\\\"license/oer_icon.png\\\", \\n    \\\"name\\\":\\\"creative commons\\\",\\n    \\\"url\\\":\\\"http://creativecommons.org/publicdomain/zero/1.0/\\\"\\n  }, \\n  \\\"publishStatus\\\":\\\"published\\\", \\n  \\\"publisher\\\":null, \\n  \\\"collectionIds\\\":[\\\"775b139c-adb1-414a-8a60-07ef24f7b77c\\\"], \\n  \\\"collectionTitles\\\":[\\\"Quiz: Looking Inside Cells\\\"],\\n  \\\"taxonomySet\\\":{ \\n    \\\"subject\\\":[ \\\"Science\\\" ], \\n    \\\"domain\\\":[ \\\"Cell Biology\\\" ],\\n    \\\"course\\\":[], \\n    \\\"curriculum\\\":{ \\n      \\\"curriculumName\\\":[ \\\"CA\\\" ], \\n      \\\"curriculumCode\\\":[ \\\"CA.SCI.7.LS.1b\\\" ], \\n      \\\"curriculumInfo\\\":[{ \\n        \\\"code\\\":\\\"CA.SCI.7.LS.1b\\\", \\n        \\\"frameworkCode\\\":\\\"CA\\\", \\n        \\\"id\\\":\\\"CA.K12.SC-7-CB-01.02\\\", \\n        \\\"title\\\":\\\"Students know the characteristics that distinguish plant cells from animal cells, including chloroplasts and cell walls.\\\",\\n        \\\"parentTitle\\\":\\\"Science\\\" \\n      }],\\n      \\\"curriculumDesc\\\":[ \\\"Students know the characteristics that distinguish plant cells from animal cells, including chloroplasts and cell walls.\\\"] \\n    }\\n  },\\n  \\\"title\\\":\\\"Why do scientists use microscopes to study plant cells? \\\",\\n  \\\"url\\\":null,\\n  \\\"viewCount\\\":2\\n}],\\n\\\"suggestedType\\\":\\\"resource\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"perf-based-suggestions","type":"basic","title":"Performance-based Suggestions"}

Performance-based Suggestions


As with any other API, you require appropriate access_token to work with Suggest API. Refer to [Authentication Flow](doc:authentication-flow) for necessary detail. [block:api-header] { "title": "Performance Based Suggestions API" } [/block] Resources suggested to users based on the performance of user at current collection in study are termed as performance-based suggestions. These are highly curated content items that are related to the assessment taken by user. **API End Point** {REST_END_POINT}/gooru-search/rest/v3/suggest/{type} **Method Type** POST **Request Headers** [block:parameters] { "data": { "h-0": "Header", "h-1": "Value", "h-2": "Description", "0-0": "Authorization", "0-1": "Token {TOKEN}", "0-2": "Replace the {TOKEN} with actual value of access_token obtained from authentication." }, "cols": 3, "rows": 1 } [/block] **Path Variables** [block:parameters] { "data": { "0-0": "type", "0-1": "String", "h-0": "Name", "h-1": "Data Type", "h-2": "Value", "h-3": "Description", "0-2": "'resource'", "0-3": "Denotes type of suggestions to surface. This provides future extensibility around suggestions." }, "cols": 4, "rows": 1 } [/block] **Request Params** [block:parameters] { "data": { "h-0": "Name", "h-1": "Data Type", "h-2": "Default", "h-3": "Description", "0-0": "limit", "0-1": "Integer", "0-2": "3", "0-3": "Number of maximum suggestions to return. Value can be anything between 1..10. \n\nMax limit is 10 suggestions." }, "cols": 4, "rows": 1 } [/block] **Request Body** [block:parameters] { "data": { "h-0": "Key", "h-1": "Data Type", "h-2": "Value", "h-3": "Description", "0-0": "context.context_type", "0-1": "String", "0-2": "'collection-study'", "0-3": "Indicates the type of user activity around which suggestions are to be made.", "1-0": "context.context_area", "1-1": "String", "1-2": "'study-player'", "1-3": "Indicates the application context of users' current activity.", "2-0": "context.collection_id", "2-1": "UUID", "2-2": "ID of collection being studied by user", "2-3": "ID of collection being studied by user around which suggestions will be made", "3-0": "context.user_id", "3-1": "UUID", "3-2": "ID of current user", "3-3": "Identifies the user in Gooru system", "4-0": "metrics.score", "4-1": "Number", "4-2": "score at current assessment", "4-3": "Indicates performance of user at the current assessment", "5-0": "metrics.timespent", "5-1": "Number", "5-2": "amount of time spent in milliseconds at the current assessment", "5-3": "Time spent by user at the assessment" }, "cols": 4, "rows": 6 } [/block] Sample Call [block:code] { "codes": [ { "code": "Curl -i -H \"Authorization:Token MTQ3NDM1NDIzMDk1OTowMjE5MDkwYy1hYmU2LTRhMDktOGM5Zi0zNDM5MTFmNWNkODY6YmE5NTZhOTctYWUxNS0xMWU1LWEzMDItZjhhOTYzMDY1OTc\" -XPOST ‘http://gooru.org/gooru-search/rest/v3/suggest/resource?limit=3’ -d ‘{ \"context\":{ \"context_type\":\"collection-study\", \"user_id\":\"3784de18-1361-4ef0-b0ae-5aca980cdfe3\", \"container_id\":\"4784de18-1361-4ef0-b0ae-5aca980cdfe3\", \"course_id\":\"5784de18-1361-4ef0-b0ae-5aca980cdfe3\", \"unit_id\":\"6784de18-1361-4ef0-b0ae-5aca980cdfe3\", \"lesson_id\":\"7784de18-1361-4ef0-b0ae-5aca980cdfe3\" }, \"metrics\":{\"score\": 34, \"timespent\": 173848} }’", "language": "curl" } ] } [/block] **Response Structure** [block:parameters] { "data": { "h-0": "Key", "h-1": "Data Type", "h-2": "Value", "0-0": "executionTime", "0-1": "Number", "0-2": "time spent in milliseconds", "1-0": "suggestResults", "1-1": "JSON Array", "h-3": "Description", "0-3": "Indicates time spent in surfacing suggestions.", "1-2": "Array of resource objects.", "1-3": "Each resource object is a JSON with the keys as:\ntitle, contentFormat, contentSubFormat, description, url, curriculumInfo, etc. This is similar to Search response.", "2-0": "suggestedType", "2-1": "String", "2-2": "'resource'", "2-3": "Indicates the type of suggestions responded with - for now it is 'resource'." }, "cols": 4, "rows": 3 } [/block] **Sample Response** [block:code] { "codes": [ { "code": "{\n\"executionTime\":127,\n\"suggestResults\":[{\n \"addDate\":1329341077000,\n \"usedInCollectionCount\":1, \n \"contentFormat\":\"resource\", \n \"contentSubFormat\":\"interactive_resource\", \n \"description\":\"Why do scientists use microscopes to study plant cells?\", \n \"gooruOid\":\"bd741800-4cb9-4e5d-8ceb-5f3ce581a9db\", \n \"grade\":null, \n \"hasFrameBreaker\":false, \n \"lastModified\":1329341077000, \n \"lastModifiedString\":\"2012-02-15T21:24:37Z\",\n \"license\":{ \n \"code\":\"CC0 1.0\", \n \"icon\":\"license/oer_icon.png\", \n \"name\":\"creative commons\",\n \"url\":\"http://creativecommons.org/publicdomain/zero/1.0/\"\n }, \n \"publishStatus\":\"published\", \n \"publisher\":null, \n \"collectionIds\":[\"775b139c-adb1-414a-8a60-07ef24f7b77c\"], \n \"collectionTitles\":[\"Quiz: Looking Inside Cells\"],\n \"taxonomySet\":{ \n \"subject\":[ \"Science\" ], \n \"domain\":[ \"Cell Biology\" ],\n \"course\":[], \n \"curriculum\":{ \n \"curriculumName\":[ \"CA\" ], \n \"curriculumCode\":[ \"CA.SCI.7.LS.1b\" ], \n \"curriculumInfo\":[{ \n \"code\":\"CA.SCI.7.LS.1b\", \n \"frameworkCode\":\"CA\", \n \"id\":\"CA.K12.SC-7-CB-01.02\", \n \"title\":\"Students know the characteristics that distinguish plant cells from animal cells, including chloroplasts and cell walls.\",\n \"parentTitle\":\"Science\" \n }],\n \"curriculumDesc\":[ \"Students know the characteristics that distinguish plant cells from animal cells, including chloroplasts and cell walls.\"] \n }\n },\n \"title\":\"Why do scientists use microscopes to study plant cells? \",\n \"url\":null,\n \"viewCount\":2\n}],\n\"suggestedType\":\"resource\"\n}", "language": "json" } ] } [/block]