Retrieving access restriction data

61 views
Skip to first unread message

Sean Warren

unread,
Sep 30, 2014, 1:31:37 PM9/30/14
to valenc...@googlegroups.com


Hello

Is there a way to use the Valence API to "feed" the local student portal with news and events. We have gone through iterations to try to provide the appropriate permissions for them to get the data needed, but it appears the data is just not available. It is the course 'groups' restriction data that is missing. That is, a prof has used the groups to restrict who has access to certain course activities, or even events. However, we cannot seem to get that info through the API, so we cannot deliver to a particular student using the portal the correct Brightspace news and events for him/her.

Thank you
Sean

University of Waterloo

Desire2Learn Staff: Sarah-Beth

unread,
Sep 30, 2014, 1:49:07 PM9/30/14
to valenc...@googlegroups.com
When making a call - to retrieve news posts, for example - the API respects the permissions of the calling user. In the example below, I've called the API as a student in Group 1 of a course. I released seperate news posts to Group 1 and Group 2. You can see that the result below only shows the Group 1 post.

GET /d2l/api/lp/1.3/feed/

Response:

[{"Resource":{"Id":37,"IsHidden":false,"Attachments":[],"Title":"News for Group 1","Body":{"Text":"This News Post should only go to Group 1.","Html":"<p>This News Post should only go to Group 1.</p>"},"StartDate":"2014-09-25T13:07:00.000Z","EndDate":null,"IsGlobal":false,"IsPublished":true,"ShowOnlyInCourseOfferings":false},"Type":"News","Metadata":{"Identifier":"37","Title":"News for Group 1","Summary":{"Text":"This News Post should only go to Group 1.","Html":"<p>This News Post should only go to Group 1.</p>"},"Date":"2014-09-25T13:08:58.190Z","ApiViewUrl":"/d2l/6689/news/37","WebViewUrl":"/d2l/m/le/news/6689/details/37"}}]

So from a data Pull perspective, the built in mechanisms restrict the data as necessary. 

Can you explain a little bit more about your scenario? How would you plan to feed the data to the portal - as a batch process via a service account? How would you plan to pare down the data to show only the info each student is supposed to have access to? Would a pull via the student's user context serve your need?

David Bean

unread,
Oct 1, 2014, 12:04:28 PM10/1/14
to valenc...@googlegroups.com
Hi Sarah-Beth

For the portal, we are looking to pull all events and news items for a student (respecting Release Conditions) in each active course they are enrolled in.  We had been planning to use, and have been testing with a service account.  Based on your comments, I've switched to using an actual student account for user context. I'm now getting a 200 response, but I'm not getting any data for  GET /d2l/api/lp/1.3/feed/.

With the same student account I can use: /d2l/api/le/(version)/(orgUnitId)/news/ and I'm getting appropriately restricted by group news, so that looks promising for course news items. 

Based on the Valence docs, I'm not clear exactly what I should be expecting from the /feed call.  Is there a corresponding "Feed" for the student available through the UI in the LMS?  i.e. is it the same data as Notifications/Updates/Messages?

Desire2Learn Staff: Viktor

unread,
Oct 7, 2014, 9:27:02 AM10/7/14
to valenc...@googlegroups.com
Hi David,

There is not currently an exactly corresponding "feed" for users in the UI, no. I believe that the "feed" API call gathers its entries by fetching (and then  processing) a list of messages queued up for the user. The "alerts" shown to the user through the UI are produced also by inspecting this list of messages (and perhaps other sources), and then creating a list of alertable notices from that data.

Unfortunately, the documentation for the "feed" API call is askew from how the actual underlying implementation for this call works specifically around how it handles time ranges. I will be fixing that this morning to more accurately represent how the call works. Rather than repeat things here, I'd just ask that you check the docs again in about an hour. 8/

--
Viktor

Desire2Learn Staff: Viktor

unread,
Oct 7, 2014, 9:39:28 AM10/7/14
to valenc...@googlegroups.com
Note that the documentation for this call now says the following about its functionality:

   This call retrieves and aggregates a list of user messages gathered from
   various sources in the back-end service. The original sources for those
   messages determine when a user event message gets made available for
   aggregation, and when the events expire from the pool available to this API
   call.

   Note that, unlike many Learning Framework APIs, there is currently no direct
   functional equivalent for this API call in the web UI.

   `since` and `until`
       You can use these query parameters to time-box the list of things
       returned in the feed list with this call.

       If you *do not provide* a `since` value, this call returns only
       a list of "recent" feed items: those with a publication time sometime
       within the twenty-four hours preceding the time when the back-end
       service handles your call.

       If you provide a `since` value, and *do not provide* an `until` value,
       this call returns all the feed items from your provided `since` time up
       until the time when the back-end service handles your call.

       If you provide a `since` value, and *do* provide an `until` value, this
       call returns all the feed items between your two provided time
       parameters. Note that, if your `since` parameter is more recent than
       your `until` parameter, this action returns success and an empty feed
       list.

 

David Bean

unread,
Oct 8, 2014, 9:00:39 AM10/8/14
to valenc...@googlegroups.com
Hi Viktor

Thanks for updating the documentation around time ranges. 

Is it possible for you to provide more explicit details about "gathered from various sources".  Using that definition, I'm still not clear what data/messages/alerts I should expect to see in the feed.  

Thanks
Dave

Desire2Learn Staff: Viktor

unread,
Oct 9, 2014, 9:22:52 AM10/9/14
to valenc...@googlegroups.com
Hi Dave,

The feed implementation doesn't know much at all about what clients are using it: it's designed so that services can insert a variety of resource items into the feed, and the feeder itself doesn't have to know who's using it -- this means that the list of what is, and is not, using the feed can change over time (release to release) and even conceivably within a particular release by configuration settings (in theory).

Currently, I believe, the only things that will show up in the feed are "news items" and thus it looks like only things that will appear to a user as "news" should appear in the feed -- it's not clear to me if all news items will go into the feed, or whether the news service inserts only particular items into the feed.

--
Viktor

David Bean

unread,
Oct 10, 2014, 9:11:36 AM10/10/14
to valenc...@googlegroups.com
Thanks Viktor, I think I understand what the purpose of /feed is more clearly know.  I can work with this info, thanks again.

Desire2Learn Staff: Viktor

unread,
Oct 14, 2014, 1:35:52 PM10/14/14
to valenc...@googlegroups.com
No problem!
Reply all
Reply to author
Forward
0 new messages