KB User's Guide - API - News

This document provides information in the News API for the KnowledgeBase.

Title

Get News Items

Calls externally-published news content for the specified site domain.

Collection Endpoint

[KB site domain]/[subsite (optional)]/api/v1/news

Example: https://kb.wisc.edu/api/v1/news or https://kb.wisc.edu/helpdesk/api/v1/news

** APIs are not enabled for institution subsites unless specifically requested. Please contact the KB team if you would like to request an API for your subsite(s).

Method

GET

URL Params

Note: All URL params are optional.

parameter type description
query text string one or more search terms, separated by a plus sign (plus sign)
archive integer 0 or undefined = active news only (default)
1 = include archived news items
ownerGroup string

If ownerGroup is undefined, results will include all documents available to the current group.

this = filter to docs owned by current group
other = filter to docs shared by other groups
sort integer

If sort is undefined, results will be sorted first sorted by updated date (descending), then by created date (descending).

1 = sort by id, ascending
2 = sort by id, descending
3 = sort by title, ascending
4 = sort by title, descending
5 = sort by updated date, ascending
6 = sort by updated date, descending
7 = sort by created date, ascending
8 = sort by created date, descending
9 = sort by activation date, ascending
10 = sort by activation date, descending
11 = sort by expiration date, ascending
12 = sort by expiration date, descending
13 = sort by owner group, ascending
14 = sort by owner group, descending

Collection Sample Response

{
  "_links": {
    "self": {
      "href": "https://kb.wisc.edu/api/v1/news?page=1"
    },
    "first": {
      "href": "https://kb.wisc.edu/api/v1/news"
    },
    "last": {
      "href": "https://kb.wisc.edu/api/v1/news?page=1"
    }
  },
  "_embedded": {
    "news": [
      {
        "id": "9876",
        "title": "Important Update for Faculty and Staff",
        "summary": "The University has made several important changes to service eligibility for retired faculty and staff.",
        "updated": "2017-03-20 11:34:07",
        "created": "2017-03-18 16:03:48",
        "activation": "2017-03-19 09:22:16",
        "expiration": "2017-03-26 09:22:16",
        "ownerGroup": "DoIT Help Desk",
        "_links": {
          "self": {
            "href": "https://kb.wisc.edu/api/v1/news/9876"
          }
        }
      },
      {
        "id": "8989",
        "title": "Learning Management System Upgrade",
        "summary": "Our Learning Management System will be upgraded to version 12 over the weekend.",
        "updated": "2017-03-15 18:48:01",
        "created": "2017-02-17 07:40:26",
        "activation": "2017-02-17 18:23:40",
        "expiration": "2017-04-24 18:23:40",
        "ownerGroup": "Learn@UW",
        "_links": {
          "self": {
            "href": "https://kb.wisc.edu/api/v1/news/8989"
          }
        }
      },

      ...

      }
    ]
  },
  "page_count": 1,
  "page_size": 25,
  "total_items": 13,
  "page": 1
}

Entity Endpoint

/api/v1/news/[news_id]

Example: /api/v1/news/8989

Entity Sample Response

{
  "id": "8989",
  "title": "Learning Management System Upgrade",
  "summary": "Our Learning Management System will be upgraded to version 12 over the weekend.",
  "body": "<p>The upgrade process is expected to begin at 6AM on Saturday morning. Once the process has begun, you will not be able to access the system. We aim to complete the upgrade by 8PM on Sunday night, after which point you will regain access. Please plan accordingly.</p>\r\n<p>All existing courses and content will be moved to the new system during the upgrade.</p>",
  "source": "Learn@UW Team",
  "updater": "John P.",
  "updated": "2017-03-15 18:48:01",
  "created": "2017-02-17 07:40:26",
  "activation": "2017-02-17 18:23:40",
  "expiration": "2017-04-24 18:23:40",
  "ownerGroup": "Learn@UW",
  "_links": {
    "self": {
      "href": "https://kb.wisc.edu/api/v1/news/8989"
    }
  }
}

Success Response

Code: 200 OK
Content: Content-type: application/hal+json

Error Response

Code: 403 Forbidden
Content: {"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Forbidden","status":403,"detail":"Forbidden"}

OR

Code: 404 Page Not Found
Content: Page not found.

OR

Code: 405 Method Not Allowed
Content: None

OR

Code: 500 Unexpected error
Content: { error : "Error producing an iterator" }

Notes

N/A

See Also:




Keywords:restapi method url data params parameters success errors responses sample calls notes service items   Doc ID:71428
Owner:Leah S.Group:KB User's Guide
Created:2017-03-06 17:57 CDTUpdated:2017-03-22 14:25 CDT
Sites:KB User's Guide
Feedback:  0   0