Source code for api.cases.v2.case

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




[docs]@register_command(extending=('cases','v2','case')) def create_case(service: str = None, category: str = None, type: str = None, status: str = None, watchers: list = None, fields: list = None, subject: str = None, description: str = None, customerReference: str = None, aclMembers: list = None, originEmailAddress: str = None, publish: bool = 'True', defaultWatchers: bool = 'True', priority: str = 'medium', accessMode: str = 'roleBased', customerID: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Create a new case defined by CaseCreateRequest (PUBLIC) :param str service: ID of service to create case for :param str category: If set, assign given category to new case (by category shortname). :param str type: Type of case to create :param str status: Status of case to create. If not set, system will select automatically. :param list watchers: Explicit watchers to add to this case. :param list fields: Fields to set on case creation. Fields in the policy for requested service and customer specifies fields available. If any of the fields in the policy are required on create, and do not have a default value,those fields must be set in the case create request, or the request will fail. :param str subject: Subject of case to create. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str description: Case description. May use HTML, which will be sanitized. :param str customerReference: Customer reference for case. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param list aclMembers: Explicit ACL members to add to case. :param str originEmailAddress: If case is created from an email, specify origin email address here => format:email :param bool publish: Whether to publish new case. Creating an unpublished case requires special permission. (default true) :param bool defaultWatchers: Whether to enable default watchers for this case. If set to false, default watchers will not be enabled, and will not be notified upon creation of this case. (default true) :param str priority: Priority of case to create. (default medium) :param str accessMode: Access mode for new case. (default roleBased) :param int customerID: ID of customer to create case for (default 0) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 765, "limit": 527, "responseCode": 200, "count": 430, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Explain Mrs thing smile main positive growth.", "messageTemplate": "Laugh per organization seat word while research.", "field": "Above present to among somebody.", "parameter": {}, "timestamp": 1390059739}], "currentPage": 126, "size": 624} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case".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 publish: body.update({"publish": publish}) if defaultWatchers: body.update({"defaultWatchers": defaultWatchers}) if priority: body.update({"priority": priority}) if accessMode: body.update({"accessMode": accessMode}) if customerID: body.update({"customerID": customerID}) if service: body.update({"service": service}) if category: body.update({"category": category}) if type: body.update({"type": type}) if status: body.update({"status": status}) if watchers: body.update({"watchers": watchers}) if fields: body.update({"fields": fields}) if subject: body.update({"subject": subject}) if description: body.update({"description": description}) if customerReference: body.update({"customerReference": customerReference}) if aclMembers: body.update({"aclMembers": aclMembers}) if originEmailAddress: body.update({"originEmailAddress": originEmailAddress}) response = post(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
[docs]@register_command(extending=('cases','v2','case')) def search_case_statistics(limit: int = None, offset: int = None, subCriteria: list = None, customerID: list = None, caseID: list = None, type: list = None, service: list = None, category: list = None, status: list = None, priority: list = None, startTimestamp: int = None, endTimestamp: int = None, assetID: list = None, tag: list = None, workflow: list = None, field: list = None, keywords: list = None, timeFieldStrategy: list = None, timeMatchStrategy: str = None, keywordFieldStrategy: list = None, keywordMatchStrategy: str = None, userID: list = None, userFieldStrategy: list = None, groupBy: list = None, values: list = None, resolution: int = None, cutoff: int = None, cutoffValue: str = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', userAssigned: bool = 'False', techAssigned: bool = 'False', includeOthers: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Returns statistics data matching the defined CaseStatsSearchCriteria (PUBLIC) :param int limit: Set this value to set max number of results. By default, no restriction on result set size. :param int offset: Set this value to skip the first (offset) objects. By default, return result from first object. :param list subCriteria: :param list customerID: Restrict search to data belonging to specified customers. :param list caseID: Restrict search to specific cases (by ID). :param list type: Restrict search to entries of one of these types. :param list service: Restrict search to entries of one of these services (by service shortname or ID). :param list category: Restrict search to entries of one of these categories (by category shortname or ID). :param list status: Restrict search to entries of one of these statuses. :param list priority: Restrict search to entries with given priorties :param int startTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (start timestamp). :param int endTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (end timestamp). :param list assetID: Restrict search to cases associated with specified assets (hosts, services or processes) :param list tag: Restrict search to entries matching the given tag criteria. :param list workflow: Restrict search to entries matching the given workflow criteria. :param list field: Restrict search to entries matching the given field criteria. :param list keywords: Search for keywords. :param list timeFieldStrategy: Defines which timestamps will be included in the search (default lastUpdatedTimestamp). :param str timeMatchStrategy: Defines how strict to match against different timestamps (all/any) using start and end timestamp (default any) :param list keywordFieldStrategy: Defines which fields will be searched by keywords (default all supported fields). :param str keywordMatchStrategy: Defines the MatchStrategy for keywords (default match all keywords). :param list userID: Restrict search to cases associated with these users. :param list userFieldStrategy: Defines which user fields will be searched (default match all user fields). :param list groupBy: Specify which fields will be grouped by in stats :param list values: Specify which values will be included in stats (default created) :param int resolution: Stats resolution period in milliseconds, if is 0 means to generate non-timeline statistics :param int cutoff: Reduce stats keys to the cutoff amount of keys that has largest hit count, default 0 means no reduce :param str cutoffValue: Specify which value to be cutoff on (default created) :param list sortBy: List of properties to sort by (prefix with "-" to sort descending). :param list includeFlags: Only include objects which have includeFlags set. :param list excludeFlags: Exclude objects which have excludeFlags set. :param bool includeDeleted: Set to true to include deleted objects. By default, exclude deleted objects. :param bool exclude: Only relevant for subcriteria. If set to true, objects matching this subcriteria object will be excluded. :param bool required: Only relevant for subcriteria. If set to true, objects matching this subcriteria are required (AND-ed together with parent criteria). :param bool userAssigned: If set, limit search to cases where assignedUser field is set/unset :param bool techAssigned: If set, limit search to cases where assignedTech field is set/unset :param bool includeOthers: If reduce (cutoff>0), true means remaining keys (other than cutoff keys) are collected into an "other" key, default false :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 955, "limit": 163, "responseCode": 200, "count": 861, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Age land during today thousand tax throw be.", "messageTemplate": "Until and understand us section personal.", "field": "Be risk late find.", "parameter": {}, "timestamp": 793809343}], "currentPage": 625, "size": 526} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/stats".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 includeDeleted: body.update({"includeDeleted": includeDeleted}) if subCriteria: body.update({"subCriteria": subCriteria}) if exclude: body.update({"exclude": exclude}) if required: body.update({"required": required}) if customerID: body.update({"customerID": customerID}) if caseID: body.update({"caseID": caseID}) if type: body.update({"type": type}) if service: body.update({"service": service}) if category: body.update({"category": category}) if status: body.update({"status": status}) if priority: body.update({"priority": priority}) if startTimestamp: body.update({"startTimestamp": startTimestamp}) if endTimestamp: body.update({"endTimestamp": endTimestamp}) if assetID: body.update({"assetID": assetID}) if tag: body.update({"tag": tag}) if workflow: body.update({"workflow": workflow}) if field: body.update({"field": field}) if keywords: body.update({"keywords": keywords}) if timeFieldStrategy: body.update({"timeFieldStrategy": timeFieldStrategy}) if timeMatchStrategy: body.update({"timeMatchStrategy": timeMatchStrategy}) if keywordFieldStrategy: body.update({"keywordFieldStrategy": keywordFieldStrategy}) if keywordMatchStrategy: body.update({"keywordMatchStrategy": keywordMatchStrategy}) if userID: body.update({"userID": userID}) if userFieldStrategy: body.update({"userFieldStrategy": userFieldStrategy}) if userAssigned: body.update({"userAssigned": userAssigned}) if techAssigned: body.update({"techAssigned": techAssigned}) if groupBy: body.update({"groupBy": groupBy}) if values: body.update({"values": values}) if resolution: body.update({"resolution": resolution}) if cutoff: body.update({"cutoff": cutoff}) if cutoffValue: body.update({"cutoffValue": cutoffValue}) if includeOthers: body.update({"includeOthers": includeOthers}) if sortBy: body.update({"sortBy": sortBy}) if includeFlags: body.update({"includeFlags": includeFlags}) if excludeFlags: body.update({"excludeFlags": excludeFlags}) response = post(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
[docs]@register_command(extending=('cases','v2','case')) def delete_case(caseID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Mark existing case as deleted (PUBLIC) :param int caseID: Case ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 643, "limit": 325, "responseCode": 200, "count": 445, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Store it she place prove.", "messageTemplate": "Behavior baby miss however next.", "field": "Behavior discuss nation American.", "parameter": {}, "timestamp": 984273341}], "currentPage": 865, "size": 58} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}".format(caseID=caseID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def list_case_a_c_l(caseID: int, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List ACL entries for an existing case (PUBLIC) :param int caseID: Case ID :param int offset: Skip a number of results :param int limit: Maximum number of returned results :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 267, "limit": 943, "responseCode": 200, "count": 620, "data": [{"id": "Investment wife federal.", "addedTimestamp": 253452639, "addedByUser": {"id": 885, "customerID": 258, "userName": "icampos", "name": "Elizabeth Hampton"}, "grantedSubject": {"id": 538, "customerID": 396, "name": "Richard Ortiz"}, "flags": ["DELETED"], "level": "owner"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Analysis executive somebody run.", "messageTemplate": "Stop evidence do one network development.", "field": "Short pretty bit your size.", "parameter": {}, "timestamp": 701890473}], "currentPage": 820, "size": 184} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/access".format(caseID=caseID) 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 offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) 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
[docs]@register_command(extending=('cases','v2','case')) def grant_access(caseID: int, subjectID: int = None, level: str = 'read',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Grant access to a case (PUBLIC) :param int caseID: Case ID :param int subjectID: ID of subject (user or group) to grant access to. :param str level: Level to grant for subject. (default read) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 284, "limit": 431, "responseCode": 200, "count": 908, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Night consumer kitchen community paper.", "messageTemplate": "Citizen middle than we book police.", "field": "Join ever question use.", "parameter": {}, "timestamp": 884092342}], "currentPage": 678, "size": 332} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/access".format(caseID=caseID) 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 level: body.update({"level": level}) if subjectID: body.update({"subjectID": subjectID}) response = post(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
[docs]@register_command(extending=('cases','v2','case')) def change_access_settings(caseID: int, accessMode: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Change general access settings (PUBLIC) :param int caseID: Case ID :param str accessMode: If set, this will alter the access mode of the case. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 449, "limit": 870, "responseCode": 200, "count": 801, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Heavy budget every look result.", "messageTemplate": "Whole pretty market parent.", "field": "Traditional study win country easy break.", "parameter": {}, "timestamp": 1220694237}], "currentPage": 816, "size": 80} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/access".format(caseID=caseID) 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 accessMode: body.update({"accessMode": accessMode}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def remove_access(caseID: int, aclEntryID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Revoke access from a case (PUBLIC) :param int caseID: Case ID :param str aclEntryID: ACL entry to revoke :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 360, "limit": 52, "responseCode": 200, "count": 917, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Else standard data often full drug.", "messageTemplate": "Citizen understand not usually term factor music quality.", "field": "Development size sometimes gas say.", "parameter": {}, "timestamp": 114528955}], "currentPage": 532, "size": 220} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/access/{aclEntryID}".format(caseID=caseID, aclEntryID=aclEntryID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def list_case_attachments(caseID: int, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List attachments for an existing case (PUBLIC) :param int caseID: Case ID :param int offset: Skip a number of results :param int limit: Maximum number of returned results :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 870, "limit": 575, "responseCode": 200, "count": 987, "data": [{"id": "Under window story person she last set.", "addedTimestamp": 1343738547, "addedByUser": {"id": 88, "customerID": 517, "userName": "esingh", "name": "John Sutton"}, "name": "Kelly Davis", "mimeType": "And administration apply they.", "flags": ["MERGED"], "size": 70}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Base loss around wonder travel.", "messageTemplate": "Have rich suggest anyone wall high pretty.", "field": "Oil TV side also beautiful increase sound.", "parameter": {}, "timestamp": 190354843}], "currentPage": 405, "size": 135} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/attachments".format(caseID=caseID) 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 offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) 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
[docs]@register_command(extending=('cases','v2','case')) def add_attachment(caseID: int, name: str = None, mimeType: str = None, data: str = None, encryptedZip: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Add new attachment (PUBLIC) Upload new attachment as JSON object with base64-encoded data :param int caseID: Case ID :param str name: Name of attachment to add. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str mimeType: MimeType for attachment to add. => Sanitize by regex [^ /]+/[^ /]+ :param str data: Attachment bytes :param bool encryptedZip: If set, mark this attachment as an encrypted zip (should have password 'argus'). NOTE: the service does not encrypt or zip the attachment, this should be done by the client. (default false) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 203, "limit": 9, "responseCode": 200, "count": 960, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Run your everything amount.", "messageTemplate": "Pattern behavior big region fact seat throughout course.", "field": "Both on hear number tend.", "parameter": {}, "timestamp": 634581637}], "currentPage": 765, "size": 522} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/attachments".format(caseID=caseID) 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 name: body.update({"name": name}) if mimeType: body.update({"mimeType": mimeType}) if data: body.update({"data": data}) if encryptedZip: body.update({"encryptedZip": encryptedZip}) response = post(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
[docs]@register_command(extending=('cases','v2','case')) def get_attachment(caseID: int, attachmentID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch specific attachment metadata (PUBLIC) Use /cases/v1/case/{caseID}/attachments/{attachmentID}/download to download attachment contents. :param int caseID: Case ID :param str attachmentID: Attachment ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 170, "limit": 188, "responseCode": 200, "count": 74, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Affect certainly half example good wind debate.", "messageTemplate": "Forward eye financial those mother deep central away.", "field": "Part remember outside various.", "parameter": {}, "timestamp": 956313976}], "currentPage": 37, "size": 715} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/attachments/{attachmentID}".format(caseID=caseID, attachmentID=attachmentID) 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 = {} 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
[docs]@register_command(extending=('cases','v2','case')) def delete_attachment(caseID: int, attachmentID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Delete specified attachment from case (PUBLIC) :param int caseID: Case ID :param str attachmentID: Attachment ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 557, "limit": 443, "responseCode": 200, "count": 773, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Public sing one blue agree now within.", "messageTemplate": "Shoulder loss sea series argue toward.", "field": "Black benefit wind hard.", "parameter": {}, "timestamp": 432911088}], "currentPage": 885, "size": 840} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/attachments/{attachmentID}".format(caseID=caseID, attachmentID=attachmentID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def download_attachment(caseID: int, attachmentID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Download specific attachment contents. (PUBLIC) Returns data stream with the attachments mimetype, and attachment disposition with filename. Use /cases/v1/case/{caseID}/attachments/{attachmentID} to fetch metadata about this attachment. :param int caseID: Case ID :param str attachmentID: Attachment ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/attachments/{attachmentID}/download".format(caseID=caseID, attachmentID=attachmentID) 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 = {} 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
[docs]@register_command(extending=('cases','v2','case')) def close_case(caseID: int, comment: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Close an open case (PUBLIC) :param int caseID: Case ID :param str comment: Closing comment to add to case. May use HTML, will be sanitized. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 93, "limit": 115, "responseCode": 200, "count": 76, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Believe guy wear order water task international.", "messageTemplate": "View girl south owner time ready.", "field": "Consider land voice anything artist.", "parameter": {}, "timestamp": 132538755}], "currentPage": 792, "size": 602} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/close".format(caseID=caseID) 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 comment: body.update({"comment": comment}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def list_case_comments(caseID: int, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List comments for an existing case (PUBLIC) :param int caseID: Case ID :param int offset: Skip a number of results :param int limit: Maximum number of returned results :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 753, "limit": 353, "responseCode": 200, "count": 862, "data": [{"id": "Current sport will book.", "addedTimestamp": 41097678, "addedByUser": {"id": 970, "customerID": 641, "userName": "asoto", "name": "Roger Mann"}, "comment": "Two yes operation drug relate.", "reference": "Enough two find human.", "flags": ["DELETED"], "status": "pendingClose", "priority": "critical", "properties": {"additionalProperties": "Science factor born thus political against explain."}}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "He expert wrong way gun attack moment.", "messageTemplate": "Home always act despite.", "field": "Suggest prevent least event identify receive apply.", "parameter": {}, "timestamp": 1076123041}], "currentPage": 532, "size": 140} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/comments".format(caseID=caseID) 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 offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) 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
[docs]@register_command(extending=('cases','v2','case')) def add_comment(caseID: int, asReplyTo: str = None, comment: str = None, originEmailAddress: str = None, internal: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Submit new comment to case (PUBLIC) :param int caseID: Case ID :param str asReplyTo: Optional ID of comment to reply to. :param str comment: Comment to add. Html is allowed, will be sanitized. :param str originEmailAddress: If comment is added from an email, specify origin email address here => format:email :param bool internal: If true, mark comment as internal, only visible to service techs. Default is false. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 100, "limit": 484, "responseCode": 200, "count": 573, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Everything letter result tree about none common.", "messageTemplate": "Power many nature occur dinner occur.", "field": "Visit black before develop what green public same.", "parameter": {}, "timestamp": 749156224}], "currentPage": 210, "size": 714} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/comments".format(caseID=caseID) 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 asReplyTo: body.update({"asReplyTo": asReplyTo}) if comment: body.update({"comment": comment}) if internal: body.update({"internal": internal}) if originEmailAddress: body.update({"originEmailAddress": originEmailAddress}) response = post(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
[docs]@register_command(extending=('cases','v2','case')) def get_case_comment(caseID: int, commentID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch specific comment (PUBLIC) :param int caseID: Case ID :param str commentID: Comment ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 79, "limit": 324, "responseCode": 200, "count": 586, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Keep final full six.", "messageTemplate": "Choose life page benefit writer kind.", "field": "Power throughout spring because alone up.", "parameter": {}, "timestamp": 1050231119}], "currentPage": 961, "size": 818} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/comments/{commentID}".format(caseID=caseID, commentID=commentID) 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 = {} 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
[docs]@register_command(extending=('cases','v2','case')) def edit_comment(caseID: int, commentID: str, comment: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Edit existing comment (PUBLIC) :param int caseID: Case ID :param str commentID: Comment ID :param str comment: Updated comment :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 69, "limit": 557, "responseCode": 200, "count": 21, "metaData": {"additionalProperties": {}}, "messages": [{"message": "This age people eat carry parent.", "messageTemplate": "Health air affect need Democrat offer run.", "field": "Different agency behavior key candidate.", "parameter": {}, "timestamp": 7956720}], "currentPage": 615, "size": 344} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/comments/{commentID}".format(caseID=caseID, commentID=commentID) 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 comment: body.update({"comment": comment}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def delete_comment(caseID: int, commentID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Mark existing comment as deleted (PUBLIC) :param int caseID: Case ID :param str commentID: Comment ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 747, "limit": 253, "responseCode": 200, "count": 157, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Note also many task factor purpose.", "messageTemplate": "Determine particularly watch citizen personal happy herself.", "field": "Well bed environmental consider feel read.", "parameter": {}, "timestamp": 1378179819}], "currentPage": 875, "size": 51} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/comments/{commentID}".format(caseID=caseID, commentID=commentID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def list_case_history(caseID: int, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List change events for an existing case. This endpoint is not implemented yet. (DEV) :param int caseID: Case ID :param int offset: Skip a number of results :param int limit: Maximum number of returned results :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 679, "limit": 86, "responseCode": 200, "count": 912, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Tough return score house win.", "messageTemplate": "Likely most report test.", "field": "By continue senior try word decision.", "parameter": {}, "timestamp": 151267520}], "currentPage": 473, "size": 60} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/history".format(caseID=caseID) 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 offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) 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
[docs]@register_command(extending=('cases','v2','case')) def publish_case(caseID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Publish existing case not marked as published (PUBLIC) :param int caseID: Case ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 600, "limit": 578, "responseCode": 200, "count": 766, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Various meet Democrat husband.", "messageTemplate": "Husband property act business toward federal contain.", "field": "Easy care try its little senior share.", "parameter": {}, "timestamp": 1199197739}], "currentPage": 417, "size": 782} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/publish".format(caseID=caseID) 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 = {} response = put(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
[docs]@register_command(extending=('cases','v2','case')) def list_case_tags(caseID: int, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List tags for an existing case (PUBLIC) :param int caseID: Case ID :param int offset: Skip a number of results :param int limit: Maximum number of returned results :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 364, "limit": 109, "responseCode": 200, "count": 814, "data": [{"id": "Want central probably.", "addedTimestamp": 985213986, "addedByUser": {"id": 222, "customerID": 810, "userName": "vmurphy", "name": "David Freeman"}, "key": "Movement key land hope six perform only.", "value": "You hospital compare.", "flags": ["MERGED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Mrs language where mission board entire.", "messageTemplate": "Middle for civil spend agent music once work.", "field": "Fear size music edge.", "parameter": {}, "timestamp": 1409344043}], "currentPage": 55, "size": 218} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/tags".format(caseID=caseID) 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 offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) 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
[docs]@register_command(extending=('cases','v2','case')) def add_case_tag(caseID: int, tags: list = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Add tag to case (PUBLIC) :param int caseID: Case ID :param list tags: Add multiple tags as key/value strings or JSON objects :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 338, "limit": 656, "responseCode": 200, "count": 370, "data": [{"id": "Tough off too this research size pattern.", "addedTimestamp": 314575760, "addedByUser": {"id": 501, "customerID": 863, "userName": "vwalker", "name": "Pamela Park"}, "key": "By in analysis race toward call particular.", "value": "Leg some throughout ready road born.", "flags": ["MERGED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Between cost item always.", "messageTemplate": "Herself left science line us road.", "field": "Standard form develop my none home fast.", "parameter": {}, "timestamp": 937474072}], "currentPage": 509, "size": 934} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/tags".format(caseID=caseID) 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 tags: body.update({"tags": tags}) response = post(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
[docs]@register_command(extending=('cases','v2','case')) def remove_case_tag_by_id(caseID: int, tagID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Remove existing tag (PUBLIC) :param int caseID: Case ID :param str tagID: Tag ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 408, "limit": 547, "responseCode": 200, "count": 236, "data": [{"id": "Know not nothing edge.", "addedTimestamp": 671392523, "addedByUser": {"id": 165, "customerID": 56, "userName": "virginia80", "name": "Elizabeth Williams"}, "key": "Race six no describe win part movie.", "value": "Parent project us represent can heavy least.", "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Not reduce firm.", "messageTemplate": "Keep point speak year ask data structure.", "field": "From treatment draw bar talk similar.", "parameter": {}, "timestamp": 106707937}], "currentPage": 635, "size": 946} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/tags/{tagID}".format(caseID=caseID, tagID=tagID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def remove_case_tag_by_key_value(caseID: int, tagKey: str, tagValue: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Remove existing tag (PUBLIC) :param int caseID: Case ID :param str tagKey: Tag Key :param str tagValue: Tag Value :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 604, "limit": 306, "responseCode": 200, "count": 942, "data": [{"id": "Country different kind sound wrong us story.", "addedTimestamp": 276985505, "addedByUser": {"id": 594, "customerID": 719, "userName": "tiffany64", "name": "Tamara Moore"}, "key": "Could teach growth factor meeting family poor.", "value": "Still audience situation agency.", "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Try often debate whole.", "messageTemplate": "Money author group especially.", "field": "Per more western interesting.", "parameter": {}, "timestamp": 691710921}], "currentPage": 621, "size": 914} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/tags/{tagKey}/{tagValue}".format(caseID=caseID, tagKey=tagKey, tagValue=tagValue) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def current_user_watcher_status(caseID: int, email: bool = 'False', sms: bool = 'False', verbose: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Query and set watcher status for the current user on this case (PUBLIC) :param int caseID: Case ID :param bool email: If true, enable email notification for current user. If false, disable email. Default is no change. :param bool sms: If true, enable SMS notification for current user. If false, disable SMS. Default is no change. :param bool verbose: If set, explicitly set verbosity for watcher for enabled contact methods (will override default settings on current user) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 170, "limit": 51, "responseCode": 200, "count": 705, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Try imagine back fill night budget.", "messageTemplate": "Note political moment western coach available action.", "field": "Agreement significant according laugh must.", "parameter": {}, "timestamp": 926916014}], "currentPage": 767, "size": 422} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watch".format(caseID=caseID) 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 email: body.update({"email": email}) if sms: body.update({"sms": sms}) if verbose: body.update({"verbose": verbose}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def remove_current_user_watcher(caseID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Remove the current user from the watchlist of this case.If the currentuser is a contact, this will override the contact settings for the current user for this case. (PUBLIC) :param int caseID: Case ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 801, "limit": 315, "responseCode": 200, "count": 624, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Information call pass company final information organization.", "messageTemplate": "Mean general ahead human effect rich husband onto.", "field": "Crime without call nature.", "parameter": {}, "timestamp": 1293774827}], "currentPage": 108, "size": 534} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watch".format(caseID=caseID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def list_case_watchers(caseID: int, offset: int = 0, limit: int = 25, includeExplicit: bool = 'True', includeDefault: bool = 'True', includeDisabled: bool = 'True',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List watchers for an existing case (PUBLIC) :param int caseID: Case ID :param int offset: Skip a number of results :param int limit: Maximum number of returned results :param bool includeExplicit: Include explicit watchers (default true) :param bool includeDefault: Include default watchers (default true) :param bool includeDisabled: Include disabled watchers (default false) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 886, "limit": 979, "responseCode": 200, "count": 384, "data": [{"id": "Authority parent recognize example available matter.", "addedTimestamp": 1045658925, "addedByUser": {"id": 702, "customerID": 177, "userName": "kristy96", "name": "Brittany Warren"}, "flags": ["MERGED"], "subject": {"id": 622, "customerID": 342, "name": "Dr. Elizabeth Taylor"}, "contactID": 941, "role": "watcher", "destination": "Act study strategy.", "minimumPriority": "medium"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Beat mother attorney rather.", "messageTemplate": "Choice include them.", "field": "Act traditional just build business southern generation surface.", "parameter": {}, "timestamp": 1387617135}], "currentPage": 33, "size": 755} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watchers".format(caseID=caseID) 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 offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) if includeExplicit: body.update({"includeExplicit": includeExplicit}) if includeDefault: body.update({"includeDefault": includeDefault}) if includeDisabled: body.update({"includeDisabled": includeDisabled}) 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
[docs]@register_command(extending=('cases','v2','case')) def add_case_watcher(caseID: int, subjectID: int = None, destination: str = None, type: str = 'email', verbose: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Add watcher to case (PUBLIC) :param int caseID: Case ID :param int subjectID: Subject to add watcher for :param str destination: Contact information to add as watcher (email address or phone number). If subject is specified, this is ignored. :param str type: Type of watcher to add (default email) :param bool verbose: If set, explicitly set verbosity for watcher (will override default settings on subject) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 566, "limit": 236, "responseCode": 200, "count": 348, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Hair international capital hospital.", "messageTemplate": "Should continue scientist able available.", "field": "Religious cut best reduce.", "parameter": {}, "timestamp": 177479874}], "currentPage": 825, "size": 575} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watchers".format(caseID=caseID) 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 type: body.update({"type": type}) if subjectID: body.update({"subjectID": subjectID}) if destination: body.update({"destination": destination}) if verbose: body.update({"verbose": verbose}) response = post(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
[docs]@register_command(extending=('cases','v2','case')) def update_watcher_settings(caseID: int, defaultWatchers: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Update general watcher settings on a case (PUBLIC) :param int caseID: Case ID :param bool defaultWatchers: If set, will enable/disable use of default watchers on this case. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 644, "limit": 56, "responseCode": 200, "count": 944, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Own learn common under policy glass single.", "messageTemplate": "Material war both short none.", "field": "Finally politics compare no concern act.", "parameter": {}, "timestamp": 1356843325}], "currentPage": 338, "size": 710} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watchers".format(caseID=caseID) 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 defaultWatchers: body.update({"defaultWatchers": defaultWatchers}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def remove_case_contact_watcher(caseID: int, contactID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Remove a specific contact listed in the default watchers from watching this case (PUBLIC) :param int caseID: Case ID :param int contactID: Contact ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 682, "limit": 828, "responseCode": 200, "count": 277, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Focus director before scene teach.", "messageTemplate": "National view administration game town pass college.", "field": "Speak red would president executive more.", "parameter": {}, "timestamp": 1122243132}], "currentPage": 330, "size": 334} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watchers/contact/{contactID}".format(caseID=caseID, contactID=contactID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def update_case_watcher(caseID: int, watcherID: str, verbose: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Update settings for a specific watcher on a case (PUBLIC) :param int caseID: Case ID :param str watcherID: Watcher ID :param bool verbose: If set, will enable/disable verbose status for this watcher. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 12, "limit": 415, "responseCode": 200, "count": 757, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Write style provide fund practice.", "messageTemplate": "Those night tell structure hold however left.", "field": "Voice record kid difference yeah whole scene.", "parameter": {}, "timestamp": 372589232}], "currentPage": 113, "size": 284} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watchers/{watcherID}".format(caseID=caseID, watcherID=watcherID) 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 verbose: body.update({"verbose": verbose}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def remove_case_watcher(caseID: int, watcherID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Remove specific watcher from a case (PUBLIC) :param int caseID: Case ID :param str watcherID: Watcher ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 538, "limit": 981, "responseCode": 200, "count": 229, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Second contain main huge Mrs structure.", "messageTemplate": "Hotel check along name often organization.", "field": "Collection part land for her.", "parameter": {}, "timestamp": 1474310408}], "currentPage": 147, "size": 792} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/watchers/{watcherID}".format(caseID=caseID, watcherID=watcherID) 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 = {} response = delete(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
[docs]@register_command(extending=('cases','v2','case')) def list_workflows(caseID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List workflows for an existing case (PUBLIC) :param int caseID: Case ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 944, "limit": 579, "responseCode": 200, "count": 132, "data": [{"id": "Child capital nothing later forward cause state benefit.", "addedTimestamp": 316899302, "addedByUser": {"id": 403, "customerID": 162, "userName": "jpatel", "name": "Randy Beck"}, "workflow": "customerUpdate", "acknowledgedByUser": {"id": 807, "customerID": 876, "userName": "smithkevin", "name": "Gabriel Taylor"}, "acknowledgedTimestamp": 69799872, "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Understand anyone wall man charge less.", "messageTemplate": "Wind save treat mention smile successful light.", "field": "War policy carry red those red style late.", "parameter": {}, "timestamp": 151663063}], "currentPage": 516, "size": 563} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/workflows".format(caseID=caseID) 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 = {} 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
[docs]@register_command(extending=('cases','v2','case')) def acknowledge_workflow(caseID: int, workflow: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Acknowledge workflow on case (PUBLIC) :param int caseID: Case ID :param str workflow: Workflow to acknowledge :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 433, "limit": 730, "responseCode": 200, "count": 575, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Baby color indicate.", "messageTemplate": "Peace property mouth so work.", "field": "Wear couple increase part stock my see.", "parameter": {}, "timestamp": 607911746}], "currentPage": 140, "size": 995} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/workflows/{workflow}/acknowledge".format(caseID=caseID, workflow=workflow) 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 = {} response = put(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
[docs]@register_command(extending=('cases','v2','case')) def request_workflow(caseID: int, workflow: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Request new workflow on case (PUBLIC) :param int caseID: Case ID :param str workflow: Workflow to request :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 927, "limit": 520, "responseCode": 200, "count": 741, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Relationship blood form true.", "messageTemplate": "Sit improve over run lot leave lose one.", "field": "Four the until day likely group.", "parameter": {}, "timestamp": 21296286}], "currentPage": 920, "size": 839} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{caseID}/workflows/{workflow}/request".format(caseID=caseID, workflow=workflow) 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 = {} response = put(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
[docs]@register_command(extending=('cases','v2','case')) def get_case_metadata_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Returns the basic case descriptor for the case identified by ID (PUBLIC) :param int id: Case ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 963, "limit": 900, "responseCode": 200, "count": 630, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Box successful international likely Republican.", "messageTemplate": "Crime candidate major military into.", "field": "Writer nor institution.", "parameter": {}, "timestamp": 605895776}], "currentPage": 279, "size": 198} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{id}".format(id=id) 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 = {} 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
[docs]@register_command(extending=('cases','v2','case')) def update_case(id: int, subject: str = None, description: str = None, status: str = None, priority: str = None, category: str = None, reporterID: int = None, assignedUserID: int = None, assignedTechID: int = None, customerReference: str = None, comment: str = None, originEmailAddress: str = None, internalComment: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Request changes to basic fields of an existing case (PUBLIC) :param int id: Case ID :param str subject: If set, change subject of case. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str description: If set, change description of case. May use HTML, will be sanitized. :param str status: If set, change status of case :param str priority: If set, change priority of case. :param str category: If set, assign given category to specified category (by category shortname). Set value to empty string to unset category. :param int reporterID: If set, set given user as reporter for case. :param int assignedUserID: If set, assign given user to case. :param int assignedTechID: If set, assign given technical user (solution engineer) to case. :param str customerReference: If set, change customer reference for case. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str comment: If set, add comment to case. May use HTML, will be sanitized. :param str originEmailAddress: If update is made from an email, specify origin email address here => format:email :param bool internalComment: If true, add comment as internal. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 205, "limit": 831, "responseCode": 200, "count": 437, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Opportunity despite manager season movie role.", "messageTemplate": "Stop class not mean beyond blood.", "field": "Answer stop government half per decision hit.", "parameter": {}, "timestamp": 17204393}], "currentPage": 514, "size": 802} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{id}".format(id=id) 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 subject: body.update({"subject": subject}) if description: body.update({"description": description}) if status: body.update({"status": status}) if priority: body.update({"priority": priority}) if category: body.update({"category": category}) if reporterID: body.update({"reporterID": reporterID}) if assignedUserID: body.update({"assignedUserID": assignedUserID}) if assignedTechID: body.update({"assignedTechID": assignedTechID}) if customerReference: body.update({"customerReference": customerReference}) if comment: body.update({"comment": comment}) if internalComment: body.update({"internalComment": internalComment}) if originEmailAddress: body.update({"originEmailAddress": originEmailAddress}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def move_case(id: int, customerID: int = None, service: str = None, category: str = None, type: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Move a case to a differnet category, service or customer (PUBLIC) :param int id: Case ID :param int customerID: If set, move case to specified customer. :param str service: If set, move case to specified service. :param str category: If set, assign given category to specified category (by category shortname). Set value to empty string to unset category. :param str type: If set, move case to specified type. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 285, "limit": 78, "responseCode": 200, "count": 753, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Pay base him make special become maintain.", "messageTemplate": "Happy everybody sister choose.", "field": "Become star them drive cost vote election.", "parameter": {}, "timestamp": 713330972}], "currentPage": 347, "size": 749} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{id}/move".format(id=id) 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 customerID: body.update({"customerID": customerID}) if service: body.update({"service": service}) if category: body.update({"category": category}) if type: body.update({"type": type}) response = put(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
[docs]@register_command(extending=('cases','v2','case')) def merge_cases(mergeInto: int, mergeFrom: int, description: str = None, priority: str = None, status: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Merge two cases (PUBLIC) This will merge the contents of the mergeFrom case into the mergeInto case.The mergeFrom case will be marked as deleted/merged, and the mergeInto case will continue to exist, but with entries and attachments from the mergeFrom case embedded into it.If nothing else is specified, the status and priority of the mergeInto case will be retained. :param int mergeInto: ID of case to merge into :param int mergeFrom: ID of case to merge :param str description: Case description of merged case. May use HTML, which will be sanitized. If not set, the description of both cases will be combined. :param str priority: Priority of merged case. If not set, keep priority of mergeInto case. :param str status: Status of merged case. If not set, keep status of mergeInto case. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 661, "limit": 132, "responseCode": 200, "count": 479, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Would hard police decide manage.", "messageTemplate": "Main player traditional design discussion.", "field": "Economy agent again finally vote in effect.", "parameter": {}, "timestamp": 858576009}], "currentPage": 500, "size": 658} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/case/{mergeInto}/merge/{mergeFrom}".format(mergeInto=mergeInto, mergeFrom=mergeFrom) 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 description: body.update({"description": description}) if priority: body.update({"priority": priority}) if status: body.update({"status": status}) response = put(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