1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
319 views
by favio-m-6030 (260 points)

I'm looking at rotating credentials for a Web Service Connection to be used by Qvera and I was hoping to automate said process. I was looking to store it in an external app store and simply consume it from Qvera via an HTTP GET request.

I'm assuming I can use a System Variable, link it to an External Source, and send requests to the configuration endpoint, using those variables in the Web Service Connection with the standard syntax {v:api-user} (let's assume the endpoint is in an internal network, and thus, doesn't required additional security or headers sent from Qvera, which doesn't look possible).

However, while I can configure a Url and perform a GET, I'm not seeing any option to, for example, pick a specific field in a JSON response.

- Is there a way to have greater control and flexibility when consuming external sources? I don't want a String variable to be populated with a full JSON when I'm aiming to simply get a user or password, especially when I aim to use it in the configuration of a Web Service Connection.


I've also seen that I have an undocumented Credentials type of System Variable but that doesn't appear to allow for external sources.

- What is the best practice to utilize said functionality?

- How can I invoke the user and password when using them in a Web Service connection? I know I can use the user and password manually set in the Web Service Connection with {ws-user:self} and {ws-pass:self}. Is there a similar usage for the system variable, such as {v:api-credentials:user} and {:api-credentials:pass} or something like that? 

Thanks!

1 Answer

0 votes

You are correct that when linking a System Variable to an external source, QIE will use the entire response as the variable contents.  In order for QIE to use just a part of a response, you would need to update that variable from either a Mapping Node in your channel, or a Scheduled Script that runs periodically.

One option that may work for you is to call your app store API from a Scheduled Script where you can have some code to pull the specific items out of the response and store just those items.  Scheduled Scripts are accessed by clicking on the Source node of your channel, and then the Scheduled Scripts tab.

The Credentials type System Variable is read-only, as you found, and cannot be updated either from an external source, or from a channel/scheduled script.  You can use a String type System Variable, but be aware that your credentials will be stored in plain text.

Perhaps a better option is to use a Script Variable (click on the Source node in your channel, then go to the Script Variable tab).  Script Variables can be set to a scope setting of Channel, meaning they persist even when no messages are traversing the channel.  You would set the Script Variable within a Scheduled Script, and you would have two Script Variables (one for the user ID, one for the password).  You cannot view the Script Variables within the GUI, which offers a bit more security than a String type System Variable.

To access a Script Variable within your channel, you simply use it like a locally defined variable.  Whereas with a locally defined variable you need to initialize it within the mapping node (i.e. var localVariable;), Script Variables are already defined, and since you're populating them with a Scheduled Script, you simply would use them in your code as a normal variable.

Feel free to contact us at support@qvera.com if you have any questions or need help using a Script Variable, or anything else pertaining to QIE.

by jon-t-7005 (8.2k points)
...