全部产品

项目 API

创建项目

API:

CreateDevopsProject

请求参数

param

是否必填

备注

OrgId

企业Id

name

项目名称

Description

描述

{
    "Successful": true,
    "ErrorCode": null,
    "ErrorMsg": null,
    "Object": "5f0ec62cccd91500486764ba", //项目id
    "RequestId": null,
}

示例代码:

         String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        CreateDevopsProjectRequest createProjectRequest =new CreateDevopsProjectRequest();
        createProjectRequest.setOrgId(orgId);
        createProjectRequest.setName("xftest项目"+dateString);
        createProjectRequest.setDescription("项目描述test"+dateString);
        createProjectRequest.setSysEndpoint(endPoint);
        CreateDevopsProjectResponse acsResponse = client.getAcsResponse(createProjectRequest);

查看项目

API:

GetDevopsProjectInfo

请求参数

param

是否必填

备注

OrgId

企业Id

ProjectId

项目Id

响应结果

└ _id

项目 ID

└ name

项目名称

└ pinyin

项目名称的拼音

└ description

项目简介

└ visibility

项目公开性,取值为:private:私有项目(仅项目成员可查看和编辑)visibleInOrg:企业项目(企业内所有成员可见,仅项目成员可编辑)

└ isArchived

是否归档:0 未归档,1 已归档

└ _creatorId

创建人的用户 ID

└ created

项目创建时间

└ _modifierId

最近一次执行更新操作的用户 ID

└ updated

最近一次更新时间

{
    "Successful": true,
    "ErrorCode": null,
    "errorMsg": null,
    "Object": {
        "IsArchived": false,
        "ModifierId": "",
        "Description": "一站式、端到端、全栈敏捷的软件研发全生命周期管理。",
        "CreatorId": "5e9ee108424a50d98c7c8906",
        "Visibility": "project",
        "Created": "2020-07-13T12:10:45.428Z",  
        "Name": "taskflow",
        "Id": "5f0c4f459b839d004acd5070",
        "updated": "2020-07-13T12:10:45.428Z"
    },
    "RequestId": null
}


项目不存在
{
    "ErrorCode": "404",
    "ErrorMsg": "status 404 reading ProjectApi#getProjectById(String); content:\n{\"error\":\"ResourceNotFound\",\"message\":\"ResourceNotFound: \"}",
    "Successful": false,
    "RequestId": null
}

示例代码:

         String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        GetDevopsProjectInfoRequest getProjectInfoRequest=new GetDevopsProjectInfoRequest();
        getProjectInfoRequest.setOrgId(orgId);
        getProjectInfoRequest.setProjectId(projectId);
        getProjectInfoRequest.setSysEndpoint(endPoint);
        GetDevopsProjectInfoResponse acsResponse = client.getAcsResponse(getProjectInfoRequest);
 

删除项目

API:

DeleteDevopsProject

请求参数

param

是否必填

备注

OrgId

企业Id

ProjectId

项目Id

响应结果

删除成功
{
    "Successful": true,
    "ErrorCode": null,
    "ErrorMessage": null,
    "Object": {},
    "RequestId": null
}

项目删除失败
{
    "ErrorCode": "404",
    "ErrorMsg": "status 404 reading TbProjectApi#deleteProject(String); content:\n{\"error\":\"NotFound\",\"message\":\"\"}",
    "Successful": false,
    "RequestId": null
}

示例代码:

         String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        DeleteDevopsProjectRequest deletePrjectRequest =new DeleteDevopsProjectRequest()
        deletePrjectRequest.setProjectId("<projectId>");
        deletePrjectRequest.setSysEndpoint(endPoint);
        DeleteDevopsProjectResponse acsResponse = client.getAcsResponse(deletePrjectRequest);

更新项目

API:

UpdateDevopsProject

请求参数

param

是否必填

备注

OrgId

企业Id

name

项目名称

Description

描述

ProjectId

项目id

{
    "Successful": true,
    "ErrorCode": null,
    "ErrorMsg": null,
    "Object": true,
    "RequestId": null,
}

示例代码:

         String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        deletePrjectRequest.setOrgId(orgId);
        //创建一个新的项目,获取项目id
        String projectId2 = getProjectId();
        deletePrjectRequest.setProjectId(projectId2);
        deletePrjectRequest.setSysEndpoint(endPoint);
        DeleteDevopsProjectResponse acsResponse = client.getAcsResponse(deletePrjectRequest);
  
 

项目添加成员

API:

InsertProjectMembers

请求参数

param

是否必填

备注

OrgId

string

企业Id

Members

string

项目成员[{"userId":"5eec85dfe451bd5sssse18b797","role":0}]role0普通成员1 管理员

ProjectId

string

项目id

{
    "Successful": true,
    "ErrorCode": null,
    "ErrorMsg": null,
    "Object": true,
    "RequestId": null
}

示例代码:

         String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        InsertProjectMembersRequest addProjectMembersRequest =new InsertProjectMembersRequest();
        addProjectMembersRequest.setOrgId(orgId);
        addProjectMembersRequest.setProjectId(projectId);
        addProjectMembersRequest.setMembers("[{\"userId\":\"<userId>\",\"role\":1}]");
        addProjectMembersRequest.setSysEndpoint(endPoint);
        InsertProjectMembersResponse acsResponse = client.getAcsResponse(addProjectMembersRequest);
 

项目删除成员

API:

DeleteDevopsProjectMembers

请求参数

param

是否必填

备注

OrgId

string

企业Id

ProjectId

string

项目id

UserIds

string

多个逗号分割

{
    "Successful": true,
    "ErrorCode": null,
    "ErrorMsg": null,
    "Object": true,
    "RequestId": null
}

示例代码:

         String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        DeleteDevopsProjectMembersRequest deleteProjectMembersRequest =new DeleteDevopsProjectMembersRequest();
        deleteProjectMembersRequest.setOrgId(orgId);
        deleteProjectMembersRequest.setProjectId(projectId);
        deleteProjectMembersRequest.setUserIds(userId);
        deleteProjectMembersRequest.setSysEndpoint(endPoint);
        DeleteDevopsProjectMembersResponse acsResponse = client.getAcsResponse(deleteProjectMembersRequest);
 

查看项目成员

API:

GetDevopsProjectMembers

请求参数

param

是否必填

备注

OrgId

string

企业Id

ProjectId

string

项目id

{
    "Successful": true,
    "ErrorCode": null,
    "ErrorMsg": null,
    "Object": [
        {
            "MemberId": "5f0ec62dccd9150048676513",
            "UserId": "5e9ee108424a50d98c7c8906",
            "Role": 2,
            "Name": "刘玄",
            "AvatarUrl": "https://tcs-devops.aliyun.com/thumbnail/111v22daaa1b0a1a23502d05e9877a63781a/w/200/h/200",
            "Email": "aliyun_298989@mail.teambition.com",
            "Phone": ""
        }
    ],
    "RequestId": null
}

返回参数说明

参数

说明

└ memberId

成员 ID

└ userId

用户 ID

└ role

成员角色,取值为:0:成员1:管理员2:拥有者

└ name

成员名称

└ avatarUrl

用户头像 URL

└ email

邮箱地址,拥有"读取用户邮箱"权限时返回

└ phone

手机号,拥有"读取用户手机号"权限时返回

示例代码:

         String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        GetDevopsProjectMembersRequest getProjectMembersRequest =new GetDevopsProjectMembersRequest();
        getProjectMembersRequest.setOrgId(orgId);
        getProjectMembersRequest.setProjectId(projectId);
        getProjectMembersRequest.setSysEndpoint(endPoint);
        GetDevopsProjectMembersResponse acsResponse = client.getAcsResponse(getProjectMembersRequest);
 

查看项目标签、成员等

API:

GetProjectOptions

请求参数

参数

{
    "Successful": true,
    "ErrorCode": null,
    "ErrorMsg": null,
    "Object": [
         {
            "Name": "assa",
            "Value": "5fc0a734de4d560049e7a330"
        }

    ],
    "RequestId": null
}

返回参数说明

返回参数说明

String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
         DefaultProfile profile = DefaultProfile.getProfile(
            "cn-hangzhou",          // 地域ID
            "<ak>",      
            "<sk>");    
        IAcsClient client = new DefaultAcsClient(profile);
        String endPoint = "api-devops.cn-hangzhou.aliyuncs.com";
        GetProjectOptionRequest getProjectOptionRequest = new GetProjectOptionRequest();
        getProjectOptionRequest.setSysEndpoint(endPoint);
        getProjectOptionRequest.setOrgId("22222222222222222222");
        getProjectOptionRequest.setProjectId("2222222222");
        getProjectOptionRequest.setType("executorId");
        GetProjectOptionResponse acsResponse = client.getAcsResponse(getProjectOptionRequest);