# Recipes for automating Oh Dear


Today we are releasing `oh-dear-api-examples` a brand-new open-source repository on GitHub. It curates bite-size scripts, helpers and ideas for helping you bulk-manage your Oh Dear account via the API.

[github.com/ohdearapp/oh-dear-api-examples](https://github.com/ohdearapp/oh-dear-api-examples)

### How it works

Installation in under a minute just following the README.md or:

```bash
git clone https://github.com/ohdearapp/oh-dear-api-examples.git
cd oh-dear-api-examples
cp .env.example .env
npm install
```

Just clone → npm install → start interacting with your account. This repository is a cookbook *not* a full SDK. It was created in JavaScript as it's easy to use, reference and port to another language. Copy a function, tweak it, add it to your workflows as needed. 💪

You will find a few different files
* `./examples.js`: composable functions (create_site_from_existing, sync_status_pages_with_tagged_sites, generateReportSnapshot, …) you can import or run directly
* `report.js`: exposes a `generateReportSnapshot` function that returns a full site report for the month (up to the current day) - useful when recreating Oh Dear's monthly PDF reports
* `cache/`: responses are persisted locally so repeated runs are fast and you can inspect the raw JSON response when debugging
* `ohdear.js`: a thin wrapper around fetch to interact with the API
* `.env`: add you Oh Dear API key here (OH_DEAR_API_KEY=…)

Let us know if you have any other use-cases, problems or automation suggestions. This could either be a product/service update or an addition to this repo. Just let us know!


### Did you know?

We have several options to automate Oh Dear further;

* We have an [official Php SDK](https://ohdear.app/docs/tools-and-sdks/the-oh-dear-php-sdk)
* There's an [Oh Dear CLI](https://ohdear.app/docs/tools-and-sdks/our-cli-tool) command
* And [more 3rd party integrations](https://ohdear.app/docs/tools-and-sdks/3rd-party-integrations-of-oh-dear)


### Need more?
Leave an issue in the repo or contact support for suggestions or more information. We look forward to helping you navigate real world use cases when using Oh Dear API to manage you team and client monitoring.