dnac_pnp.api_call_handler module

This module handles the API calls

call_api_endpoint(method=None, api_url=None, data=None, api_headers=None, parameters=None, auth=None, check_payload=True)

This module makes the API call

Parameters
  • method – (str) API call method e.g. GET, POST etc

  • api_url – (str) API endpoint

  • data – (str) API call payload body [should be JSON]

  • api_headers – (dict) API headers to be appended to the call

  • parameters – (dict) Querystring for the API call

  • auth – (base64) Authentication string

  • check_payload – (boolean) whether to check the payload or not

Returns

(response) Python requests response

get_response(authentication_token=None, method=None, endpoint_url=None, headers=None, parameters=None, response=None)

This private method returns response body as json (if applicable)

Parameters
  • authentication_token – (str) Authentication token for X-Auth-Token header

  • method – (str) http/https

  • endpoint_url – (str) API call endpoint

  • headers – (dict) API headers

  • parameters – (dict) API call parameters

  • response – (object) Python requests response object

Returns

(json) Response body