Skip to content

logcheck/logcheck-api-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LogCheck API: Getting Started

Prerequisites

  • A terminal program (e.g. Terminal, iTerm) running a sh-compatible shell (e.g. Bash, ZSH)
  • A scripting language. Our examples use Python and Ruby, but you may use any scripting language that supports making an HTTP GET requests with basic HTTP authentication.

Getting Started

1. Clone this repo

git clone [email protected]:logcheck/logcheck-api-samples.git
cd logcheck-api-samples

2. Request API Access

Complete the sign-up form and a LogCheck team member will help you get started.

3. Generate credentials

  • Log in to the website https://www.logcheckapp.com
  • In the drop down under your name, select Settings
  • Select the API Tokens tab on the left
  • Select the Generate a new token button. (If the button is disabled, you need to complete the sign-up form to enable API access for your user account.)
  • A modal will open showing a new TOKEN_ID and SECRET_KEY

4. Set up environment

  • Copy TOKEN_ID and SECRET_KEY into a .env file
touch .env
echo "export TOKEN_ID='<paste TOKEN_ID>'" >> .env
echo "export SECRET_KEY='<paste SECRET_KEY>'" >> .env

Note that the included ruby and python example scripts use the dotenv and python-dotenv packages respectively to access these environment variables.

Please also note that this repo contains a .gitignore file which excludes .env from source control. Be sure to add this file to your own future repos to avoid leaking your LogCheck API credentials.

Example Usage: Ruby

Prerequisites: ruby and bundler

cd ruby/
gem install bundler # if not already installed
bundle install
ruby example.rb

Example Usage: Python

Prerequisites: python3 and pip3

cd python/
pip3 install jsonapi-client python-dotenv
python3 example.py

About

Sample code for working with the LogCheck API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published