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": 56, "limit": 795, "responseCode": 200, "count": 796, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Add fight yourself add meet hair.", "messageTemplate": "Ability edge lawyer successful.", "field": "Read able democratic a produce middle.", "parameter": {}, "timestamp": 135403322}], "currentPage": 535, "size": 997} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 414, "limit": 319, "responseCode": 200, "count": 417, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Lead seat he recent.", "messageTemplate": "Care mother by that last nation.", "field": "Protect reveal record or our parent possible.", "parameter": {}, "timestamp": 116773974}], "currentPage": 900, "size": 556} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 937, "limit": 530, "responseCode": 200, "count": 104, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Direction what more when who size street.", "messageTemplate": "Visit forget edge must parent fight only TV.", "field": "Attention involve visit lead score when gun.", "parameter": {}, "timestamp": 263247423}], "currentPage": 180, "size": 946} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 82, "limit": 459, "responseCode": 200, "count": 480, "data": [{"id": "Difficult civil particular science seat pretty fear.", "addedTimestamp": 221034567, "addedByUser": {"id": 566, "customerID": 744, "userName": "pattersonkelly", "name": "Charles Benson"}, "grantedSubject": {"id": 62, "customerID": 340, "name": "Charles Chen"}, "flags": ["DELETED"], "level": "read"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Car sing knowledge test interview others station.", "messageTemplate": "Deal ask home.", "field": "There several there chance social.", "parameter": {}, "timestamp": 609090771}], "currentPage": 754, "size": 390} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 328, "limit": 921, "responseCode": 200, "count": 881, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Maybe peace social traditional short.", "messageTemplate": "Body decide lose never school.", "field": "Body brother skill remain serious experience when.", "parameter": {}, "timestamp": 1506828304}], "currentPage": 957, "size": 797} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 641, "limit": 735, "responseCode": 200, "count": 878, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Rate minute thousand production.", "messageTemplate": "Be up specific hope year moment quite.", "field": "Large fly heart civil.", "parameter": {}, "timestamp": 511178376}], "currentPage": 606, "size": 577} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 814, "limit": 977, "responseCode": 200, "count": 864, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Themselves try mind.", "messageTemplate": "Trip last someone be cell.", "field": "Art next cold feeling.", "parameter": {}, "timestamp": 858566420}], "currentPage": 811, "size": 905} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 676, "limit": 653, "responseCode": 200, "count": 911, "data": [{"id": "You TV necessary effect.", "addedTimestamp": 701250330, "addedByUser": {"id": 417, "customerID": 864, "userName": "jakezimmerman", "name": "Marcus Shepherd"}, "name": "Timothy Williams", "mimeType": "Game thing money cup base vote defense.", "flags": ["DELETED"], "size": 91}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Instead training clear enter generation today past.", "messageTemplate": "Evidence box strong pay despite.", "field": "Finally serve bed ready in again.", "parameter": {}, "timestamp": 1164603366}], "currentPage": 416, "size": 323} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 173, "limit": 325, "responseCode": 200, "count": 266, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Only score present century fear PM personal.", "messageTemplate": "Authority must church concern PM especially long.", "field": "If throw remain analysis soon probably structure.", "parameter": {}, "timestamp": 420583495}], "currentPage": 512, "size": 383} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 293, "limit": 36, "responseCode": 200, "count": 808, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Support everything culture year nice.", "messageTemplate": "Mean Democrat sister American.", "field": "Minute political area institution coach.", "parameter": {}, "timestamp": 147050641}], "currentPage": 945, "size": 205} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 77, "limit": 735, "responseCode": 200, "count": 443, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Dream matter picture break successful several.", "messageTemplate": "Economic degree walk beautiful.", "field": "Apply woman yet wind.", "parameter": {}, "timestamp": 1350768235}], "currentPage": 972, "size": 804} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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://portal.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": 57, "limit": 237, "responseCode": 200, "count": 285, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Dinner great couple box.", "messageTemplate": "Degree medical cell.", "field": "Into its example.", "parameter": {}, "timestamp": 951111860}], "currentPage": 392, "size": 92} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 187, "limit": 983, "responseCode": 200, "count": 402, "data": [{"id": "Can official scientist fight defense risk often room.", "addedTimestamp": 1032963722, "addedByUser": {"id": 184, "customerID": 801, "userName": "donna59", "name": "Maria Cook"}, "comment": "Pattern woman difference since.", "reference": "Factor century public instead room people system.", "flags": ["REPLACED"], "status": "pendingClose", "priority": "medium", "properties": {"additionalProperties": "Would low onto matter owner ever source international."}}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Born allow skin economic manage describe.", "messageTemplate": "Break foreign simply provide rise speak brother.", "field": "Realize season win fear lot piece.", "parameter": {}, "timestamp": 280884774}], "currentPage": 983, "size": 874} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 852, "limit": 889, "responseCode": 200, "count": 523, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Wide class similar.", "messageTemplate": "Service main tell entire threat bar offer.", "field": "Letter claim forget direction good way.", "parameter": {}, "timestamp": 731774646}], "currentPage": 116, "size": 898} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 971, "limit": 600, "responseCode": 200, "count": 102, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Save establish increase color store of here property.", "messageTemplate": "Should tough weight director music plant soldier.", "field": "Million ten debate health little.", "parameter": {}, "timestamp": 1228861801}], "currentPage": 367, "size": 909} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 582, "limit": 750, "responseCode": 200, "count": 282, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Appear response move trouble amount specific.", "messageTemplate": "Service decide meet.", "field": "Listen fast itself business impact number eight.", "parameter": {}, "timestamp": 1448439659}], "currentPage": 300, "size": 608} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 472, "limit": 27, "responseCode": 200, "count": 616, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Sound point reveal whom run morning.", "messageTemplate": "Lot instead marriage see fly moment.", "field": "Partner worry successful best seek believe.", "parameter": {}, "timestamp": 1517920261}], "currentPage": 398, "size": 442} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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 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": 378, "limit": 698, "responseCode": 200, "count": 711, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Daughter center west table offer former.", "messageTemplate": "Toward along only where sound.", "field": "Here property maybe.", "parameter": {}, "timestamp": 1363435714}], "currentPage": 349, "size": 510} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 77, "limit": 572, "responseCode": 200, "count": 964, "data": [{"id": "Remain like bad seven article.", "addedTimestamp": 1448893893, "addedByUser": {"id": 811, "customerID": 212, "userName": "bchase", "name": "Maria Hernandez"}, "key": "She baby as act however improve focus.", "value": "Paper chair short order listen wonder idea.", "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Must kind bank court keep same pay.", "messageTemplate": "Energy military reality often.", "field": "Themselves remain until size.", "parameter": {}, "timestamp": 987366529}], "currentPage": 483, "size": 795} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 115, "limit": 638, "responseCode": 200, "count": 939, "data": [{"id": "Suggest car hard similar enjoy if.", "addedTimestamp": 689100448, "addedByUser": {"id": 745, "customerID": 783, "userName": "brandonberg", "name": "Kimberly Jones"}, "key": "Offer prove need group.", "value": "Into field building magazine let listen story black.", "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "National mouth item black.", "messageTemplate": "Ask song during responsibility.", "field": "Sell toward sea mother local stop day everything.", "parameter": {}, "timestamp": 670794832}], "currentPage": 513, "size": 551} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 108, "limit": 840, "responseCode": 200, "count": 434, "data": [{"id": "Meet order news management follow camera.", "addedTimestamp": 156404593, "addedByUser": {"id": 699, "customerID": 283, "userName": "melissadixon", "name": "Benjamin Cox"}, "key": "Few myself can music anyone difficult.", "value": "Call similar break help.", "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Second walk for race world themselves cup.", "messageTemplate": "Television all yet training.", "field": "Manage scene talk form science anyone question head.", "parameter": {}, "timestamp": 391366044}], "currentPage": 624, "size": 165} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 655, "limit": 278, "responseCode": 200, "count": 341, "data": [{"id": "Authority road produce forget accept plant none.", "addedTimestamp": 764305400, "addedByUser": {"id": 186, "customerID": 247, "userName": "maryjordan", "name": "Darrell Moore"}, "key": "Picture consumer scene.", "value": "Lose west view evidence add.", "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Training ahead beat age.", "messageTemplate": "System action toward clear deep none same.", "field": "Need similar place attack work address loss.", "parameter": {}, "timestamp": 287362782}], "currentPage": 592, "size": 897} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 109, "limit": 364, "responseCode": 200, "count": 809, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Dark tend go travel.", "messageTemplate": "Cultural vote ready anything order make.", "field": "Music entire water arm sport matter image project.", "parameter": {}, "timestamp": 224168203}], "currentPage": 500, "size": 178} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 313, "limit": 521, "responseCode": 200, "count": 881, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Season order doctor.", "messageTemplate": "Certain himself staff type authority south.", "field": "Mention purpose choice any establish similar.", "parameter": {}, "timestamp": 408510158}], "currentPage": 142, "size": 486} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 43, "limit": 151, "responseCode": 200, "count": 198, "data": [{"id": "Report likely how want throw white.", "addedTimestamp": 579038850, "addedByUser": {"id": 416, "customerID": 992, "userName": "williamjones", "name": "Brian Cervantes"}, "flags": ["VERBOSE"], "subject": {"id": 475, "customerID": 299, "name": "Deanna Turner"}, "contactID": 640, "role": "watcher", "destination": "Attention high image.", "minimumPriority": "high"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Song guy middle later customer.", "messageTemplate": "Establish with improve reality town executive.", "field": "Like impact machine me determine training up family.", "parameter": {}, "timestamp": 827772804}], "currentPage": 592, "size": 855} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 982, "limit": 196, "responseCode": 200, "count": 742, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Hair ability two during threat week.", "messageTemplate": "Time late Republican respond together.", "field": "Few decide system cold radio hard.", "parameter": {}, "timestamp": 1243000758}], "currentPage": 788, "size": 168} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 2, "limit": 554, "responseCode": 200, "count": 155, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Perform stock surface discussion.", "messageTemplate": "Child show executive catch most phone.", "field": "Control research view stay.", "parameter": {}, "timestamp": 42443497}], "currentPage": 930, "size": 875} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 933, "limit": 230, "responseCode": 200, "count": 253, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Short two drive gas personal property just.", "messageTemplate": "Material section boy people either.", "field": "Thing remain brother center.", "parameter": {}, "timestamp": 1112087172}], "currentPage": 597, "size": 970} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 563, "limit": 755, "responseCode": 200, "count": 685, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Score coach science eight that top.", "messageTemplate": "Value work from ask determine thing ability.", "field": "Resource affect suddenly leg number.", "parameter": {}, "timestamp": 666276656}], "currentPage": 748, "size": 635} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 342, "limit": 586, "responseCode": 200, "count": 618, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Water air eight.", "messageTemplate": "Population if each speak.", "field": "Gun director break than out.", "parameter": {}, "timestamp": 719029012}], "currentPage": 548, "size": 529} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 740, "limit": 999, "responseCode": 200, "count": 456, "data": [{"id": "Machine life participant ago risk.", "addedTimestamp": 399763677, "addedByUser": {"id": 543, "customerID": 659, "userName": "weberandrew", "name": "Jamie Odom"}, "workflow": "validation", "acknowledgedByUser": {"id": 19, "customerID": 213, "userName": "patrick96", "name": "Lisa Martin"}, "acknowledgedTimestamp": 931296804, "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Receive food political remain better the shoulder.", "messageTemplate": "Onto certainly or degree character.", "field": "Boy ground third kitchen entire.", "parameter": {}, "timestamp": 558798475}], "currentPage": 639, "size": 122} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 756, "limit": 932, "responseCode": 200, "count": 1000, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Later team serious investment.", "messageTemplate": "Nation grow know set serve coach.", "field": "Pull store voice positive gas current allow.", "parameter": {}, "timestamp": 569878334}], "currentPage": 864, "size": 532} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 644, "limit": 197, "responseCode": 200, "count": 170, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Provide although decision also citizen worry present building.", "messageTemplate": "Behavior activity whom sit hand truth do.", "field": "With hard find local.", "parameter": {}, "timestamp": 95566046}], "currentPage": 708, "size": 775} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 996, "limit": 515, "responseCode": 200, "count": 700, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Quickly series sport set might message.", "messageTemplate": "National reason discover treatment degree time field.", "field": "Reach song rest spend significant action.", "parameter": {}, "timestamp": 1136003030}], "currentPage": 556, "size": 548} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 807, "limit": 265, "responseCode": 200, "count": 349, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Recent at wear positive in live.", "messageTemplate": "Born car together experience follow factor throughout.", "field": "More perhaps investment face amount factor.", "parameter": {}, "timestamp": 812494690}], "currentPage": 65, "size": 507} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 258, "limit": 78, "responseCode": 200, "count": 503, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Value direction investment relate.", "messageTemplate": "Add class east follow edge add garden simply.", "field": "Carry card toward relate.", "parameter": {}, "timestamp": 1095313103}], "currentPage": 18, "size": 423} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 8, "limit": 671, "responseCode": 200, "count": 511, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Goal consider defense group me detail again.", "messageTemplate": "Computer government let begin.", "field": "Degree study manage building.", "parameter": {}, "timestamp": 1296860277}], "currentPage": 334, "size": 972} """ from requests import put from argus_api.exceptions import http url = "https://portal.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