How to pass Credentials in JSON format in REST Message?

John116
Kilo Explorer

I am trying to call Automation anywhere RPA tool from service now via Rest API. Credentials needs to be passed in JSON format. How to pass credentials in JSON format in REST Message?

4 REPLIES 4

asifnoor
Kilo Patron

Hi John,

If you are trying to connect to ServiceNow, then the credentials have to be passed as a parameter.

Here is the sample cal of curl

curl "https://instance.service-now.com/api/now/table/incident" \
--request POST \
--header "Accept:application/json"\
--header "Content-Type:application/json" \
--data "{'short_description':'Unable to connect to office wifi','assignment_group':'287ebd7da9fe198100f92cc8d1d2154e','urgency':'2','impact':'2'}" \
--user 'username':'password'

If you are connecting to an external application, then you need to ask them for a sample json request.

Mark the comment as correct answer if this answers your question.

Michael Lee1
Tera Expert

Have you tried setting up an Outbound REST message using basic authentication (user/pass) and then calling that message from your script? 

 

 

John116
Kilo Explorer

Hi,

 

This is my Outbound Rest Message. With Basic Authentication i won't be able to pass in JSON format so i have given credentials in Content field of HTTP parameter. In the result im getting error 404.

 

find_real_file.png

Result:

find_real_file.png

Jonah Piascik
Tera Expert

Were you ever able to resolve this?  I have a similar requirement.