Skip to content

peroper/GlobalForester-API

Repository files navigation

Global Forester API Example Scripts

This repository contains a collection of Python scripts intended as a starting point for developers looking to utilize the Global Forester API using Python and Swagger. These scripts can be used or combined as-is, or serve as inspiration for more complex implementations. To set up and run the scripts, follow the steps below.

See https://api.globalforester.com/swagger for more detailed information about the API.

The examples uses version 3 of the API, which is the recommended version.

Examples for version 2 of the API can be found here. Note that version 2 only supports fetching data. Version 1 of the API has ceased to be and is now history.

Getting Started

1. Clone the repo

git clone https://github.com/peroper/GlobalForester-API.git
cd GlobalForester-API

2. Install Python 3

https://www.python.org

3. Install Python Dependencies

It is recommended to install dependencies in a virtual environment. This will isolate project dependencies from other projects on the same computer. If you want to read more about virtual environments you can do so here: https://docs.python.org/3/library/venv.html

  1. Create a virtual environment

    python3 -m venv venv
  2. Activate the virtual environment

    source venv/bin/activate
  3. Install dependencies

    pip3 install -r requirements.txt

4. Install swagger-codegen 3

Via Homebrew:

brew install swagger-codegen

For other installation methods, see: https://github.com/swagger-api/swagger-codegen/tree/3.0.0

5. Generate the API Client

swagger-codegen generate -i https://api.globalforester.com/swagger/v3/swagger.json -o Swagger -l python

Scripts assume that the API Client is located in a folder called 'Swagger'

6. Run Scripts

  1. Enter your client ID and client secret in utils.py. Contact support if you don't have a client ID and client secret and API access is included in your Global Forester subscription.

  2. Run any desired script with:

    python3 name_of_script.py
  3. To get more information about a script, run:

    python3 name_of_script.py -h

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages