Nostradamus Predicting Maelstroms
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


    UW Student Web Service

    This implements most of the v5 UW Student Webservice endpoints. Each endpoint is queried using convenient options to build the final request.

    This module assumes you have gone through all the required steps to get access and verified that access as documented in the SWS wiki.

    Note: Version 7.0.0 and later require Node 8



    npm install uwsws


    Import the module and set it's configuration. You must set a cacheMode to tell the module to handle http request responses. Responses can be cached to the filesystem (useful for development). In development, set cacheMode to record. In production, set cacheMode to wild to force all requests to go over the internet.

    let uwsws = require('uwsws');
    // With x509 cert
    let config = {
      baseUrl:   '',
      cacheExt:  '.json',
      cacheMode: 'wild',
      cachePath: '/path/to/a/cache/directory/',
      certInfo:  {
        file: {
          cert: 'PATH TO LOCAL CERT',
          key:  'PATH TO LOCAL KEY'
        // s3: {
        //   certBucket: 'CERT AWS BUCKET',
        //   certKey:    'CERT AWS KEY',
        //   keyBucket:  'KEY AWS BUCKET',
        //   keyKey:     'KEY AWS KEY'
        // }
      logLevel: process.env.LOG_LEVEL || 'info',
    // or....with Authentication Token
    let config = {
      baseUrl:   '',
      cacheMode: 'wild',
      cachePath: '/path/to/a/cache/directory/',
      logLevel:  process.env.LOG_LEVEL || 'info',
      token:     'Your Auth Token'
    await uwsws.initialize(config);
      .then((result) => {

    Using the same config, get the intro to programming course for winter 2015.

    let options = {
      year: 2015,
      quarter: 'winter',
      curriculum: 'cse',
      course: '142'
      .then((result) => {

    For more examples see test/unit/*. For a full list of all the options see src/modules/*. Right now there isn't 100% coverage of all the options, but, in theory, they should work in the context of the query string parameters described in the SWS documentation. If you find one that doesn't work please create an issue.

    Using a local cache

    The cacheMode can be set to any one of the following modes. This uses the micro-cache node module as a local file system cache.

    • wild: all requests go out to the internet, don't load anything from cache, doesn't save anything.
    • dryrun: Loads files from cache if exists, does http calls when cache doesn't exist, doesn't save to the cache.
    • record: Loads files from the cache and saves new ones to the cache.


    This module uses winston for all logging. Set an environment variable to a valid log level such as LOG_LEVEL=debug node yourscript.js.

    Endpoint Implementation

    All links below go to the official service documentation. The code block refers to it's implementation in this module.

    Fully Supported

    All of the uwsws methods return a promise for a result object that contains the following elements:

    Object Element Meaning
    statusCode This element represents the HTTP statusCode of the API response.
    data This element represents the data returned by the SWS API. This element is empty if the request HTTP response code was not 200.
    message This element represents the message returned in the body of non-200 HTTP response codes. A message is not returned if the status code is 200.

    In most methods, the response body is returned in data element. However, where it makes sense, some of the original body is removed to provide cleaner access to only the data you need.

    All of the option parameters are outlined in sr/modules/[endpoint]

    Endpoint Implementation
    Campus uwsws.campus.all()
    College Search
    Course uwsws.course.get(options)
    Course Search
    Curriculum Search
    Department Search
    Enrollment uwsws.enrollment.get(options)
    Enrollment Search
    Person uwsws.person.get(regid)
    Person Search
    Registration Search
    Section uwsws.section.get(options)
    Section Search
    Term or .previous(), or .current() as well as
    Test Score uwsws.testScore(options)

    Not Implemented

    Most of these are not implemented due to additional security requirements beyond a simple 509 cert. Requirements such as permissions in ASTRA or x-uw-act-as permissions passed in the header. Feel free fork and make a pull request with working tests if you have those permissions. Others are simply planned for a future release.

    extra security needed
    not needed


    Copy test/setup/config-sample.js to test/setup/config.js and edit values as needed. Use the npm commands indicated in package.json.

    npm test

    To Do

    • Implement Test Score endpoint
    • Implement the endpoints that require more security
    • Permit the use of a token instead of a x509 cert where applicable


    npm i uwsws

    Downloadsweekly downloads








    last publish


    • avatar
    • avatar
    • avatar
    • avatar