Valence v2.2

News service (news items, user feed)

«  Discussions (forums, topics, posts)   ·  [   home  ·   reference   ·  index   ·  routing table   ·  modules   ]   ·  Calendar (Events and scheduling)  »

Contents

Attributes

Feed.UserFeedResource

The feed service returns generically formed blocks that wrap around particular kinds of resources. For example, a UserFeedResourceNewsItem variant of the generic container contains a Resource composite that’s actually a NewsItem structure.

{
    "Type": "<string>",
    "MessageMetaData": {
        "Identifier": "<string>",
        "Title": "<string>",
        "Summary": "{composite:RichText}",
        "Date": "<string:UTCDateTime>",
        "ApiViewUrl": "<string:URL>",
        "WebViewUrl": "<string:URL>"
    },
    "Resource": "{composite:<T>}"
}
News.NewsItem

If you use an action that retrieves News Item data from the service, it sends the data back to you in a block like this:

{
    "Id": "<number:D2LID>",
    "IsHidden": "<boolean>",
    "Attachments": [ // Array of File blocks
        {
            "FileId": "<number:D2LID>",
            "FileName": "<string>",
            "FileSize": "<number>"
        },
        {   " ... File ... "   }
    ]
    "Title": "<string>",
    "Body": "{composite:RichText}",
    "StartDate": "<string:UTCDateTime>|null",
    "EndDate": "<string:UTCDateTime>|null",
    "IsGlobal": "<boolean>",
    "IsPublished": "<boolean>",
    "ShowOnlyInCourseOfferings": "<boolean>",
}
News.NewsItemData

If you use an action where you must provide News Item data, then the service expects you to send it in a block like this:

{
    "Title": "<string>",
    "Body": "{composite:RichText}",
    "StartDate": "<string:UTCDateTime>",
    "EndDate": "<string:UTCDateTime>|null",
    "IsGlobal": "<boolean>",
    "IsPublished": "<boolean>",
    "ShowOnlyInCourseOfferings": "<boolean>"
}

Note

When you provide a RichText composite Body in a NewsItemData structure, you should not provide an empty-string “HTML” property field if your intention is to provide a text-only news body. Rather, you should pass in an explicit NULL for the field.

Actions

DELETE /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)

Delete a particular news item from an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to edit news for this org unit.
  • 404 – News item not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.
DELETE /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)/attachments/(D2LID: fileId)

Delete an attachment from an org unit’s news item.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
  • fileId (D2LID) – File attachment ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to see news for this org unit.
  • 404 – News item not found, or file attachment not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.
GET /d2l/api/lp/(D2LVERSION: version)/feed/

Fetch the feed for the current user context.

Parameters:
Query Parameters:
 
  • since – Optional. Fetch only feed items published after this UTCDateTime.
  • until – Optional. Fetch only feed items published before this UTCDateTime.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to see feed.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.
since and until

If you provide one of these query parameters, you indicate that you want to time-box the resulting event feed data fetched. You can leave out one or both of these parameters to, or provide null for them, to avoid restricting that side of the fetched feed (for example, if you leave out the since query parameter, you want to fetch all items ever published in the feed up until the until time you provide).

If your since parameter is more recent than your until parameter, this action returns success and an empty feed list.

Return. This action returns a JSON array of UserFeedResource data blocks. Note that each element in this list will be named appropriately for the kind of resource it envelops.

GET /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/

Retrieve a list of news items for an org unit.

Parameters:
Query Parameters:
 
  • since – Optional. Fetch news only since this UTCDateTime start date.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to see news for this org unit.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.

Return. This action returns a JSON array of NewsItem data blocks containing news items’ properties.

GET /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)

Retrieve a particular news item for an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to see news for this org unit.
  • 404 – News item not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.

Return. This action returns a NewsItem JSON data block containing the news item’s properties.

GET /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)/attachments/(D2LID: fileId)

Retrieve an attachment for an org unit’s news item.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
  • fileId (D2LID) – File attachment ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to see news for this org unit.
  • 404 – News item not found, or file attachment not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.

Return. This action returns a file stream containing the attachment file data.

POST /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/

Create a news item for an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
Status Codes:
  • 200 – Action succeeded.
  • 400 – Invalid News Item data provided.
  • 403 – No permission to create news items for this org unit.
API Versions:
  • 1.0 – Route first appears in LMS v9.4.1.
  • 1.2+ – Route returns newly created news item with 200 result.

Input. Provide a multipart/mixed POST body: the first part must be a NewsItemData JSON block in the post body; other parts may include file attachments to go along with the news item.

If you want to create a new item as a draft, make sure to set the NewsItemData’s IsPublished property to false. In order to publish such a created news item, you must then use the Publish action.

Return. With v1.2 (on LMS v10.1.0) release and after, this action returns a NewsItem JSON data block for the newly created news item.

POST /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)/attachments/

Add an attachment to a news item for an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to edit news for this org unit.
  • 404 – News item not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.

Input. Use a multipart/form-data POST body to provide the attachment data to add to the news item, with the part’s Content-Disposition header’s name field set to “file”.

POST /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)/dismiss

Dismiss (hide) a news item for an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to see news items for this org unit.
  • 404 – News item not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.
POST /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)/publish

Publish a draft news item for an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to edit news items for this org unit.
  • 404 – News item not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.
POST /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)/restore

Restore (unhide) a news item for an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
Status Codes:
  • 200 – Action succeeded.
  • 403 – No permission to see news items for this org unit.
  • 404 – News item not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.
PUT /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/news/(D2LID: newsItemId)

Update a news item for an org unit.

Parameters:
  • version (D2LVERSION) – API version.
  • orgUnitId – Org Unit ID.
  • newsItemId (D2LID) – News Item ID.
Status Codes:
  • 200 – Action succeeded.
  • 400 – Invalid news item data provided, or attempt to provide a draft news update to a upblished news item.
  • 403 – No permission to update news items for this org unit.
  • 404 – News item not found.
API Versions:
  • 1.0+ – Route first appears in LMS v9.4.1.

Input. Provide a NewsItemData JSON block containing the updated news item’s properties.

If the org unit’s news item has already been published, then you may not provide an update with the IsPublished property set to false (i.e. once an item is no longer a draft item, you can’t turn it back into a draft item). However, if the org unit’s news item is in draft state, you can publish it with this action by setting the IsPublished property to true.


comments powered by Disqus

«  Discussions (forums, topics, posts)   ·  [   home  ·   reference   ·  index   ·  routing table   ·  modules   ]   ·  Calendar (Events and scheduling)  »