how to run cURL script from the Servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 06:50 AM
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 07:28 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 09:09 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 09:19 AM
@hemanth40 you have to use REST API.
You can't run curl cmdlets in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 09:21 AM
Hi @hemanth40 ,
you have to convert that curl into the ServiceNow script
you can refer Below Docs
https://www.youtube.com/watch?v=rZihmf0y7wU
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya