REST API with MidServer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2018 07:32 AM
Hi All;
Thanks in advance !!!
I need to connect the Rest API which is in my office Intranet. But when I tried to test connection (Post method) from ServiceNow to that API it gives error "java.net.ConnectException: Connection refused (Connection refused) when posting to".
As per me, as the API is in intranet and ServiceNow is in cloud, so ServiceNow is not able to access that API. I think this need to achieve by Mid Server. But I am not sure how to configure this.
Can anyone please help me on this.
Thanks
Balaji Prusty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2018 07:37 AM
Dear Balaji,
Please refer to below documentation to install the midserver
Midserver should be installed on a machine which is within the intranet.
Once you install midserver you need to use that in REST API configuration (HTTP Method), as you can see from below screenshot.
Happy to help if you have further questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2018 08:52 AM
Thanks Anil;
Let me configure accordingly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2018 12:05 PM
If you're doing the rest call from a script, you can also use the `setMIDServer` method.
e.g.
//snip setup of restMessage
var midServer = 'string name of MID server'; //not sys_id
restMessage.setMIDServer(midServer);
//snip execute and handling
Hope this can help.
Jarod
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2019 02:23 PM
Hi,
I am facing the same issue, can someone please guide me:
The request failed: java.net.ConnectException: Connection refused: connect when posting to http://127.0.0.1:3000/add/5/5
Thanks & Regards,
Suhas Nayak