The CreatorCon Call for Content is officially open! Get started here.

REST Message Problem

Ken83
Mega Guru

Hello Community,

        My goal with this REST message is to retrieve some information from another system that resides on my local domain. We do not have any domain separation or anything like that configured on our SN instance. I just need SN to reach out via REST to System B and retrieve some information. Sounds simple enough but the problem I am having is a 401 error. Like this...

find_real_file.png

Now, to me this seems like a very straightforward problem. I'm not successfully authenticating somewhere. My question is...WHERE??? I have removed the requirement for Basic Authentication so AFAIK, there aren't any credentials being passed in the message. To get to this point, I did route the message through a MID Server I have setup on my instance. I am aware that the MID Server requires credentials to do whatever it does. In light of this, I even replaced the MID Server credentials with my credentials because I know I have access to System B. I have logged into System B successfully multiple times.

The other trickery here is that while I am getting this 401 error message when using a REST message in SN, if I copy the endpoint and paste it directly into my browser, it shows me the information I am expecting to see...See below..

find_real_file.png

So my question is, how can I track down this authentication problem? When I try this from SN, I get the 401 error. When I paste the endpoint directly to the browser, I get the success message above.

1 ACCEPTED SOLUTION

venkatiyer1
Giga Guru

Hi ken,



In your endpoint you can remove ?apikey=${apikey} and just have till servicegroups. Since you are already passing that message function parameter. Rest of the configuration looks good to me. Also, in the endpoint i..e servicegroups, what kind of content type is being served. Is it html or json? You might want to check the endpoint to see if it html. If so you might have to add that as accept type rather than json.  


View solution in original post

10 REPLIES 10

Hi ken,



You will need a basic auth with the same user name password combo apart from Authorization header having the value. Also ensure, inside the method that you are using that you have basic auth and authorization though it should pick up The way to test outside of ServiceNow is to use Postman plugin of browser.


I currently have the GET method configured to use Basic Auth alongside the Authorization header. Both are using the same credentials which I have verified will grant me access to System B. I'm still getting the 401 error.


venkatiyer1
Giga Guru

Hi ken,



Can you add a screenshot of the get message please?



Thanks


Sure enough, here is a screenshot of the GET method...



find_real_file.png


venkatiyer1
Giga Guru

Hi ken,



In your endpoint you can remove ?apikey=${apikey} and just have till servicegroups. Since you are already passing that message function parameter. Rest of the configuration looks good to me. Also, in the endpoint i..e servicegroups, what kind of content type is being served. Is it html or json? You might want to check the endpoint to see if it html. If so you might have to add that as accept type rather than json.