https://docs.atlassian.com/jira/REST/latest/#api/2/
1. Comment 달기
API를 찾아보면 아래와 같은 형식으로 레퍼런스가 제공된다.
- POST /rest/api/2/issue/{issueIdOrKey}/comment : POST 방식으로 요청해야 하며, url은 comment이다. issueId는 ISSUE-123과 같다.
- query parameters : String 타입이고 "body" : "코멘트"와 같은 형태여야 함
- Response : 성공했을 때는 201을 리턴함.
이것을 python으로 작성하면
def postcomment(self, comment, issueid):
url = self.hosturl + "/rest/api/2/issue/" + issueid + "/comment"
headers = {"Content-type": "application/json"}
dic = {"body": comment}
requests.post(url, data=json.dumps(dic), headers=headers, cookies=self.cookies)
2. Watcher 추가하기
역시 POST 방식이고 url은 watchers이다.
근데 example이 너무 비어 보인다.
python 코드에서 dictionary를 post에 넘겨주어야 하는데 과연 저걸 어떻게 넘겨야 할지 한참을 헤맸다.
결국 그냥 넘기면 된다 (...)
dic = "아이디"
requests.post(url, data=json.dumps(dic), headers=headers, cookies=self.cookies)