pingcode logo
功能日记

v4.132.0:REST API 开放产品工单相关的资源


更新时间:2023年5月15日

主要更新内容:

  1. 开放产品工单相关的资源,例如工单类型、工单状态等
  2. 开放工作项流转记录资源
  3. 在项目资源中新增项目状态、负责人、时间和自定义属性

开放产品工单相关的资源

获取一个产品
GET /v1/ship/products/{product_id}
查看测试模块
GET /v1/ship/products/{product_id}/customers/{customer_id}
获取一个工单类型 
GET /v1/ship/ticket_types/{ticket_type_id}
获取一个工单状态
GET /v1/ship/ticket_states/{ticket_state_id}
获取一个工单解决方案
GET /v1/ship/ticket_solutions/{ticket_solution_id}
获取一个工单属性
GET /v1/ship/ticket_properties/{property_id}
获取一个产品标签
GET /v1/ship/tags/{tag_id}
获取一个工单优先级
GET /v1/ship/ticket_priorities/{priority_id}
获取一个渠道
GET /v1/ship/channels/{channel_id}
获取工单列表
GET /v1/ship/tickets
获取一个工单
GET /v1/ship/tickets/{ticket_id}

目前工单相关的资源是只读资源,创建和修改操作还需要在 PingCode 网页中完成。获取一个工单的数据结构为:

{
    "id": "63eca888a0a13a3efc8d4a43",
    "url": "https://rest_api_root/v1/ship/tickets/63eca888a0a13a3efc8d4a43",
    "title": "希望新增支持第三方账号注册",
    "identifier": "SLC-T1",
    "product": {
        "id": "63eca880a0a13a3efc8d49eb",
        "url": "https://rest_api_root/v1/ship/products/63eca880a0a13a3efc8d49eb",
        "name": "示例产品",
        "identifier": "SLC"
    },
    "assignee": {
        "url": "https://rest_api_root/v1/directory/users/4a3b2a92adee469997edae12e6c066e8",
        "id": "4a3b2a92adee469997edae12e6c066e8",
        "name": "19831601700",
        "display_name": "wmvm",
        "avatar": "https://s3.cn-north-1.amazonaws.com.cn/lctmp/38577950-931e-48ba-a2f9-601fc63d3f17_160x160.png"
    },
    "state": {
        "id": "63eca880a0a13a3efc8d49d9",
        "url": "https://rest_api_root/v1/ship/ticket_states/63eca880a0a13a3efc8d49d9",
        "name": "待处理",
        "type": "pending"
    },
    "type": {
        "id": "63eca880a0a13a3efc8d49e0",
        "url": "https://rest_api_root/v1/ship/ticket_types/63eca880a0a13a3efc8d49e0",
        "name": "需求"
    },
    "customer": {
        "id": "63eca881a0a13a3efc8d49fc",
        "url": "https://rest_api_root/v1/ship/products/63eca880a0a13a3efc8d49eb/customers/63eca881a0a13a3efc8d49fc",
        "name": "北京XX科技有限公司"
    },
    "solution": {
        "id": "62f217ae16e3661a20124330",
        "url": "https://rest_api_root/v1/ship/ticket_solutions/62f217ae16e3661a20124330",
        "name": "进入需求池"
    },
    "priority": {
        "url": "https://rest_api_root/v1/ship/ticket_priorities/5cb9466afda1ce4ca0090004",
        "id": "5cb9466afda1ce4ca0090004",
        "name": "P1"
    },
    "description": "<p>希望支持其他更多第三方平台的账号注册,以便用第三方账号登录找回更换了手机号的账号,保障账号安全</p>",
    "properties": {
        "prop_1": "111"
    },
    "channel": {
        "id": "64550d9ec696b249b5fc607d",
        "url": "https://rest_api_root/v1/ship/channels/64550d9ec696b249b5fc607d",
        "name": "channel-1"
    },
    "submitted_by": {
        "url": "https://rest_api_root/v1/directory/users/4a3b2a92adee469997edae12e6c066e8",
        "id": "4a3b2a92adee469997edae12e6c066e8",
        "name": "19831601700",
        "display_name": "wmvm",
        "avatar": "https://s3.cn-north-1.amazonaws.com.cn/lctmp/38577950-931e-48ba-a2f9-601fc63d3f17_160x160.png"
    },
    "submitted_at": 1676454024,
    "created_by": {
        "url": "https://rest_api_root/v1/directory/users/4a3b2a92adee469997edae12e6c066e8",
        "id": "4a3b2a92adee469997edae12e6c066e8",
        "name": "19831601700",
        "display_name": "wmvm",
        "avatar": "https://s3.cn-north-1.amazonaws.com.cn/lctmp/38577950-931e-48ba-a2f9-601fc63d3f17_160x160.png"
    },
    "created_at": 1676454024,
    "updated_by": {
        "url": "https://rest_api_root/v1/directory/users/4a3b2a92adee469997edae12e6c066e8",
        "id": "4a3b2a92adee469997edae12e6c066e8",
        "name": "19831601700",
        "display_name": "wmvm",
        "avatar": "https://s3.cn-north-1.amazonaws.com.cn/lctmp/38577950-931e-48ba-a2f9-601fc63d3f17_160x160.png"
    },
    "updated_at": 1683203258,
    "participants": [
        {
            "url": "https://rest_api_root/v1/directory/users/4a3b2a92adee469997edae12e6c066e8",
            "id": "4a3b2a92adee469997edae12e6c066e8",
            "name": "19831601700",
            "display_name": "wmvm",
            "avatar": "https://s3.cn-north-1.amazonaws.com.cn/lctmp/38577950-931e-48ba-a2f9-601fc63d3f17_160x160.png"
        }
    ]
}

开放工作项流转记录资源

工作项流转记录资源对应着 PingCode 工作项详情面板里的“流转”记录:

对应的 REST API 为:

工作项流转记录
GET /v1/project/work_items/{work_item_id}/transition-histories
获取一个工作项流转记录
GET /v1/project/work_items/{work_item_id}/transition-histories/{transition_history_id}

工作项流转记录的数据结构为:

{
    "id": "5e6b35de50ef8153c2062f70",
    "url": "https://rest_api_root/v1/project/work_items/5edca524cad2fa1125cb0630/transition-histories/5e6b35de50ef8153c2062f70",
    "work_item": {
        "id": "5edca524cad2fa1125cb0630",
        "url": "https://rest_api_root/v1/project/work_items/5edca524cad2fa1125cb0630",
        "identifier": "SCR-5",
        "type": "bug",
        "title": "这是一个缺陷",
        "start_at": 1674493200,
        "end_at": 1674493200,
        "parent_id": "5edca524cad2fa112b05105c"
    },
    "from_state": {
        "id": "5c9b35de90ad7153c2062f18",
        "url": "https://rest_api_root/v1/project/states/5c9b35de90ad7153c2062f18",
        "name": "新建",
        "type": "pending",
        "color": "#56ABFB"
    },
    "to_state": {
        "id": "5ef85b1e9481936604da7f4c",
        "url": "https://rest_api_root/v1/project/states/5ef85b1e9481936604da7f4c",
        "name": "进行中",
        "type": "in_progress",
        "color": "#F6C659"
    },
    "created_by": {
        "id": "a0417f68e846aae315c85d24643678a9",
        "url": "https://rest_api_root/v1/directory/users/a0417f68e846aae315c85d24643678a9",
        "name": "john",
        "display_name": "John",
        "avatar": "https://s3.amazonaws.com/bucket/b46ef40c-e22e-4ecf-a599-cace9fba839a_160x160.png"
    },
    "created_at": 1674528614
}

项目资源中新增属性

项目资源中新增了负责人、状态、开始时间、结束时间和自定义属性。在获取一个项目和获取项目列表时都可以拿到这些信息:

GET /v1/project/projects/{project_id}
{
    "id": "5eb623f6a70571487ea47000",
    "url": "https://rest_api_root/v1/project/projects/5eb623f6a70571487ea47000",
    "members": [
        {
            "id": "a0417f68e846aae315c85d24643678a9",
            "url": "https://rest_api_root/v1/project/projects/5eb623f6a70571487ea47000/members/a0417f68e846aae315c85d24643678a9",
            "user": {
                "id": "a0417f68e846aae315c85d24643678a9",
                "url": "https://rest_api_root/v1/directory/users/a0417f68e846aae315c85d24643678a9",
                "name": "john",
                "display_name": "John",
                "avatar": "https://s3.amazonaws.com/bucket/b46ef40c-e22e-4ecf-a599-cace9fba839a_160x160.png"
            }
        }
    ],
    "name": "Scrum项目",
    "type": "scrum",
    "identifier": "SCR",
    "color": "#F693E7",
    "description": "这是一个Scrum项目",
    "state": "正常",
    "assignee": {
        "url": "http://rest_api_root/v1/directory/users/8168dd057b104c81bceb2e48bdf283d0",
        "id": "8168dd057b104c81bceb2e48bdf283d0",
        "name": "john",
        "display_name": "john",
        "avatar": "https://s3.amazonaws.com/bucket/b46ef40c-e22e-4ecf-a599-cace9fba839a_160x160.png"
    },
    "start_at": 1680278400,
    "end_at": 1682870399,
    "properties": {
        "prop_a": "prop_a_value",
        "prop_b": "prop_b_value"
    }
}

除此之外,REST API 还对一些其他资源进行了调整和扩展,更多功能请查看REST API 官方文档