How to create API key and Authentication header
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2022 08:23 AM
I would like to leverage Rest API for integration with Service Now. And we want to leverage API key for access, so I have 2 questions:
1) how should the API key be created for ServiceNow?
2) If use the API key to access, what should the Authentication header like?
Thanks for your response!
- Labels:
-
Integrations
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2022 08:33 AM
It depends on how the API is set up. Is it a bearer token? Basic authentication? Some other header?
Basic Auth and Oauth2.0 can be done using the Authentication type on the Outbound REST Message.
If it's a header that you need to send, you can either add a header under the HTTP Request tab on the main REST message or you can add it on each individual method.
If the token needs to be in the JSON that you send, you would do it on the individual HTTP Method under the HTTP Request tab.
Typically I put tokens in the system properties table and reference them from there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2022 09:22 AM
The API for usage is '/now/table/{tableName}', I have tried to connect with HTTP request header as "Authorization:Basic XXX" and it worked, and want to try to integrate with API key or other more secure method.
But I can not find any guide where to create the API key, and what the HTTP request header should be set, it should not be "Basic" I think.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2022 09:30 AM
Oh. It looks like you can use OAuth 2.0. https://community.servicenow.com/community?id=community_blog&sys_id=56086e4fdb9014146064eeb5ca961957
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 08:09 PM
Thanks a lot for your reponse. The OAuth 2.0 solution seems better than the Basic Authentication.
I still want to check if serviceNow supports Auth with API key? If yes, is there instruction how to create the API key and use the API key for Authentication in for API request? Thanks