We have an integration called RestData. This integration supports a UI being presented where the user can choose what data should be inserted.
In the example below, we have a complicated configuration, with both a configuration of the prompt and a secondary fetching, one for the prompt and another based on what the choice the user has made in the prompt. Note that configuring prompt is optional for this integration, and should only be there when needed.
<cmd case="SkabelonDesign.RestData:FetchAndInsertData"
resourceBaseUrl="https://xxx.xx.net/123/templafy/"
PromptRelativeUrl="contacts/policy/{Policenummer}"
PromptDataJmes="policyContactIVOsList.contacts[*].{NameAndRole: join(' - ', values(@)[?type(@) == 'string']), contactid:contactid }"
PromptLabelProperty="NameAndRole"
RequestRelativeUrl="address/contact/{contactid}"
PromptWindowTitle="Vælg modtager"
PromptWindowSelectItemMessage="Vælg modtageren af brevet fra listen nedenfor"
PromptWindowWidth="400"
PromptWindowHeight="300"
requestType="GET"
prefix="prefix"
auth="Basic"
BasicAuthUserName="UserName" BasicAuthPassword="123123abc"
/>
Parameters
resourceBaseUrl
This defines the start of the URL where the json database is located. This URL is provided by the client or the one administrating the database. Note that this is only the first part of the URL you query. The other part is the
PromptRelativeUrl
and RequestRelativeUrl
. PromptRelativeUrl
This is the other end of the URL when prompting the user. The URL is to specify from where the query should by directed. Selecting what data should be displayed in the prompt, is specified in
PromptLabelProperty
which will be explained further down in the articlePromptDataJmes
This parameter is for filtering the data received from the query. Here we can define new data for DocumentData to get data from. In the example above, we have written the following:
"policyContactIVOsList.contacts[*].{NameAndRole: join(' - ', values(@)[?type(@) == 'string']), contactid:contactid }"
Here we define a variable named "NameAndRole" with
NameAndRole: join(' - ', values(@)[?type(@) == 'string'])
where we join all the values that are strings into the new variable "NameAndRole", seperated by -
. We also define contactid
to have the same value as the data named contactid
in the JSON. To learn more on how to make your own JmesPath strings, see https://jmespath.org/
PromptLabelProperty
This parameter defines what output should be shown in the prompt to the user. As explained above, we defined what data should be in
NameAndRole
. When this variable is inserted in this parameter, the user will be presented with the data specified here. RequestRelativeUrl
This defines the end of the URL. Note, that in the example above,
contactid
as we defined in our JmesPath string. This will divert us to the final URL where the data from this query, will be fetched and used in DocumentData. PromptWindowTitle="Vælg modtager"
PromptWindowSelectItemMessage="Vælg modtageren af brevet fra listen nedenfor"
PromptWindowWidth="400"
PromptWindowHeight="300"
These four parameters is for customizing the prompt window.
PromptWindowsTitle
is for defining the prompts title. PromptWindowsSelectItemMessage
is defining the message given to the user in the prompt. PromptWindowsWidth
defines the prompt's width measured in pixels. PromptWindowsHeight
defines the prompt's height measured in pixels. requestType
This is set to
"GET"
in the example above. For similar setups, use the same settings.prefix
Set this to whatever you want to be set before the fetched data. In the example above, it is set to
prefix
so the key it returns will be: prefix.FirstName
when fetching data related to first name. auth
Optional. This is set to
"Basic"
in the example above, as the database is being accessed externally. In the case of LB, this parameter is omitted, as they are accessing their database internally and are therefore using a "Default" authentication. BasicAuthUserName
Used for "Basic" authentication, for username. Can be omitted with Default authentication.
BasicAuthPassword
Also used for "Basic" authentication, for password. Can be omitted with Default authentication.
Comments
0 comments
Article is closed for comments.