How to filter with the Conductor API

For any filter of an API request, append ?filter=description::*filter_term* to the end of the request.

Python Example

#!/usr/bin/python3
from pprint import pprint
import sys
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning

# Suppress cert warning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

URL = "https://<conductor>/api/v1/""
HEADERS = {
    'x-api-client-id': '<client_id>',
    'x-api-token': '<token>',
    'content-type': 'application/json'
}

def get_hipservices():
    """
    Get all hipservices in Conductor

    :returns: hipservices json
    """
    r = requests.get(URL + 'hipservices?filter=description::*Airwall*', headers=HEADERS, verify=False)

    if r.status_code == requests.codes.ok:
        return r.json()

    print('Error getting hipservices. HTTP error code: {}'.format(r.status_code))
    return {}

def main():
    hipservices = get_hipservices()
    pprint(hipservices)

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        sys.exit()