Skip to content
huang wei edited this page Jun 26, 2018 · 14 revisions

目录

授权

  • 1、创建一个ApiApplication,获得appidappsecret

  • 2、获得Namespace的id

  • 3、构建Authorization header

    形式:appid:encoded_data

    encoded_data:以appsecret为key,用JWT的HS256进行加密,加密payload为{"namespace_id":id}

分页

  • 参数
    • per_page 每页多少个,默认24,范围1~100
    • page 页数
  • 接口返回 Header
    • X-SLP-Current-Page: 当前页数
    • X-SLP-Total-Pages: 总页数
    • X-SLP-Total-Count: 总个数

错误码

Error Code Meaning
403 Unauthorized - 授权失败,参考上方的2种授权方式
404 Not Found - 没有找到请求的资源
422 Unprocessable - 更新资源时,验证失败
500 Internal Server Error - 服务器有问题,请联系我们

Api列表

获取流程信息

GET /api/v4/yaw/flows/:id

Parameters None

Response

Status: 200 OK
{
  "id":8,
  "title":"简单流程",
  "fields":[
    {
      "id":38761,
      "title":"别填",
      "description":null
    },
    {
      "id":38806,
      "title":"明细清单",
      "description":null
    }
  ],
  "vertices":[
    {
      "id":78,
      "name":"开始节点",
      "type":"YetAnotherWorkflow::Vertex::Initial"
    },
    {
      "id":80,
      "name":"流程节点3",
      "type":"YetAnotherWorkflow::Vertex::Normal"
    },
    {
      "id":79,
      "name":"结束节点",
      "type":"YetAnotherWorkflow::Vertex::Final"
    },
    {
      "id":90,
      "name":"流程节点2",
      "type":"YetAnotherWorkflow::Vertex::Normal"
    },
    {
      "id":91,
      "name":"流程节点1",
      "type":"YetAnotherWorkflow::Vertex::Normal"
    },
    {
      "id":113,
      "name":"开始节点",
      "type":"YetAnotherWorkflow::Vertex::Initial"
    },
    {
      "id":114,
      "name":"结束节点",
      "type":"YetAnotherWorkflow::Vertex::Final"
    }
  ],
  "edges":[
    {
      "id":101,
      "from_vertex_id":78,
      "to_vertex_id":91
    },
    {
      "id":92,
      "from_vertex_id":80,
      "to_vertex_id":79
    },
    {
      "id":103,
      "from_vertex_id":90,
      "to_vertex_id":80
    },
    {
      "id":102,
      "from_vertex_id":91,
      "to_vertex_id":90
    }
  ]
}

获取发起的流程列表

GET /api/v4/yaw/flows/:id/journeys

Parameters None

Response

Status: 200 OK
X-SLP-Current-Page: 1
X-SLP-Total-Pages: 29
X-SLP-Total-Count: 2
  [
    {
      "id":110,
      "sn":"820180503184630000029",
      "status":"processing",
      "current_duration_threshold":null,
      "created_at":"2018-06-06T15:39:10.532+08:00",
      "updated_at":"2018-06-06T15:39:10.532+08:00",
      "current_vertex_id":91,
      "reviewer_vertex_ids":[
        78
      ],
      "response":{
        "id":548288,
        "cached_values":{
          "38761":{
            "value":[
              "123123123"
            ],
            "text_value":[
              "123123123"
            ],
            "exported_value":[
              "123123123"
            ]
          }
        }
      },
      "user":{
        "id":17013,
        "name":"aaaa",
        "identifier":"12345",
        "headimgurl":"/non-digested-assets/avatars/default.png"
      }
    },
    ...
  ]

Clone this wiki locally