Context_codes

Jump to solution
wuedward
Community Novice

Context_codes is required for announcements in the API.  Where can I find context_codes?

1 Solution
maguire
Community Champion

The context code is simply the string "course_" with the course number appended. For example, I did the following query for my course 11:

I got back:

[ { "id": 4114, "title": "Test announcement 1", "last_reply_at": "2017-03-24T11:45:55Z", "delayed_post_at": null, "posted_at": "2017-03-24T11:45:55Z", "assignment_id": null, "root_topic_id": null, "position": 3, "podcast_has_student_posts": false, "discussion_type": "side_comment", "lock_at": null, "allow_rating": false, "only_graders_can_rate": false, "sort_by_rating": false, "user_name": "Gerald Q. Maguire Jr.", "discussion_subentry_count": 0, "permissions": { "attach": true, "update": true, "reply": true, "delete": true }, "require_initial_post": null, "user_can_see_posts": true, "podcast_url": null, "read_state": "read", "unread_count": 0, "subscribed": false, "topic_children": [], "attachments": [], "published": true, "can_unpublish": false, "locked": false, "can_lock": true, "comments_disabled": false, "author": { "id": 29, "display_name": "Gerald Q. Maguire Jr.", "avatar_image_url": "https://secure.gravatar.com/avatar/52e6e0ae2260166c91cd528ba0c72263?s=50&d=http%3A%2F%2Fpeople.kth.s...", "html_url": "https://kth.instructure.com/courses/11/users/29" }, "html_url": "https://kth.instructure.com/courses/11/discussion_topics/4114", "url": "https://kth.instructure.com/courses/11/discussion_topics/4114", "pinned": false, "group_category_id": null, "can_group": false, "context_code": "course_11", "locked_for_user": false, "message": "<p>This is just a test.</p>\r\n<p> </p>", "subscription_hold": "topic_is_announcement" } ]

Why this formatted string is called a context_code, I do not know.

View solution in original post