I am trying to get a Postman API v3 call to provide results from our on-premises v3 API. When I use the following input_data from our instance's API Documentation site (https://{ourURL}/SetUpWizard.do?forwardTo=apidoc) that allows you to test the API, it finds the one request we have in there for testing.
{
"list_info": {
"sort_field": "created_time.value",
"sort_order": "asc",
"get_total_count": true,
"search_fields": {
"subject": "Laptop Checkout",
"status.name": "Open"
}
}
}
When I use the above, I get the following response:
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"list_info": {
"has_more_rows": false,
"sort_field": "created_time.value",
"search_fields": {
"subject": "Laptop Checkout",
"status.name": "Open"
},
"start_index": 1,
"total_count": 1,
"page": 1,
"sort_order": "asc",
"get_total_count": "true",
"row_count": 1
},
"requests": [
{
"requester": {
"email_id": "testuser2@domain.blah",
"phone": null,
"name": "test user2",
"mobile": null,
"profile_pic": {
"content-url": "/images/default-profile-pic2.svg"
},
"is_vipuser": false,
"id": "1801",
"department": {
"site": null,
"name": "Department 1",
"id": "602"
}
},
"template": {
"is_service_template": false,
"service_category": {
"id": "100000003"
},
"name": "Laptop Checkout",
"id": "100000612"
},
"short_description": "",
"created_time": {
"display_value": "Mar 13, 2024 11:12 AM",
"value": "1710349931093"
},
"subject": "Laptop Checkout",
"time_elapsed": null,
"is_overdue": false,
"technician": null,
"priority": null,
"created_by": {
"email_id": "testuser2@domain.blah",
"phone": null,
"name": "test user2",
"mobile": null,
"profile_pic": {
"content-url": "/images/default-profile-pic2.svg"
},
"is_vipuser": false,
"id": "1801",
"department": {
"site": null,
"name": "Department 1",
"id": "602"
}
},
"due_by_time": null,
"response_time_elapsed": null,
"site": null,
"is_service_request": false,
"cancel_requested_is_pending": false,
"cancel_requested": false,
"id": "100000001",
"status": {
"color": "#0066ff",
"name": "Open",
"id": "100000002"
},
"group": null
}
]
}
In my Postman workspace, I have set up an environment to store in variables my base API URL (https://{ourURL}/api/v3) as {{ApiUrl}}, the Technician Key (aka authtoken) in a variable {{AuthToken}}, and my input_key json (formatted as above) as {{OpenLaptopCheckoutInputDataJson}}. and url-encoded as {{OpenLaptopCheckoutInputDataJsonEncoded}}.
The encoded input_data is:
%7B%20%22list_info%22%3A%20%7B%20%22sort_field%22%3A%20%22created_time.value%22%2C%20%22sort_order%22%3A%20%22asc%22%2C%20%22get_total_count%22%3A%20true%2C%20%22search_fields%22%3A%20%7B%20%22subject%22%3A%20%22Laptop%20Checkout%22%2C%20%22status.name%22%3A%20%22Open%22%20%7D%20%7D%20%7D
When I create a new request in Postman to query the Requests v3 API, I create a GET request with the following URL:
{{ApiUrl}}/requests
which is sent as https://{ourURL}/api/v3/requests
I have added the authtoken to the header as prescribed and I get a successful authentication, and likewise used the TECHNICIAN_KEY parameter as well with the same success, so that's nice...
I have tried adding the input_data using several methods including:
1) as a parameter (encoded or not) - only encoded seems to work, and
2) using the body (url encoded and unencoded) as form-data or as x-www-form-urlencoded using input_data as the key and either {{OpenLaptopCheckoutInputDataJson}} or {{OpenLaptopCheckoutInputDataJsonEncoded}} as the value.
The only version of input_data that seems to work is the encoded parameter passed in the URL, which results in the following response (which returns no results):
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"list_info": {
"has_more_rows": false,
"sort_field": "created_time.value",
"search_fields": {
"subject": "Laptop Checkout",
"status.name": "Open"
},
"start_index": 1,
"total_count": 0,
"page": 1,
"sort_order": "asc",
"get_total_count": "true",
"row_count": 0
},
"requests": []
}
All other varieties attempted using the body yield the following response regardless of encoding:
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"list_info": {
"has_more_rows": false,
"start_index": 1,
"row_count": 0
},
"requests": []
}
I have two problems:
1) Postman is not getting the result that would be retrieved when the same technician is logged in and uses the API Documentation test site.
2) The input_data does not propagate using any methods when used in the request body (though the documentation indicates it should).
I have looked at the logs in ManageEngine\ServiceDesk\logs\serverout0.txt and do not see anything useful.
Here's a snippet of the log after making a request that successfully sends the encoded input_data:
[10:40:04:123]|[03-21-2024]|[com.manageengine.servicedesk.filter]|[INFO]|[515]: RequestURI ::: /api/v3/requests, method ::: GET , action rule path ::: /api/v3/requests , actionParamName ::: null; , actionParamValue ::: null|
[10:40:04:123]|[03-21-2024]|[com.adventnet.iam.security.JSONTemplateRule]|[WARNING]|[515]: Extra key found in json : [subject, status.name] for the URI : /api/v3/requests|
[10:40:04:123]|[03-21-2024]|[com.adventnet.servicedesk.filter.EncodingFilter]|[INFO]|[515]: EncodingFilter called |
[10:40:04:123]|[03-21-2024]|[com.manageengine.sdpod.v3api.handlerimpl.WorkOrderHandler]|[INFO]|[515]: Checking authorization of user : 2402 for woID : null|
[10:40:04:139]|[03-21-2024]|[com.manageengine.servicedesk.sdpapi.v2.servlet.SDPAPIV2Servlet]|[INFO]|[515]: time taken:{init=0, after writing response=16, getting handler=0, getting response obj=16, start=1711039204123, got entityObj=0}|
[10:40:07:236]|[03-21-2024]|[com.manageengine.mdh.MDHFilter]|[INFO]|[516]: PORTALID : 1|
[10:40:07:236]|[03-21-2024]|[com.adventnet.servicedesk.util.RememberMeUtil]|[INFO]|[516]: inside of ---> getCookieValue from RememberMeUtil, cookieName : sdplogincsrfcookie;|
[10:40:07:236]|[03-21-2024]|[com.manageengine.servicedesk.filter]|[INFO]|[516]: ****************** Inside of SdpSecurityFilter class ******************|
[10:40:07:236]|[03-21-2024]|[com.manageengine.servicedesk.filter]|[INFO]|[516]: RequestURI ::: /getNotifications, method ::: GET , action rule path ::: /getNotifications , actionParamName ::: null; , actionParamValue ::: null|
I have also tried deleting the cookies in Postman or not, but this does not seem to help or hinder.
Our build is: 14.6 Build 14620
What am I missing to get the same response from our v3 API as we get when logged in as the technician on the API Documentation testing site?