Can section membership be retrieved via the LTI 1.3 NRPS API?

Jump to solution
CarlReiner
Partner
Partner

Hello - I'm working on an LTI 1.3 tool, and it seems quite straightforward to retrieve Course membership via the NRPS endpoint included in the ID token when a user launches from a course. However, the membership does not seem to be broken down by section. Is there a way to retrieve section membership using LTI APIs without using Canvas-specific REST APIs?

1 Solution

@CarlReiner as @JamesSekcienski suggested you can use the variable substitutions. A NRPS call will then allows you to retrieve all the members and included with each membership are the custom variables substituted for each user.

This means you can see all the names of the sections for every user enrolled in the course. You can also get the IDs of the sections with Canvas.course.sectionIds. While they are both arrays I don't know if there's any guarantee that the ordering will be the same.

This is an snippet of a NRPS response (in this case it's the entry for me) and the same data is returned for every member of the course (just remember NRPS paging).

{
            "status": "Active",
            "name": "Matthew Buckett",
            "picture": "https://secure.gravatar.com/avatar/2af16812634729f02aefa45e87028341?s=128&d=identicon",
            "given_name": "Matthew",
            "family_name": "Buckett",
            "email": "matthew@somewhere.com",
            "lis_person_sourcedid": "buckett",
            "user_id": "39d7838d-9784-4b7a-b438-......",
            "lti11_legacy_user_id": "5de1538afb8f1cab07a03c891df215.....",
            "roles": [
                "http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor"
            ],
            "message": [
                {
                    "https://purl.imsglobal.org/spec/lti/claim/message_type": "LtiResourceLinkRequest",
                    "locale": "en-GB",
                    "https://purl.imsglobal.org/spec/lti/claim/custom": {
                        "canvas_user_id": "1234",
                        "canvas_user_login_id": "buckett",
                        "canvas_user_sis_source_id": "buckett",
                        "canvas_user_sis_integration_id": "buckett",
                        "canvas_user_prefer_high_contrast": "$Canvas.user.prefersHighContrast",
                        "com_instructure_user_section_names": "[\"My Section\", \"Other Section\"]",
                        "com_instructure_brand_config_json_url": "$com.instructure.brandConfigJSON.url"
                    },
                    "https://purl.imsglobal.org/spec/lti/claim/lti11_legacy_user_id": "5de1538afb8f1cab07a03c891df215.....",
                    "https://purl.imsglobal.org/spec/lti/claim/lti1p1": {
                        "user_id": "5de1538afb8f1cab07a03c891df215....."
                    }
                }
            ]
        },

 

View solution in original post