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

Trying to run a script, authentication problems

hafka
Kilo Explorer

I'm trying script: http://wiki.servicenow.com/index.php?title=Importing_Data_Using_Import_Sets#Perl_Example

Command I run:

uploadafile.pl --url="https://demo00.service-now.com/sys_import.do?sysparm_import_set_tablename=test_import&sysparm_transf..." --uploadfile=c:/data/test_users.csv


However, everytime I try to run this script against demo environment I get error:


Authentication required!

This server could not verify that you are authorized to access the URL "/sys_import.do". You either supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required. In case you are allowed to request the document, please check your user-id and password and try again.


Is this the correct way to supply credentials:
# setup basic authentication credentials
$ua->credentials(
'demo00.service-now.com:443',
'ServiceNow',
'admin' => 'admin'
);

I have verified that username is admin and password is admin.


BR,

M

7 REPLIES 7

john_andersen
Tera Guru

I just tried this on Demo09 and it got the same error as you until I changed the realm from "ServiceNow" to "Service-now". See if that works for you.

So, instead of:



# setup basic authentication credentials
$ua->credentials(
'demo09.service-now.com:443',
'ServiceNow',
'admin' => 'admin'
);


use this:



# setup basic authentication credentials
$ua->credentials(
'demo09.service-now.com:443',
'Service-now',
'admin' => 'admin'
);


Hopefully that works for you like it did for me.


hafka
Kilo Explorer

Thanks,

I do not receive the error anymore, I get an "OK" as response. Still I cannot see the changes in the users in the demo environment, but I'll continue troubleshooting tomorrow.

BR,


hafka
Kilo Explorer

I had to go to Transform maps and set coalesce field for my transfer map. After that everything has worked perfectly. Thanks again john.andersen for solving this.


hafka
Kilo Explorer

Everything works ok in demo environment, but when I try the same script in our test environment I get this error:



500 Can't connect to xxxxxxx.service-now.com:443
Content-Type: text/plain
Client-Date: Mon, 15 Oct 2012 07:53:17 GMT
Client-Warning: Internal response

Can't connect to xxxxxxx.service-now.com:443

LWP::Protocol::https::Socket: SSL connect attempt failed with unknown error erro
r:00000000:lib(0):func(0):reason(0) at C:/Perl64/lib/LWP/Protocol/http.pm line 5
1.



Shoud I check some settings in our test instace?