how to run cURL script from the Servicenow

hemanth40
Tera Contributor

I want to run the Crul code from the servicenow, please help me how to do it 

How to trigger cURL API details from Business Rule or any other server-side script

EX : This is the sample API

curl "https://dev12234553.service-now.com/api/now/table/incident"\
--request POST\
--header "Accept:application/json"\
--header "Content-Type:application/json"\
--data "{\"active\":\"true\",\"company\":\"88u8u8u8u8\"}"\
--user 'admin': 'admin123'

4 REPLIES 4

J Siva
Tera Sage

Hi @hemanth40 

This curl code is used to access/create records in the ServiceNow instance by the 3rd party applications which supports Curl.

May I know what you are trying to achieve?

Regards,

Siva

hemanth40
Tera Contributor

i want to get the OKTA access/refresh token for the integration 

curl --location --request POST 'https://{yourOktaDomain}/oauth2/v1/token' \-H 'Accept: application/json' \-H 'Authorization: Basic {Base64({clientId}:{clientSecret})}' \-H 'Content-Type: application/x-www-form-urlencoded' \-d 'grant_type=password' \-d 'redirect_uri={redirectUri}' \-d 'username=example@mailinator.com' \-d 'password=a.gReAt.pasSword' \-d 'scope=openid offline_access' Copied!

@hemanth40 you have to use REST API.

You can't run curl cmdlets in servicenow 

Chaitanya ILCR
Kilo Patron

Hi @hemanth40 ,

 

you have to convert that curl into the ServiceNow script 

 

you can refer Below Docs

 

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...

 

https://www.youtube.com/watch?v=rZihmf0y7wU

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya