通过travis API v3检查请求的作业状态

时间:2017-06-15 14:19:24

标签: api travis-ci

所以我使用travis api v3 guide提交了一个请求,得到了如下响应:

{
  "@type": "pending",
  "remaining_requests": 10,
  "repository": {
    "@type": "repository",
    "@href": "/repo/111111111",
    "@representation": "minimal",
    "id": 111111111,
    "name": "my-111111111",
    "slug": "me/my111111111"
  },
  "request": {
    "repository": {
      "id": 222222,
      "owner_name": "me",
      "name": "my-111111111"
    },
    "user": {
      "id": 333333
    },
    "id": 444444,
    "message": "Cool message",
    "branch": "master"
  },
  "resource_type": "request"
}

那么现在获得这些工作状态的方法是什么?我想我需要使用id 444444,但我收到错误,不知道我做错了什么:

curl -s -X POST \
 -H "Content-Type: application/json" \
 -H "Accept: application/json" \
 -H "Travis-API-Version: 3" \
 -H "Authorization: token mycooltoken" \
 https://api.travis-ci.org/repo/111111111/requests/444444


{
  "@type": "error",
  "error_type": "not_found",
  "error_message": "resource not found (or insufficient access)"
}

有人能指出我在哪里寻找例子或任何其他想法吗?

1 个答案:

答案 0 :(得分:1)

对不起混淆 - 不知怎的,我忽略了我必须将POST更改为GET;通过这个简单的修复一切正常。