Skip to content

Instantly share code, notes, and snippets.

@Synvox
Last active March 12, 2016 20:14
Show Gist options
  • Save Synvox/142cee8ea5f5f1ad0761 to your computer and use it in GitHub Desktop.
Save Synvox/142cee8ea5f5f1ad0761 to your computer and use it in GitHub Desktop.
Brightspace discussion board notes
// get d2l_referrer (required for making posts)
var list = window.top.D2L.OR.__g1
for(var i in list)
if (list[i].indexOf('d2l_referrer') !== -1)
return JSON.parse(list[i]).P[1]
// Unofficial API (This one doesn't give 403s to students)
$.post('https://byui.brightspace.com/d2l/le/(ORG_UNIT)/discussions/posts/(TOPIC)/FinishReply',{
postData$subject:"Subject",
postData$message$html:'Html',
postData$message$id:"newPostBottom_(TOPIC)$postData$message",
postData$message$htmlOrgUnitId:(ORG_UNIT),
d2l_referrer:(D2L_REFERRER)
},function(e){
console.log(e);
})
// Get Posts
$.getJSON('/d2l/api/le/1.5/(ORG_UNIT)/discussions/forums/(FORUM)/topics/(TOPIC)/posts/',{
},function(e){
console.log(e)
})
// Get Post
$.getJSON('/d2l/api/le/1.5/(ORG_UNIT)/discussions/forums/(FORUM)/topics/(TOPIC)/posts/(POST)',{
},function(e){
console.log(e)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment