REST message and API Key credential
This content was last updated in 2019. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2019 08:19 PM
Hi experts,
In REST message, I can choose basic auth and OAuth as credential way.
In IntegrationHub, there are many other credentials like API Key credential.
I am just wonder if I can use API Key credential in REST message, if I cannot use it on UI, using in script is also accepted.
Please note, using "credential API Key" in IntegrationHub is a must because in that way API Key won't be seen by others.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2019 08:47 PM
What is your question?
You can use many ways to pass authentication details.
Scripted way: https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=r_RMV2-setAuthenticationProfile_S_S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2019 10:56 PM
I saw a method "setAuthenticationProfile", but the sample is basic or oauth2, do you have a sample or document for API Key authentication?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2019 08:55 AM
I'm not sure I follow entirely. But it sounds like you need to pass may a get parameter, or a custom header that has the auth details.
In this case you are kind of in a bind. from what it looks like you will have to show the auth details. You can however store this crediental in a sys_property type of password and it wont be readable by anyone looking at the code.
`gs.getProperty('my.password.property')` will return the unencrpyted value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2019 09:14 AM
Have you followed the Integration Hub Tutorial:
Yes you may use API Key too ... and yes you may store as Jace is suggesting for re-usability ..
Its just one way of doing it ... maybe you can use OAuth if possible