Using site properties as REST Authentication

So we're using an API which has the usual APIKey and APISecret, and we needed to update this information from time to time so we created a simple configuration page and store these values in Site properties. 

The REST methods require these values of course but when you set up to consume a REST API, you have the Basic authentication fields which we populated manually. The fields Username and Password do not accept variables.

Is there any way to configure it so it goes to read the site properties where this information is stored?


You can create 'Getters' for you Site Properties. That is, create a public action (set as a function if you wish) in the module you stored your Site Properties that the only thing it does is output the value of your site property.

Then, in the module where you use your REST service, simply reference that action to get the value of the Site Property you want.


João Mateus

Hi Mariano,

You have two options to do that:

1) In Service Center, you have in the Integration Tab, access to your COnsumed REST APIS. There is possible to input a net Effective URL and also Effective Username and Password, just like the site properties variables works.

2) Other options is use the Authorization header for your calls, like this post suggest

Best Regards

Fabio Fantato

Thanks for your answers,

João, unfortunately I'm not quite following you. The Basic auth fields username and password will not take anything other than hard text as inputs, so no actions can be referenced.


1) You're suggesting using this configuration page in the ServiceCenter instead of going through the config page we built in the eSpace, correct? 

This probably works fine, although it's not very user friendly, could be a solution

2) This also seems like a solution, but if I understood correctly, I'd have to add these headers to every single consumed REST method?

You can use he OnBeforeRequest (it will be apply to all your consumed method). 

In this method you can change your request, adding into header the authorization parameter dinamically.


Okay, so this works. For anyone interested, added an OnBeforeRequest action as suggested, then added an Assign action with two assignments: 


= "Authorization"



= "Basic " + BinaryToBase64(TextToBinaryData(Site.APIKey + ":" + Site.APISecret))

Needs the BinaryData dependency.

Thank you both!