跳到主要内容

邀请协作者

为项目邀请写作者,个人项目和团队项目对应不同的接口

个人项目邀请协作者

请求

curl -vvv -X POST "$API_HOST/open/api/v1/projects/$project_id/members/invitations/personal/" -H "Authorization: $access-token" -d '$request_body'

请求体

{
"members": [
{
"phoneOrEmail": "aa@elgo.cc",
"role": "admin"
},
{
"phoneOrEmail": "neal2@elgo.cc",
"role": "admin"
}
]
}

参数说明

NameTypeDescriptionRequired
membersarraymember info
∟ rolestringmember roleY
∟ phoneOrEmailstringphone or emaily

Python 示例

def invite_personal_project_member(access_token, project_id):
url = '%s/open/api/v1/projects/%d/members/invitations/personal/' % (API_HOST, project_id)
headers = {'Authorization': access_token}
data = {
"members": [
{
"phoneOrEmail": "aa@elgo.cc",
"role": "admin"
},
{
"phoneOrEmail": "neal2@elgo.cc",
"role": "admin"
}
]
}
req = requests.post(url, headers=headers, json=data)
return req.json()

响应示例

{
"code": 0,
"detail": null,
"extra": null,
"message": "OK",
"requestID": null
}

团队项目邀请协作者

请求

curl -vvv -X POST "$API_HOST/open/api/v1/projects/$project_id/members/invitations/team/" -H "Authorization: $access-token" -d '$request_body'

请求体

{
"members": [
{
"id": 3,
"role": "admin"
}
]
}

参数说明

NameTypeDescriptionRequired
membersarraymember info
∟ idint64user idy
∟ rolestringmember roleY

Python 示例

def invite_team_project_member(access_token, project_id):
url = '%s/open/api/v1/projects/%d/members/invitations/team/' % (API_HOST, project_id)
headers = {'Authorization': access_token}
data = {
"members": [
{
"id": 3,
"role": "admin"
}
]
}
req = requests.post(url, headers=headers, json=data)
return req.json()

响应示例

{
"code": 0,
"detail": null,
"extra": null,
"message": "OK",
"requestID": null
}