Introduction KRANE™ Knowledge Base
Working version v2.23-Woodpecker- App version 1.35.x v2.21-Umbrellabird- App version 1.33.0 v2.19 Sparrow - App version 1.31.1 v2.18 Raven - App version 1.30.5 v2.17.1 - App version 1.30 v2.17 Quail - App version 1.28.0 v2.16 Pelican
Working version v2.23-Woodpecker- App version 1.35.x v2.21-Umbrellabird- App version 1.33.0 v2.19 Sparrow - App version 1.31.1 v2.18 Raven - App version 1.30.5 v2.17.1 - App version 1.30 v2.17 Quail - App version 1.28.0 v2.16 Pelican English Dutch

Customer Manual for Data Export Using API Key

Introduction

This manual provides step-by-step instructions on how to export data from the KRANE platform using a Python script and your unique suborganizational API key. The exported data can be used for further analysis or reporting.

Prerequisites

  • Access to the suborganization in KRANE.

  • A valid API key, obtainable from the KRANE platform account.

  • Basic knowledge of Python.

  • Python installed on your machine (instructions here).

  • Pip package manager installed on your machine (automatically installed with Python 3.4 or newer, see link to instructions above).

  • A Python script for data export, located in the "Downloads" folder.

Step-by-Step Instructions

1. Obtain Your API Key 🔑

  1. Log in to the KRANE platform with your credentials.

  2. Navigate to the top-right corner in any window.

  3. Click the user name to open the dropdown menu.

  4. Look for "Copy the API token".

  5. Clicking this button will copy the API key 🔑 to your clipboard for use in the next steps.

api_token_annotated.png

2. Locate the Python Script for Data Export

  1. After downloading the provided Python script, locate it in your "Downloads" folder.

  2. The file will typically be named RLTDataExportOrikami.py. Ensure the file is in the correct location before continuing.

3. Set Up Your Python Environment

Before running the script, make sure that your environment has the required Python libraries requests and pandas installed. To install the necessary libraries using the pip package manager, use the following command in your terminal or command prompt:

pip install requests pandas

4. Paste Your API Key Into the Script

  1. Open the RLTDataExportOrikami.py file in a text editor, such as Notepad, Sublime Text, or Visual Studio Code.

  2. Look for the section of the script where the API key is defined. It’s located in line 22. It should look something like this:

 'authorization': 'bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InpMSEJ1b21lOWg3Zkw2M0VQTUJrUCJ9.eyJodHRwczovL2tyYW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F0aW9uX21lbWJlcnMiLCJyZWFkOm9yZ2FuaXphdGlvbl9tZW1iZXJzIiwiZGVsZXRlOm9yZ2FuaXphdGlvbl9tZW1iZXJzIiwiY3JlYXRlOm9yZ2FuaXphdGlvbl9jb25uZWN0aW9ucyIsInJlYWQ6b3JnYW5pemF0aW9uX2Nvbm5lY3Rpb25zIiwidXBkYXRlOm9yZ2FuaXphdGlvbl9jb25uZWN0aW9ucyIsImNyZWF0ZTpvcmdhbml6YXRpb25fbWVtYmVyX3JvbGVzIiwicmVhZDpvcmdhbml6YXRpb25fbWVtYmVyX3JvbGVzIiwiY3JlYXRlOm9yZ2FuaXphdGlvbl9pbnZpdGF0aW9ucyIsImRlbGV0ZTpvcmdhbml6YXRpb25fbWVtYmVyX3JvbGVzIiwicmVhZDpvcmdhbml6YXRpb25faW52aXRhdGlvbnMiLCJjcmVhdGU6dGVycmFfY29ubmVjdGlvbiIsImNyZWF0ZTp0ZXJyYV9jb25uZWN0aW9ucyIsInJlYWQ6dGVycmFfZGF0YV9vcmdhbml6YXRpb25fdXNlcnMiXX0.rMKLJzlwk55K4OlBwLjfHBI1qDpInuEIB02mNS0oJ1WJ1mSeXE9w608zQWV5j3MFIVSoXmt4bavU86LKYgF5b-0qe1BHSgX6iYdKjqk_HxZymYvKeGLPZLAEfiMH4zYQ-IhNe2xt59OkJKuR3XIMFnE18eOg96PLhM55qdTq2Pdf4ChulVEgUJcHy20pT6bl-ScdLoSyrjcUq6BmuId7YScU4c7EogKJD5Q9p4_HN0xiUfaa84kPYTMYr5nUBEd_GBdYE48uHFyTH2qp9FTCgAgk1oOR6ZvJSknMon3vTpzru-ZTY9t6qgV-dJJAM0-BwYEF3DqF7bBOWDcbylCd8Q'
  1. Replace "your-api-key-here" with the actual API key🔑 you copied earlier. For example:

 'authorization': 'bearer [your-api-key-here]'
  1. Look for the section at the end of the script where the name of the Excel file will be determined. It’s located in line 78. It should look something like this:

if __name__ == "__main__":
    merge_dataframes(headers, printing=True, saving=True, suborg="rlt-adrz")
  1. Replace "suborg="rlt-adrz" with the actual name of the suborganization. For example:

if __name__ == "__main__":
    merge_dataframes(headers, printing=True, saving=True, suborg="rlt-UMCG")

Save the changes (CTRL + S) to the script file.

5. Run the Python Script

  1. In the command prompt or terminal, while still in the "Downloads" folder, run the Python script by typing:

C:\Users\luder>cd downloads
python RLTDataExportOrikami.py

The export will be made and the Excel file placed in the folder which contains the script.

7. Verify the Exported Data

  1. Navigate to the location where the data file was saved, as specified by the script.

  2. Open the file to verify that the data has been successfully exported.

Troubleshooting

  • Invalid API Key: If you encounter an "invalid API key" error, ensure you copied the key correctly and that it hasn’t expired. Keys are set to expire after 24 hours. You can generate a new key from your account settings if needed.

  • Python Errors: If you receive Python-related errors, make sure that Python is installed correctly and that all required libraries (i.e., requests and pandas) are installed. Check the error message for more specific details.