{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","results":{"codes":[]},"params":[]},"next":{"description":"","pages":[]},"title":"Performance-based Suggestions","type":"basic","slug":"perf-based-suggestions","excerpt":"","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]","updates":[],"order":2,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"598ae482c31a30000f737c91","project":"56439dfe9eebf70d00490d54","version":{"version":"2","version_clean":"2.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"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","5d427dc9fa56fa0011135058","5d429c616863d5003af785a7","5d429e0889418f00c5e95d3f","5d42b5f098b05e003acb08b4","5d43c16985775c00ebeede3b","5d43d15446d584003da91e6d","5d43d61a5bdac50011b6f234","5d43d7c2db365100640dbc58","5d43d954bffa8400ff7efa78","5d43e414cf4f03005944344c","5d43eb42db365100640dbe4a","5d43ee6c78121b0057bc1dbf","5d9a18b4afc33400126c4e6f","5dc4f96dbb5da3006c8f5660"],"_id":"5864d2df79ce642d00f0fec7","createdAt":"2016-12-29T09:09:51.074Z","project":"56439dfe9eebf70d00490d54","releaseDate":"2016-12-29T09:09:51.074Z","__v":18},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Suggest API","slug":"suggest-api","order":19,"from_sync":false,"reference":false,"_id":"598aa64f4b6e990019b7a2d2","project":"56439dfe9eebf70d00490d54","version":"5864d2df79ce642d00f0fec7","createdAt":"2017-08-09T06:06:07.239Z","__v":0},"user":"567b9bf2b56bac0d0019d914","createdAt":"2017-08-09T10:31:30.874Z","githubsync":"","__v":0,"parentDoc":null}