- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2020 08:41 AM
Hello all,
I have the following REST API call inside my script include.
However, instead of this call, I want to configure a call to the third system through a MID server.
At first I created a new MID Server on my instance with all the needed information (name "myMID")
How can I use this MID server inside my code?
My code is the following:
var r=new sn_ws.RESTMessageV2();
//endpoint
r.setEndpoint("aURL"); //set a url endpoint (third system's endpoint)
r.setHttpMethod("post"); //HTTP method
//set the queryParameters (the first parameter is the name of the parameter that the third system is waiting for)
r.setQueryParameter("id",id); //id is passed from catalog client script
r.setQueryParameter("t",t); //t is passed from catalog client script
var response=r.execute(); //send the REST API call
var responseBody=response.getBody(); //receive back the response
var answer=JSON.parse(responseBody);
...
How can send this call from the MID server??
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 02:37 AM
Hi,
Points below
You are not able to connect to that API from Postman since it is in client's network
1) I configured the MID server on my instance and I put it in the http request tab of an outgoing message. Do I need to make anything else?
- The MID Server should be in client's internal network and you should check by hitting the endpoint of API when you login to MID Server to confirm if mid server can reach. If not get client's network team involved and allow MID Server machine's IP address to be reaching to that client API
2) I guess I need somehow to install the mid server on the client's network? Am I right?
- Yes
3) To make the call, I just need to use the outbound message that uses the mid server?
- Yes; ensure you first test the endpoint from mid server
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2020 08:54 AM
Hi,
On your rest method, select your MID Server on the HTTP Request tab
refer below links for help
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 02:03 AM
Hey
I would like to ask you based on your knowledge and experience, when should you recommend the usage of a MID server?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 02:10 AM
Hi,
mid server is usually used when some API you cannot access directly from ServiceNow.
The API is in client's internal network and since Mid Server is in client's internal network it can access this API
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 02:23 AM
Hey Ankur :),
thanks for the quick reply.
My case is the following:
I have the SN instance that I want to make a post call to a third system that is inside the client's network.
If I make the post call with postman, I do not receive neither a http status code nor a response. I guess it is because I can not make a direct call to the third system.
That's why I think that I need to use a MID server. So, I would like to ask you the following based on your experience.
1) I configured the MID server on my instance and I put it in the http request tab of an outgoing message. Do I need to make anything else?
2) I guess I need somehow to install the mid server on the client's network? Am I right?
3) To make the call, I just need to use the outbound message that uses the mid server?
Thank you in advance for your time and patience to help me on this.