Advertisement
Guest User

Untitled

a guest
Mar 4th, 2025
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php
  2. $webhooksbase = 'https://api.atlassian.com/ex/jira/'.$site_id.'/rest/api/3/webhook';
  3. $data = <<<REQUESTBODY
  4. {
  5. "url": "https://webhook.site/839d3c82-5da3-454f-9b70-52f33dc4c6ed",
  6. "webhooks": [
  7. {
  8. "events": [
  9. "jira:issue_updated"
  10. ],
  11. "fieldIdsFilter": [
  12. "summary"
  13. ],
  14. "jqlFilter": "project = TESTRAIL"
  15. }
  16. ]
  17. }
  18. REQUESTBODY;
  19. $ch = curl_init();
  20. curl_setopt($ch, CURLOPT_URL, $webhooksbase);
  21. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  22. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  23. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  24. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  25. 'Accept: application/json',
  26. 'Content-Type: application/json',
  27. 'Authorization: Bearer ' . $result_decode['access_token']
  28. ]);
  29. $result_issue = curl_exec($ch);
  30. $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  31.  
  32. if (curl_errno($ch)) {
  33. echo 'Error:' . curl_error($ch);
  34. }
  35. curl_close($ch);
  36. echo 'code:'. $httpcode.'<hr />Response: <br>';
  37.  
  38. ?>
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement