...
Example how to run send logs command with pythin python script. Because endpoint /send-logs/oracle accepts configuration ID, we have to first find it. We will re-use our admin/admin Authorization string from the Example 1:
Code Block |
---|
import requests #disable certificate warning requests.packages.urllib3.disable_warnings() cc_url = "https://czlin0232:4433/api/v2" headers = { "Authorization": "Basic YWRtaW46YWRtaW4=" } def getDDCID(ddcName): global ddcid endpoint = "/list" data = { "params":{ "configuration_name":"APIDDC" } } #get id of the configuration responseFindid = requests.request("POST", cc_url + endpoint, headers=headers, json=data, verify=False) responseFindidJson=responseFindid.json() ddcid=responseFindidJson["result"]["configurations"][0]["configuration_id"] def sendLogs(ddcid): endpoint = "/send-logs/oracle" data = { "params":{ "configuration_id":ddcid } } responseSend=requests.request("POST", cc_url + endpoint, headers=headers, json=data, verify=False) responseSendJson=responseSend.json() print(responseSendJson) #MAIN getDDCID("APIDDC") sendLogs(ddcid) |
...