- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2018 10:20 AM
I need to be able to maintain an API key encrypted and apply it to an outbound REST Message.
I thought that it should be easy enough to say the API key as a password in sys_properties the call it from the REST Message header value (x-api-key) as:
javascript:gs.getProperty("api_key");
Realizing that it may require a little decrypting, I first saved the API key as a string. However, the REST Message doesn't appear to be able to pull the value from the property on the fly. Is there another way to do this?
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2018 10:55 AM
If I recall correctly that should just get the value.
You shouldnt need to decrypt it.
I am using a property in the same way but I always go recordless outbound rest.
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setBasicAuth(gs.getProperty('thousandeyes.user'), gs.getProperty('thousandeyes.pass'));
restMessage.setHttpMethod("get");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2018 10:55 AM
If I recall correctly that should just get the value.
You shouldnt need to decrypt it.
I am using a property in the same way but I always go recordless outbound rest.
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setBasicAuth(gs.getProperty('thousandeyes.user'), gs.getProperty('thousandeyes.pass'));
restMessage.setHttpMethod("get");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2018 07:58 AM
Jace,
Thanks for the reply. I was trying to use the Outbound REST form to build my REST message. I was unable to use getProperty on that form to get the api key into the message. At first, I decided to just hardcode the api key onto the form. That worked, of course, but wasn't what I wanted. So I switched to creating a Script Include with RESTMessageV2 and calling getProperty from there. That is a much better, reusable solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2018 12:16 PM
Hello Jace
I'm working to setup an Outbound REST message that will use and API key to talk with Dell TechDirect. I'm new to use API Key authentication and curious to see how you would configure the key within the Authentication type of the message record. I see in your script example where you are setting BasicAuth. Do I need to setup a BasicAuth profile to store the key?
I will look to script the message at a later point, I'm just working to establish connectivity right now.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 08:15 AM
Yea, if you are using some api key, or custom header, can can call that out with setRequestHeader, i'd tell it to use a sys_properties record if thats the case. If you can, it is probably better to use the `setAuthenticationProfile` but thats for basic auth or oauth if I recall correctly.
https://blog.jacebenson.com/restmessagev2/#setauthenticationprofile