Hey Peter,
Thank you for your question!
I hope that the answers below will nudge you in the right direction.
1. Setting a SAS token
Let’s take this example of an Azure blob storage URL with a SAS token:
https://storageaccountname.blob.core.windows.net/sascontainer/sasblob.txt?sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=koLniLcK0tMLuMfYeuSQwB%2BBLnWibhPqnrINxaIRbvU%3D
As you probably already know, you can use path variables to extend the base URL of your call.
I understand that setting all query parameters (sv, st, se …) of the SAS token via the “parameters” list can be tedious, especially for testing/debugging.
Therefore, I recommend attaching the SAS token to the URL just before the call is being executed by using call template processes.
-
Make sure that a process action definition called “Add/Edit record” exists in your application under all settings > process action definitions. It should look like this.
-
Add a call template process to your call template. Choose these settings
-
Set the call template process parameter with the description “record” to the “expression” “this”.
-
Set the call template process parameter with the description “values” to the “expression” something like this:
[< “url”, url:load( this.url.tostring().concat(“?SASToken”) ) >]
Beware that you use the correct double quotes when you copy and paste the expression above. The expression should look like this when formatted:
- Now execute a test call with the test panel without defining any parameters for the SAS token. The call will have the SAS token attached
Feel free to experiment with step 4 to make your token more dynamic. I defined it as a simple string, but you can split it up in and set the dynamic parts of the token with a more advanced Novulo expression.
Also, instead of simply editing the URL of the current call with an add/edit process action definition, you can also define your own custom process. Something like “N_Call - Set SAS token”. It would take the current call as an input and then execute your custom steps to come up with the right token and finally attach it to the URL.
2. Extract a file from the XML/JSON body of a response
I would also recommend using a call template process. First, build a custom process to extract a file from an N_Response record, like explained below. Then, set that process as a call template process with the trigger “After processing”.
With each call, your custom process will then be executed to generate a file which you can save where you want.
Building the custom process
- Add a new process to a (new?) component called “N_Response - Convert azure blob body into file” or something similar. It should take at least a “N_Response” record as an input.
- Within that process, you will probably have to use several plugin actions to convert the raw body string (JSON/XML) of the trigger.response into a “Novulo datatype object”. The serialization plugin can help you with that.
- Once you have converted it, you can extract the node that contains the actual file string. Use the TupleExtLookup action of the tuple extensions plugin to choose the right node/tuple.
- Then you can convert the file-string into an actual file of any type by using the “FileFromStringAction” of the File Extensions plug-in. If the string is base64 encoded, you can also use “FileFromBase64Action”.
- Now you have a file, and you can do whatever you want with it. Link it to the trigger.response record, save it to a special folder, or set it as a product media.
Hint: Take a look at M7899 and the process “N_Response - Execute sequential JSON import”. Here, you can see examples of the plugin actions that I mentioned earlier. Hopefully this will help you with selecting and setting the right plugin actions.
Let me know if you have any further questions or if I missed something.
Regards
Joachim