I am using the SD-WAN/VCO/VeloCloud API 1.0 to fetch Enterprise, Operator and Firewall events. In the results metadata there is a cursor for requesting subsequent pages of data when there are more re...
See more...
I am using the SD-WAN/VCO/VeloCloud API 1.0 to fetch Enterprise, Operator and Firewall events. In the results metadata there is a cursor for requesting subsequent pages of data when there are more results to fetch. The cursor is named nextPageLink. It is not clear from any documentation or samples how to use this cursor. When I add the parameter to the JSON parameters passed in the body of a POST request the parameter has no effect on paging through the data. When I add nextPageLink as a URL parameter to a GET request I get an error response indicating the GET request cannot be made against the URL. I know the V1.0 API uses POST requests and not GET requests, but the only documentation I found on how to use the cursor is for the V2.0 API, which does use GET requests. The V2.0 API does not seem to have feature parity with the V1.0 API or I would just use that. The V2.0 API doesn't seem to support fetching Operator or Firewall events. Below is a snippet of code to show how I am trying to use the cursor. def get_operator_events(self, enterprise_id, start, end, limit):
params = self.get_query_params(enterprise_id, start, end, limit)
url = self.config["general"]["api_base_url"] + "/event/getOperatorEvents"
res = requests.post(url=url,
data=params,
headers=self.get_api_headers(),
proxies=self.get_proxy(),
verify=False)
res_json = res.json()
events = res_json["data"]
while (res_json["metaData"]["more"]):
filter = {
'enterpriseId': enterprise_id,
'nextPageLink': res_json['metaData']['nextPageLink'],
'filter': {
'limit': limit
}
}
res = requests.post(url + f"?nextPageLink={res_json['metaData']['nextPageLink'] }",
# data=filter,
headers=self.get_api_headers(),
proxies=self.get_proxy(),
verify=False)
res_json = res.json()
events += res_json["data"]
return events