Manny Formation Lap

Hello,

We have ManageEngine Service Desk Plus v 9.0 Build 9030.

Does it support jsonp calls?

(Similar to this thread for ServiceCenter: https://forums.manageengine.com/topic/using-api-from-another-domain)

I would like to query it via REST API from another domain. What is the best approach?

Thanks in advance.





Replies (14)

Manny, 

Here we do not have JSONP support. However you can try using the "GET" method instead of "POST" and see whether you can get response on another domain ?
 
Jai Anand K
SDP Support - FAQ
ServiceDesk Plus - Help Desk Software of your Choice
Manny Formation Lap

Thank you for the response.

For everyone's reference, the suggestion of using GET doesn't work either.


Manny, 

May we know which module in our APIs you are trying to use ? Is it possible to copy us the code snippet which you use?

Jai Anand K
SDP Support - FAQ
ServiceDesk Plus - Help Desk Software of your Choice
Manny Formation Lap

I'm trying to access the REQUESTS module.

Here is the code:


var view = '1234_MyView';
var technicianKey = '12345678-ABCD-EFGH-HIJK-910111213141';

  $.ajax({
      url: 'https://servicedeskURL/sdpapi/request?OPERATION_NAME=GET_REQUESTS&TECHNICIAN_KEY=' +
        technicianKey +
        '&INPUT_DATA={ "operation" : { "details":{ "from":"0", "limit":"0", "filterby":"'+
        view +'" }}}&format=json',
      type: "POST",
      complete: function(data) {
       // do stuff
      }
  });
}

Jai Anand Krishnamoorthy Technical Manager - SDP
Manny, 

My sincere apologies for the delay to respond you on this. I just realized that GET will not work either on this case. I have posted this as an enhancement request to my development team, they shall analyze. 

Jai Anand K
ServiceDesk Plus
Jai Anand Krishnamoorthy Technical Manager - SDP
Manny, 

We have included JSONP support for APIs on our features list. Here's the featureID to track the availability. SDF-59831.

Jai Anand K
ServiceDesk Plus
Chris Farrell Formation Lap
Hello 

When will feature SDF-59831 be released? Or if it has already been released what build is it in?

Thank you

Chris,

We are yet to start working on this feature. We will let you know once JSONP is included in our API.

Thanks & Regards,
Priya Kumar

SDP Support - FAQ
ServiceDesk Plus - Help Desk Software of your Choice
Chris Farrell Formation Lap
Hello

As JSONP is not included in the API yet, is it possible to add an access-control-allow-origin header in Service Desk Plus, to allow cross domain requests?

Thank you
Chris
Chris,

We would like to hear the real use case of having access-control-allow-origin header in Service Desk Plus. This will help us to analyze this feature.

Thanks and Regards,
Priya Kumar

SDP Support - FAQ
ServiceDesk Plus - Help Desk Software of your Choice
Chris Farrell Formation Lap
Hi Priya

For an application/website to make an AJAX request on the Service Desk API, currently both the application/website and SDP must be running on the same domain (origin) for this to work - otherwise the request will fail because it violates same-origin policy (https://en.wikipedia.org/wiki/Same-origin_policy).

But in the real world it is not always possible, or desirable, to have both running on the same domain. For example I might have SDP running on http://sdp and try to access it from a staff portal on http://portal

Chris,

      You can add this "Access-Control-Allow-Origin" response header in web.xml to access the data from across domains.

   The web.xml is available under <SDP Home>\server\default\conf directory.

   Open the web.xml and add the response header like below.

   <filter>
      <filter-name>CommonHeadersFilter</filter-name>
      <filter-class>org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>
      <init-param>
         <param-name>
Access-Control-Allow-Origin</param-name>
         <param-value>
http://siteb.com
</param-value>
      </init-param>     

   </filter>

   You need to restart the SDP application to take affect the changes in web.xml

--Murugesh
jahapv Formation Lap
Hi Murugesh,

Thanks for the info.
is it possible to use a wildcard on the <param-value>? something like "http://*.domain.com" 
Or can we use an "*" or "ANY" to allow requests from any domain?

thanks.
Hi jahapv,

      As of now we cannot use wildcard to specify multiple domains but we have workaround for this issue so kindly send us your contact details with the reference of this post.

--Murugesh