Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $webhooksbase = 'https://api.atlassian.com/ex/jira/'.$site_id.'/rest/api/3/webhook';
- $data = <<<REQUESTBODY
- {
- "url": "https://webhook.site/839d3c82-5da3-454f-9b70-52f33dc4c6ed",
- "webhooks": [
- {
- "events": [
- "jira:issue_updated"
- ],
- "fieldIdsFilter": [
- "summary"
- ],
- "jqlFilter": "project = TESTRAIL"
- }
- ]
- }
- REQUESTBODY;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $webhooksbase);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
- curl_setopt($ch, CURLOPT_HTTPHEADER, [
- 'Accept: application/json',
- 'Content-Type: application/json',
- 'Authorization: Bearer ' . $result_decode['access_token']
- ]);
- $result_issue = curl_exec($ch);
- $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- if (curl_errno($ch)) {
- echo 'Error:' . curl_error($ch);
- }
- curl_close($ch);
- echo 'code:'. $httpcode.'<hr />Response: <br>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement