Retrieve Config History Via REST API
For cases where users need their current and previous configuration files, Mona now allows users to retrieve their configuration history.
This can be done by leveraging the /get_config_history REST endpoint.
In order to do so, first of all, users must have an authorization token for their account.
More info on generating a token here.
Once users have their accessToken they can add it to their authorization and send a POST request like so:
curl --location --request POST 'https://api{YOUR-USER-ID}.monalabs.io/get_config_history' \
--header 'Authorization: Bearer {YOUR-ACCESS-TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{}'
import requests
import json
url = "https://api{YOUR-USER-ID}.monalabs.io/get_config_history"
payload = json.dumps({})
headers = {
'Authorization: Bearer {YOUR-ACCESS-TOKEN}',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
from mona_sdk.client import Client
api_key = <YOUR-API-KEY>
secret = <YOUR-SECRET>
my_mona_client = Client(api_key, secret)
my_mona_client.get_config_history(number_of_revisions=5)
Possible args for this request are:
- number_of_revisions - the number of configs to retrieve, sorted by the date they were uploaded. Default is 10 configs.
Updated 25 days ago