Get the Form to Register for an Event
We need the form to register for an event from the universal interface. Use the POST call. It is defined as followed:
POST: /rest/cwx-sol-rest/latest/sol/aob/event/form/<eventname>
Where <eventname>
is the name of the event that is called.
Furthermore, you have to send the account you are refering to in the REST header using cwx-sol-account
.
Example curl command:
curl -u admin:admin -X POST -H 'User-Agent: x' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'cwx-sol-account: C958FC77-D1BC-4166-8B72-37333F85270D' -i 'http://192.168.2.146:8081/rest/cwx-sol-rest/latest/sol/aob/event/form/ISSUECREATED'
The JSON data output looks like this:
... {"form":{"identity":"EVENT","type":"EXTERNAL_EVENT","title":"Event form","key":"/event/ISSUECREATED","attributevalues":[{"control":"required","attribute":"MODE","position":"0001","type":"string","title":"Mode","value":"async"},{"control":"required","attribute":"OBJECTKEY","position":"0002","type":"String","title":"Remote Object Key"}]}}
For Jira the form looks like this:
{ "form": { "identity": "EVENT", "type": "EXTERNAL_EVENT", "title": "Event form", "key": "/event/ISSUECREATED", "attributevalues": [ { "control": "required", "attribute": "MODE", "position": "0001", "type": "string", "title": "Mode", "value": "async" }, { "control": "required", "attribute": "OBJECTKEY", "position": "0002", "type": "String", "title": "Remote Object Key", "value": "/issue/$issueKey$" } ] } }
The value attribute of the OBJECTKEY needs to be set manually.
The value attribute of the OBJECTKEY should be /issue/<issueKey>
of the affected issue therefore you can use the variable $issueKey$ which will be replaced by the key of the issue that causes the event.