/rest/greenhopper/1.0/sprint/picker是jira的接口,示例用法
时间: 2023-09-18 20:07:16 浏览: 239
这个接口用于获取当前用户的所有Sprint列表,可以通过以下示例用法进行调用:
```python
import requests
# Jira服务器的地址和项目ID
jira_url = "https://your-jira-url.com"
project_id = "PROJ-123"
# Jira登录凭证
auth = ("your_jira_username", "your_jira_password")
# 构造请求URL
url = f"{jira_url}/rest/greenhopper/1.0/sprint/picker?&includeHistoricSprints=true&includeFutureSprints=true&projectKeyOrId={project_id}"
# 发送请求
response = requests.get(url, auth=auth)
# 解析响应数据
if response.ok:
data = response.json()
sprints = data["suggestions"]
for sprint in sprints:
print(f"Sprint ID: {sprint['id']}, Name: {sprint['name']}")
else:
print("Failed to get sprint list.")
```
以上示例代码中的`jira_url`是你的Jira服务器地址,`project_id`是你要查询的Jira项目的ID或Key。`auth`是Jira登录凭证,使用Jira的用户名和密码即可。构造请求URL时,需要指定`includeHistoricSprints`和`includeFutureSprints`参数来控制是否包含历史和未来的Sprint。最后,解析响应数据并输出Sprint的ID和名称。
阅读全文