Register an Event

Use the PUT call to register an event. It is defined as followed:

PUT: /rest/cwx-sol-rest/1.0/sol/aob/activity/registration/form/{eventPattern}/{activityPattern}/{eventId}/{projectKey}/{issueTypeId}/{customerRef}

The returned form data from the POST request shows that 5 attributes have to be provided to register an call back in the universal interface:

  • method: The REST method to be used for the call back (GET,POST, PUT, DELETE).
  • path: Defines the path after the host URL.
    host: The host to be called when the event occurs including the protocol.
  • port: Here a port for our call back server can be defined. If left empty, port 80 is assumed.
  • body: Provide a string with a JSON structure. The JSON structure will be the body of the call back. Currently JSON can not be provided directly in this field.
    The universal interface allows to define placeholders which will be replaced before the call back is send. Currently it is only possible to get the key of the related issue. The placeholder is $issueKey$. In the following example, we use the following JSON structure: {"issue": "$issueKey$"}

curl -u admin:admin -X PUT -H 'User-Agent: x' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'cwx-sol-account: 31582A4F-F1E7-448A-929C-166DF29218EC' -i 'http://localhost:8080/rest/cwx-sol-rest/latest/sol/aob/activity/registration/form/ISSUEUPDATED/*/CALLBACK/*/*/my-callback-1' --data '{"form": {"title":"Form for SolEventHandlerBean", "attributevalues":[ {"attribute":"body","position":"0001","type":"string","value":"{\"form\":\"$changedFields$\"}"}, {"attribute":"method","position":"0002","type":"string","value":"PUT"}, {"attribute":"path","position":"0003","type":"string","value":"/casag/cascon/aob/event/form/JIRA_WORKLOG_CREATED"}, {"attribute":"host","position":"0004","type":"string","value":"http://localhost"}, {"attribute":"port","position":"0005","type":"string","value":"5000"} ] } } '

The output looks like this:

...

{"status":"SUCCESS"}

In the "Event Handler Registry" dialog of TWX Connector, you see the registered events.

Click Delete at the right if you want to delete an registered event.