def get_knowledge_article_by_id(self, article_id, parse_html=False): """ Get knowledge article by ID, set parse_html to True if you want to parse HTML content of knowledge article :param article_id: ID of article :param parse_html: Set to true to parse HTML output of article :return: Knowledge base article details in JSON format """ query = requests.get( '{}/rest/{}/entity-page/initializationData/Article/{}'.format( self.base_url, self.tenant_id, article_id), cookies=self.get_cookie()).json() if parse_html: for k, v in query.items(): new_value = SmaxTenant.parse_output(str(v)) query[k] = new_value return query return query
def get_incident_models(self, query_params, filters=None): """ Get incident models based on params passed :param query_params: FieldIDs you want to query, encased in quotes, comma separated :param filters: Filters you'd like to apply, comma separated and encased in quotes, default is None :return: Returns JSON result of incident models query """ assert type(query_params) == str, 'Query params must be in string form' query_params = str(query_params).replace(' ', '') if filters: assert type(filters) == str, 'Filter params must be in string form' filters = SmaxTenant.fix_url_encode( urllib.parse.quote_plus(filters)) query_endpoint = requests.get( '{}/rest/{}/ems/EntityModel?layout={}&filter={}'.format( self.base_url, self.tenant_id, query_params, filters), cookies=self.get_cookie()).json() return query_endpoint query_endpoint = requests.get( '{}/rest/{}/ems/EntityModel?layout={}'.format( self.base_url, self.tenant_id, query_params), cookies=self.get_cookie()).json() return query_endpoint