API Examples
Configure8 API code examples
Configure8 API Examples
We prepared a git repository to show how to interact with the Configure8 public APIs. There are six different examples, each demonstrating a different aspect of the API.
Installation
To use these examples, you'll need Node.js installed on your machine. Once you have Node.js installed, you can clone this repository:
Usage
This repository contains five different examples. Each script has a function call at the end, where you need to replace the placeholders with your actual values.
1. Attach Metadata to Service
This script demonstrates how to attach metadata to a service. Replace "SERVICE_ID"
and "YOUR_API_KEY"
with your actual service ID and API key.
You can run this script with the following command:
Upon successful execution, this script will output:
2. Create Service
This script demonstrates how to create a new service. Replace "YOUR_API_KEY"
with your actual API key.
You can run this script with the following command:
Upon successful execution, this script will output:
3. Get Scorecard
This script demonstrates how to retrieve a scorecard. Replace "SERVICE_ID"
, "SCORECARD_NAME"
, and "YOUR_API_KEY"
with your actual service ID, scorecard name, and API key.
You can run this script with the following command:
Upon successful execution, this script will output the details of the scorecards that match the provided service ID and name.
4. Reevaluate Scorecard
This script demonstrates how to reevaluate a scorecard. Replace "SCORECARD_ID"
and "YOUR_API_KEY"
with your actual scorecard ID and API key.
You can run this script with the following command:
Upon successful execution, this script will output:
5. Check Scorecard Status
This script demonstrates how to check the status of a scorecard. Replace "SCORECARD_ID"
and "YOUR_API_KEY"
with your actual scorecard ID and API key.
You can run this script with the following command:
Upon successful execution, this script will output the status of the specified scorecard.
6. Get Catalog Relations
This script retrieves relations from a remote API using HTTPS. It takes three parameters: YOUR_API_KEY
, SOURCE_ENTITY_ID
, and TARGET_ENTITY_ID
. You should replace these parameters with your actual API key, source entity ID, and target entity ID. Except for the API key, the other two parameters are optional. If you don't provide SOURCE_ENTITY_ID
, the script will retrieve all relations for the specified target entity. If you don't provide TARGET_ENTITY_ID
, the script will retrieve all relations for the specified source entity. If you don't provide either of these parameters, the script will retrieve all relations for all entities. Also, you can provide the pageSize
and pageNumber
(starts from 0) parameters to paginate the results.
You can run this script with the following command:
Upon successful execution, this script will output the relations that match the provided parameters.
7. Create Custom Resources
This script demonstrates how to create new custom resources on mock data of VMware VMs. Replace "YOUR_API_KEY"
with your actual API key.
You can run this script with the following command:
Upon successful execution, this script will output similar result:
8. Create Deploys and Incidents with relations in DF schemas with service relation
This script demonstrates how to create deploys and incidents with a data flexibility schema and how to related them to each other and a service.
If you haven't already, install the dependencies like this:
First, add a .env.local
with your api key like this:
Then open up the script here, replacing out five fields at the top with your specific cases:
Now that everything is configured, you can run the script like this:
Last updated