BushSchoolIT / BlackbaudExtractor

2 stars 0 forks source link

This repository is for performing ETL on a Blackbaud Education Management environment

ETL scripts

wordswordswords

BbApiConnector-Python

See justein230/BbApiConnector-Python Documentation directly copied from justein230's code:

Prerequisites

Obtain Authorization Code to Get Tokens

  1. Once the prerequisite steps are completed, run the authorization code generator component (bb_auth.py).
  2. When the application is running, go to http://localhost:13631. Here, you will find the link that you need to go to in order to authorize your application with your credentials.
  3. Sign in with your Blackbaud ID, then click "Authorize". You should be taken to a screen with your authorization code. If you look at the console of the application, you will see a very long access token and a much shorter refresh token. Copy these values and paste them in app_secrets.json.
  4. Once you have copied these values into the config file, you can terminate the bb_auth application.

Set Up a Session for Use in Python Programs

  1. When all placeholders in the app_secrets.json file are filled (which they should be at this point), you are ready to start authenticating with the SKY API!
  2. In your query, add from BbApiConnector import BbApiConnector to the top of your program.
  3. Create a BbApiConnector object and pass in the config file path, like so: api_conn = BbApiConnector('app_secrets.json')
  4. In order to use the API, use the pre-authorized Session object created with this script. add the line bb_session = api_conn.get_session() near the top of your file.
  5. You are done! In order to use the API, use bb_session like you would the normal requests library. No headers need to be specified. An example request is located below:
    params = {
    'base_role_ids': '1'
    }
    req = bb_session.get("https://api.sky.blackbaud.com/school/v1/users/extended", params=params)