Lists all cases for the given organization. Other parameters are optional for filtering purposes.
Returns: a json object with an list of meta data for all requested cases
:param int organization_Id:
id of the organization for which you want to list the cases
:param string name:
optional parameter to filter on the name of the case
:param string creator:
optional parameter to filter on the name of the creator
:param list[int] status:
optional parameter to filter on the status of the case. You will only see projects that conform to one of the given values.
The possible values are: '0 = ongoing' -- '1 = problem' -- '2 = finished' -- '3 = closed'
:param string sortField_name:
optional parameter to sort the listed cases on their name
:param int sortField_order:
optional parameter to sort the listed cases in a certain order
The possible values are: '0 = ascending' -- '1 = descending'
:param int page_number:
optional parameter to only get cases of the given page number
:param int page_size:
optional parameter to select what size you want a page of cases to be.
API call function:
def list_all_cases(self, organization_Id, name=None, creator=None, status=None, sortField_name=None, sortField_order=None, page_number=None, page_size=None) -> Dict:
url = self.caseserver_url + "/organizations/" + str(organization_Id) + "/cases"
#for the optional parameters
url += "?"
if name is not None:
url += "Name=" + name + "&"
if creator is not None:
url += "Creator=" + creator + "&"
if status is not None:
for st in status:
url += "Status=" + str(st) + "&"
if sortField_name is not None:
url += "SortField.Name=" + sortField_name + "&"
if sortField_order is not None:
url += "SortField.Order=" + str(sortField_order) + "&"
if page_number is not None:
url += "PageNumber=" + str(page_number) + "&"
if page_size is not None:
url += "PageSize=" + str(page_size) + "&"
url = url[:-1]
response = requests.get(url, headers=self.get_header)
if(response.ok):
print("cases: \n", response.text, "\n")
return response.json()
else:
logger.error(f"listing cases failed: {response.content}")
raise Exception