def buildapiurl(proto="http", host="127.0.0.1",
                action=None):
    """
    Create a URL for the Cuckoo API

    :param proto: http or https
    :param host: Hostname or IP address
    :param port: The port of the Cuckoo API server
    :param action: The action to perform with the API
    :returns: The URL

    """
    if action is None:
        return None
    else:
        return "{0}://{1}/api{2}/".format(proto, host, action)