api.customers.v1.location — Argus-Toolbelt 1.0 documentation

# Source code for api.customers.v1.location

    """Autogenerated API"""
    import requests
    from argus_cli.plugin import register_command

    @register_command(extending=('customers','v1','location'))
    def get_customer_locations(customerID: list = None, keywords: str = None, limit: int = 25, offset: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Search locations by criteria (PUBLIC)

        :param list customerID: Search by customerIDs
        :param str keywords: Search by keywords
        :param int limit: Limit result
        :param int offset: Offset result
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 271, "limit": 467, "responseCode": 200, "count": 101, "data": [{"id": 365, "name": "Stephanie Lee", "shortName": "View lot will.", "flags": 523, "customerID": 859, "internal": false, "globalCustomer": true, "dmz": true, "zone": "DMZ", "external": false}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Six cover minute arrive well bank.", "messageTemplate": "Stage station animal for until skin.", "field": "Character finally likely rich.", "parameter": {}, "timestamp": 316796966}], "currentPage": 760, "size": 655}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customers/v1/location".format()
        headers = {
            'Content-Type': 'application/json',
            'User-Agent': 'ArgusToolbelt/1.0'
        }

        if apiKey:
            headers["Argus-API-Key"] = apiKey
        elif authentication and isinstance(authentication, dict):
            headers.update(authentication)
        elif callable(authentication):
            headers.update(authentication(url))

        body = {}

        if limit:
            body.update({"limit": limit})

        if offset:
            body.update({"offset": offset})

        if customerID:
            body.update({"customerID": customerID})

        if keywords:
            body.update({"keywords": keywords})

        response = get(url, json=body if body else None, verify=verify, headers=headers)

        errors = []
        if response.status_code == 401:
            raise http.AuthenticationFailedException(response)
        elif response.status_code == 403:
            raise http.AccessDeniedException(response)
        elif response.status_code == 412:
            raise http.ValidationErrorException(response)
        elif response.status_code == 404:
            raise http.ObjectNotFoundException(response)

        return response.json() if json else response