Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Passing connection options for API authorization

Hi,

I'm having trouble with passing a environment variable into an API component as a connection option. In the connection options I am using parameter and value pair as:

profilesettings: token=$(taboolaToken)

In a previous script python script component, I have prepared the environment variable and printed it to ensure its format looks good:

cursor = context.cursor()
cursor.execute('select access_token from taboola_auth_token')
token = cursor.fetchone()[0]
complete_token = 'Bearer '+ token
context.updateVariable('taboolaToken', str(complete_token))
print(taboolaToken)

Output:
Bearer abcTokenEtc

I thought that the environment variable $(taboolaToken) would be available in the RSD as:

_connnection.token

i.e.

<rsb:set attr="Header:Name#" value="Authorization" />
<rsb:set attr="Header:Value#" value="_connection.token"/>

However, I think the value is never passed as my API gets no results.

Any pointers would be gladly welcomed.

Thanks,

Greg.


5 Community Answers

Matillion Agent  

Laura Malins —

Hi Greg

You’re referencing your variable incorrectly in the Connection Options. It should be ${taboolaToken}

You should also pass the connection option using the below syntax:

<rsb:set attr="Header:Name#" value="Authorization" /> <rsb:set attr="Header:Value#" value="[_connection.token]"/>

Thanks
Laura


Greg Roper —

Hi,

So the parameter name is:

profilesettings

and the value is simply:

$(taboolaToken)

How would I reference it in the RDS?

[_connection.???]

Many thanks,

Greg.


Matillion Agent  

Kalyan Arangam —

Hi Greg,

RSD does not have access to matillion variables so you are required to pass the necessary values using the ProfileSettings connection-option.

Connection Option – profilesettings
Value – taboolatoken=$(taboolaToken)

In the RSD, you may reference it using [_connection.taboolatoken]

Please note that you may also use Other instead of profilesettings for the same. Other should be available in the drop-down. We have made changes to the documentation (late last week) in this regard. Please see the following link for updated example and relevant screenshots.

https://redshiftsupport.matillion.com/customer/en/portal/articles/2763313-using-parameters-with-api-profiles?b_id=8915#header2

Hope that helps.

Best
Kalyan


Greg Roper —

OK. Sorry didn't see the curly braces ${taboolaToken}.
Thanks.


Matillion Agent  

Kalyan Arangam —

Hi Greg,

I managed to make the same mistake :)

Looks like you got it working. I will close this ticket for now.

Best
Kalyan

Post Your Community Answer

To add an answer please login