Performance-based Suggestions

As with any other API, you require appropriate access_token to work with Suggest API. Refer to Authentication Flow for necessary detail.

Performance Based Suggestions API

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

HeaderValueDescription
AuthorizationToken {TOKEN}Replace the {TOKEN} with actual value of access_token obtained from authentication.

Path Variables

NameData TypeValueDescription
typeString'resource'Denotes type of suggestions to surface. This provides future extensibility around suggestions.

Request Params

NameData TypeDefaultDescription
limitInteger3Number of maximum suggestions to return. Value can be anything between 1..10.

Max limit is 10 suggestions.

Request Body

KeyData TypeValueDescription
context.context_typeString'collection-study'Indicates the type of user activity around which suggestions are to be made.
context.context_areaString'study-player'Indicates the application context of users' current activity.
context.collection_idUUIDID of collection being studied by userID of collection being studied by user around which suggestions will be made
context.user_idUUIDID of current userIdentifies the user in Gooru system
metrics.scoreNumberscore at current assessmentIndicates performance of user at the current assessment
metrics.timespentNumberamount of time spent in milliseconds at the current assessmentTime spent by user at the assessment

Sample Call

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} }’

Response Structure

KeyData TypeValueDescription
executionTimeNumbertime spent in millisecondsIndicates time spent in surfacing suggestions.
suggestResultsJSON ArrayArray of resource objects.Each resource object is a JSON with the keys as:
title, contentFormat, contentSubFormat, description, url, curriculumInfo, etc. This is similar to Search response.
suggestedTypeString'resource'Indicates the type of suggestions responded with - for now it is 'resource'.

Sample Response

{
"executionTime":127,
"suggestResults":[{
  "addDate":1329341077000,
  "usedInCollectionCount":1, 
  "contentFormat":"resource", 
  "contentSubFormat":"interactive_resource", 
  "description":"Why do scientists use microscopes to study plant cells?", 
  "gooruOid":"bd741800-4cb9-4e5d-8ceb-5f3ce581a9db", 
  "grade":null, 
  "hasFrameBreaker":false, 
  "lastModified":1329341077000, 
  "lastModifiedString":"2012-02-15T21:24:37Z",
  "license":{ 
    "code":"CC0 1.0", 
    "icon":"license/oer_icon.png", 
    "name":"creative commons",
    "url":"http://creativecommons.org/publicdomain/zero/1.0/"
  }, 
  "publishStatus":"published", 
  "publisher":null, 
  "collectionIds":["775b139c-adb1-414a-8a60-07ef24f7b77c"], 
  "collectionTitles":["Quiz: Looking Inside Cells"],
  "taxonomySet":{ 
    "subject":[ "Science" ], 
    "domain":[ "Cell Biology" ],
    "course":[], 
    "curriculum":{ 
      "curriculumName":[ "CA" ], 
      "curriculumCode":[ "CA.SCI.7.LS.1b" ], 
      "curriculumInfo":[{ 
        "code":"CA.SCI.7.LS.1b", 
        "frameworkCode":"CA", 
        "id":"CA.K12.SC-7-CB-01.02", 
        "title":"Students know the characteristics that distinguish plant cells from animal cells, including chloroplasts and cell walls.",
        "parentTitle":"Science" 
      }],
      "curriculumDesc":[ "Students know the characteristics that distinguish plant cells from animal cells, including chloroplasts and cell walls."] 
    }
  },
  "title":"Why do scientists use microscopes to study plant cells? ",
  "url":null,
  "viewCount":2
}],
"suggestedType":"resource"
}