Source code for api.reports.v1.search

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


[docs]@register_command(extending=('reports','v1','search')) def simplified_search_reports(customerID: list = None, period: list = None, status: list = None, startTime: int = 0, endTime: int = 0, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """search customer reports (INTERNAL) :param list customerID: Search by Customer IDs :param list period: Search by Periods :param list status: Search by Report Status :param int startTime: Search by specified start timestamp :param int endTime: Search by specified end timestamp :param int offset: Skip a number of reports :param int limit: Maximum number of reports :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :raises NotFoundException: on 404 :returns: {"offset": 533, "limit": 698, "responseCode": 200, "count": 684, "data": [{"id": 199, "lastUpdatedTimestamp": 399280622, "publishedTimestamp": 689805426, "startTimestamp": 1127037213, "endTimestamp": 1215232698, "createdByUser": {"id": 867, "customerID": 792, "userName": "stephenvillarreal", "name": "James Graham"}, "description": "Forget time group seek common eat main.", "period": "MONTH", "status": "NEW"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Live she table interesting.", "messageTemplate": "Question sound stand.", "field": "Argue similar successful public seek effort.", "parameter": {}, "timestamp": 1204659340}], "currentPage": 788, "size": 581} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/search".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 startTime: body.update({"startTime": startTime}) if endTime: body.update({"endTime": endTime}) if offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) if customerID: body.update({"customerID": customerID}) if period: body.update({"period": period}) if status: body.update({"status": status}) 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