Question

REST API search not filtering on sub_type

  • 1 December 2023
  • 3 replies
  • 66 views

I am using the REST API in order to do some cleanup. One aspect of this is to update the sub_type field on SR’s that are using old sub_type forms which I want to remove. 

 

I tried issuing the search endpoint with the url:

https://[env_name].sysaidit.com/api/v1/sr/search?query=*&fields=id,sub_type,problem_type&sub_type=31

This is not working and returning me SR’s with sub_types that are not of the ID 31.

 

Alternatively, I could send a request that filters on problem_type and the results are properly filtered. 

https://[env_name].sysaidit.com/api/v1/sr/search?query=*&fields=id,sub_type,problem_type&problem_type=Security


Why is sub_type specifically not being respected in the search?

 

Thanks


3 replies

Userlevel 1
Badge

Hi David,

 

I see that you’ve submitted a ticket on our help desk portal regarding REST API.

We’ll work on this issue on that end - our representatives will reach out shortly with an answer.

For others - the answer to this seems to be that you cannot filter on sub_type via the API. You can update the sub_type field, but you cannot use it to filter in the search or list endpoints.

 

I don’t understand why, tech support wasn’t able to give me a good answer, just that it seems you couldn’t.

 

My solution was to just page through all service requests and update the sub_type for anything that met my requirement.

Badge

Does sub_type have a parent type?

Meaning sub_type implies that it is a second level of something.

I noticed that SysAid API will not allow to filter on a second level of anything.

You have to specify the parent level as the key and then list the value for both parent and sub, separated by an underscore. For example:

Parent type is called Categories

Parent value is Animal

sub_type is Dog ← this is what you want to filter on.

So you specify it ?Categories=Animal_Dog

 

Reply