npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kth/ug-rest-api-helper

v1.0.26

Published

Node.js module to make JSON calls against APIs.

Downloads

32

Readme

ug-rest-api-helper

Hold helper functions to retrive data from UG Rest Api

Agenda UG Rest Api Helper

This project has the implementation of calling UG rest API. It will fetch users and groups data.

Passing Connection Properties

UG rest Api requires authentication token to send back data. For that, need to pass few connection parameters first to make sure that there will be no un-authorized response issue during fetching time of UG data set. In ugRestApiHelper , connection properties needs to be set using initConnectionProperties method and in that method following parameters need to pass.

  1. authorityURL needs to pass to get access token. Make sure the url should be without /oauth2/token.
  2. clientId needs to pass to get access token.
  3. clientSecret needs to pass to get access token.
  4. ugURL needs to pass. This will be used while fetching UG data.
  5. subscriptionKey needs to pass. (Optional)

Note: Make sure ugURL is correct and authenticates the subscriptionKey that is passed.

If token is not expired then Api will use existing token to fetch the data otherwise it will generate a new token.

Fetch UG Data

There are two data set supported so far.

  1. Users
  2. Groups

Fetch UG Groups

For groups to fetch there are two methods added.

  1. getUGGroups This method will receive groupFilterAttributeName which indicates property name like 'name', 'kthid' etc, operatorToUseInFilter like 'eq', 'contains', 'startswith' etc, groupFilterAttributeValue like 'sst' (this will be the filter value to filter out the data) and there is a flag expandMembers. If this set to true then it will fetch groups along with members.

  2. getUGGroupsByGroupName This method will bring groups along with members if needed. There is a flag expandMembers. If this set to true then it will fetch groups along with members. groupName needs to pass because filter will preapplied to 'name' only. operatorToUseInFilter also needed that how data should filter.

Fetch UG Users

For user to fetch there is one method.

  1. getUGUsers This method will receive userFilterAttributeName which indicates property name like 'givenName', 'kthid' etc, operatorToUseInFilter like 'eq', 'contains', 'startswith' etc, userFilterAttributeValue like 'Joakim' (this will be the filter value to filter out the data).

Operators supported so far

There are few filter operators that are supported so far.

  1. eq
  2. startswith
  3. contains
  4. in

Use on of these operators to filter out data.

TODO: There are other operators as well that is supported by UG Rest Api. Those will be including in the future.

Check the link below to see what are the supported filter by UG.

https://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html#_Toc453752358