ServiceNow Rest API Integration

Howdy folks!

I am looking into getting some automation going via ServiceNow ( our ticketing system) for template creation and potentially some additional functions in the future. Unfortunately, ServiceNow requires it's REST calls to be more or less written out like cURL commands and I'm not quite sure how my authetication setup should be structured; would anyone mind sharing a working cURL setup for autheticating against OAuth 2.0 setup? I'm a little confused as to what url the request(s) should go and if there needs to be a JSON payload associated with it.

Thanks!

Kyler Copsey

Dallas College Systems Administrator (LMS)

P.S.

If anyone is a former Blackboard client and recognizes me and my insanity for REST development tools for in bulk processing, I plan to do the same for Brightspace :)

Answers

  • Ian.P.710
    Ian.P.710 Posts: 25

    Hi Kyler
    Might I suggest using the Refresh Token headless approach if I use Postman and use the get new refresh token api route the in cURL it looks like this.
    curl --location 'https://auth.brightspace.com/core/connect/token' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'grant_type=refresh_token' \--data-urlencode 'client_id=**************************' \
    --data-urlencode 'client_secret=********************' \--data-urlencode 'refresh_token=content.refresh_token'

    This should keep you connected as long as you access within 30 days from the last access using the refresh token flow.
    Any way hope this helps.

  • Kyler.C.608
    Kyler.C.608 Posts: 7 🔍

    Thanks Ian!

    I'm still a POSTMAN novice; how were you able to snag the curl out of there?

    Kyler

  • Ian.P.710
    Ian.P.710 Posts: 25

    Hi Kyler
    In Postman on the righthand side when you are in the api route view you will see some menu items one of which is the </> if you click that it will show you the command in various programming languages of which cURL is one.