Solved

Referencing a content of local file in RSD / avoiding credentials in the portal?

  • 19 April 2024
  • 2 replies
  • 20 views

Hi,

 

I was wondering if it is possible to reference to the content of local file on the ODX server from within a RSD file. Such as Get-Content with Powershell.  


We have some RSD files for some of the api’s call that we are making. We are in the process of including these RSD's in our own source control system in order to keep track of the changes that we do with the RSD files. One of the api's is quite unstable and sometimes needs tweeking in the rsd file. (Source control on the RSD file's / powershell scripts files could be another topic to be honest).

Anyway, we have to include an API key in the script that we would not like to have saved in the source control. Therefore, an option to reference a file in which we can store the API key would be great.  

I know that you can also include authentication in the portal, but we are looking to maybe avoid putting credentials as much as possible in the portal. The portal also creates a OAUTH map if you use OAUTH in the portal. But I don't know how this works together with the RSD, because I can't see any reference within the RSD file. 

In summary: 

  • How can we reference the content of a file in RSD, such as Get-Content in powershell
  • How can we avoid putting credentials in the portal, by replicating the behaviour of automatically generated authentication files from the portal. 
icon

Best answer by spenning 22 April 2024, 16:55

View original

2 replies

Userlevel 6
Badge +5

Hi @spenning 

The value is to be stored not in the setup of the data source or the RSD file itself, but in an entirely different document or location, right?

You can reference data source setup fields in the RSD files by stating _connection.User for example and you can also reference an external file.

There is some info about this here.

https://cdn.cdata.com/help/DWJ/ado/pg_items.htm

Hi @Thomas Lind , 

In the end, I used the include keyword instead CData ADO.NET Provider for REST - api:include.
I made an extra RSD, in a folder that was ingnored by our source control system, and just set the attributes that I needed to be included as a header file in the RSD that would send the API call. I could not really figure out how to use the _connection to reference another external file. 

e.g.

header.rsd
-----------------------------------------------------------
<api:script xmlns:api="http://apiscript.com/ns?v1 xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <api:set attr="Key" value=”api_key_example”/>
<!-- other attributes if needed -->
 </api:script>

api_call.rsd
------------------------------------------------------------

<!-- other code -->

<api:include file="some_other_directory/header.rsd" /> [Key]
<api:set attr="URI" value="[base]?[param1]&amp;[api_key]=[Key]" />

<!-- other code -->

 

Reply