API v3 "search_criteria" doesnt work with more than one field

API v3 "search_criteria" doesnt work with more than one field

I'm trying to use the API  for ServiceDesk Plus.

I am using the tester on https://servicedesk_url/SetUpWizard.do?forwardTo=apidoc -> Request -> View All Requests

It seems I cannot get the search_criteria to work unless I only have one simple field within it.

Example 1. This works and provides lots of request results:


  1. {
  2.     "list_info": {
  3.         "fields_required": [
  4.             "group",
  5.             "status"
  6.         ],
  7.         "search_criteria": {
  8.             "condition": "is not",
  9.             "field": "status.name",
  10.             "values": [
  11.                 "Lokið"
  12.             ]
  13.         },
  14.         "row_count": 100,
  15.         "get_total_count": true
  16.     }
  17. }
Example 2. This one also works and provides lots of request results:


  1. {
  2.     "list_info": {
  3.         "fields_required": [
  4.             "group",
  5.             "status"
  6.         ],
  7.         "search_criteria": {
  8.             "condition": "is",
  9.             "field": "group.name",
  10.             "values": [
  11.                 "6 Bakvinnsla"
  12.             ]
  13.         },
  14.         "row_count": 100,
  15.         "get_total_count": true
  16.     }
  17. }
However if I combine the two search_criteria fields using identical examples to the documentation here, it provdies error codes.

Example 3 which should work:


  1. {
  2.     "list_info": {
  3.         "fields_required": [
  4.             "group",
  5.             "status"
  6.         ],
  7.         "search_criteria": [
  8.             {
  9.                 "field": "group.name",
  10.                 "condition": "is",
  11.                 "values": [
  12.                     "6 Bakvinnsla"
  13.                 ]
  14.             },
  15.             {
  16.                 "field": "status.name",
  17.                 "condition": "is not",
  18.                 "values": [
  19.                     "Lokið"
  20.                 ]
  21.             }
  22.         ],
  23.         "row_count": 100,
  24.         "get_total_count": true
  25.     }
  26. }
This provides the following error code:


  1. {
  2.     "response_status": {
  3.         "status_code": 4000,
  4.         "status": "failed",
  5.         "messages": [
  6.             {
  7.                 "field": "list_info.search_criteria",
  8.                 "status_code": 4001,
  9.                 "type": "failed"
  10.             }
  11.         ]
  12.     }
  13. }
Example 4 also does not work:


  1. {
  2.     "list_info": {
  3.         "fields_required": [
  4.             "group",
  5.             "status"
  6.         ],
  7.         "search_criteria": [
  8.             {
  9.                 "field": "group",
  10.                 "condition": "is",
  11.                 "value": {
  12.                     "id": "11701",
  13.                     "name": "6 Bakvinnsla"
  14.                 }
  15.             },
  16.             {
  17.                 "field": "status",
  18.                 "condition": "is not",
  19.                 "value": {
  20.                     "id": "3",
  21.                     "name": "Lokið"
  22.                 }
  23.             }
  24.         ],
  25.         "row_count": 100,
  26.         "get_total_count": true
  27.     }
  28. }
This provides the same as the previous error code:


  1. {
  2.     "response_status": {
  3.         "status_code": 4000,
  4.         "status": "failed",
  5.         "messages": [
  6.             {
  7.                 "field": "list_info.search_criteria",
  8.                 "status_code": 4001,
  9.                 "type": "failed"
  10.             }
  11.         ]
  12.     }
  13. }
Example 5 using "Children" field also does not work:


  1. {
  2.     "list_info": {
  3.         "fields_required": [
  4.             "group",
  5.             "status"
  6.         ],
  7.         "search_criteria": [
  8.             "field": "group.name",
  9.             "condition": "is",
  10.             "values": [
  11.                 "6 Bakvinnsla"
  12.             ],
  13.             "children":[
  14.                 {
  15.                     "field": "status.name",
  16.                     "condition": "is not",
  17.                     "values": [
  18.                         "Lokið"
  19.                     ]
  20.                 }
  21.             ]
  22.         ],
  23.         "row_count": 100,
  24.         "get_total_count": true
  25.     }
  26. }
This gives the following error code:


  1. {
  2.     "response_status": {
  3.         "status": "failed",
  4.         "messages": [
  5.             {
  6.                 "field": "input_data",
  7.                 "message": "Unable to parse the JSON",
  8.                 "status_code": 4001,
  9.                 "type": "failed"
  10.             }
  11.         ]
  12.     }
  13. }

I have the following version:


































                  New to ADSelfService Plus?