Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

REST message and API Key credential

PhoenixMing0912
Giga Expert

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.

4 REPLIES 4

Jace Benson
Mega Sage

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

 

I saw a method "setAuthenticationProfile", but the sample is basic or oauth2, do you have a sample or document for API Key authentication?

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.

Surendra Raika1
Kilo Guru

Have you followed the Integration Hub Tutorial:

https://developer.servicenow.com/app.do#!/training/article/app_store_learnv2_rest_madrid_rest_in_int...

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