I'm trying to use the API for ServiceDesk Plus.
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:
- {
- "list_info": {
- "fields_required": [
- "group",
- "status"
- ],
- "search_criteria": {
- "condition": "is not",
- "field": "status.name",
- "values": [
- "Lokið"
- ]
- },
- "row_count": 100,
- "get_total_count": true
- }
- }
Example 2. This one also works and provides lots of request results:
- {
- "list_info": {
- "fields_required": [
- "group",
- "status"
- ],
- "search_criteria": {
- "condition": "is",
- "field": "group.name",
- "values": [
- "6 Bakvinnsla"
- ]
- },
- "row_count": 100,
- "get_total_count": true
- }
- }
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:
- {
- "list_info": {
- "fields_required": [
- "group",
- "status"
- ],
- "search_criteria": [
- {
- "field": "group.name",
- "condition": "is",
- "values": [
- "6 Bakvinnsla"
- ]
- },
- {
- "field": "status.name",
- "condition": "is not",
- "values": [
- "Lokið"
- ]
- }
- ],
- "row_count": 100,
- "get_total_count": true
- }
- }
This provides the following error code:
- {
- "response_status": {
- "status_code": 4000,
- "status": "failed",
- "messages": [
- {
- "field": "list_info.search_criteria",
- "status_code": 4001,
- "type": "failed"
- }
- ]
- }
- }
Example 4 also does not work:
- {
- "list_info": {
- "fields_required": [
- "group",
- "status"
- ],
- "search_criteria": [
- {
- "field": "group",
- "condition": "is",
- "value": {
- "id": "11701",
- "name": "6 Bakvinnsla"
- }
- },
- {
- "field": "status",
- "condition": "is not",
- "value": {
- "id": "3",
- "name": "Lokið"
- }
- }
- ],
- "row_count": 100,
- "get_total_count": true
- }
- }
This provides the same as the previous error code:
- {
- "response_status": {
- "status_code": 4000,
- "status": "failed",
- "messages": [
- {
- "field": "list_info.search_criteria",
- "status_code": 4001,
- "type": "failed"
- }
- ]
- }
- }
Example 5 using "Children" field also does not work:
- {
- "list_info": {
- "fields_required": [
- "group",
- "status"
- ],
- "search_criteria": [
- "field": "group.name",
- "condition": "is",
- "values": [
- "6 Bakvinnsla"
- ],
- "children":[
- {
- "field": "status.name",
- "condition": "is not",
- "values": [
- "Lokið"
- ]
- }
- ]
- ],
- "row_count": 100,
- "get_total_count": true
- }
- }
This gives the following error code:
- {
- "response_status": {
- "status": "failed",
- "messages": [
- {
- "field": "input_data",
- "message": "Unable to parse the JSON",
- "status_code": 4001,
- "type": "failed"
- }
- ]
- }
- }
I have the following version: