Variable json content in http integration
Hi all,
we implemented custom http integration to create tickets in Jira Servicedesk. This works fine.
However, new requirement is to put a variable (##jira.assetid##) in the content to link the ticket to the correct asset.
This works fine when the assetid is set. But when there is no asset id available the integration fails. Is there a way to make this output more dynami? I mean, if the value is set, write the value. If not, just write a default.
Our json message (bit redacted):
{
"fields": {
"summary": "##ALERTID## ##LEVEL## - ##HOST## ##DATASOURCE## ##DATAPOINT## ",
"issuetype": {
"id": "xxxxx"
},
"project": {
"key": "xxx"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "##MESSAGE## ##ALERTDETAILURL##",
"type": "text"
}
]
}
]
},
"customfield_10500": [##jira.organizationid##],
"customfield_10681": [
{
"workspaceId": "230f10d2-b759-405f-8d38-157edbe9e818",
"id": "230f10d2-b759-405f-8d38-157edbe9e818:##jira.assetid##"
}
]
}
}
When you say that integration fails, do you mean that LM doesn’t sent the REST request at all? Or that Jira is rejecting the json you are passing? I thought that LM will just fill in unset tokens with nothing, aka send over
"customfield_10500": []
. If you are looking to have some sort of default value when it’s not set, I would suggest setting a jira.organizationid property on the root folder/group as a default and let sub groups override it.I don’t use Jira so I might not understand the situation fully. I’m assuming jira.organizationid is assigned to groups/resources and not pulled from somewhere else.