check status of job requested through travis API v3

孤街浪徒 提交于 2020-01-15 09:55:49

问题


So I've submitted a request using travis api v3 guide and got response like:

{
  "@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"
}

So what is the way to get status of those jobs now? I suppose that I need to use id 444444, but I am getting error below, not sure what I am doing wrong:

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)"
}

Can somebody point me where to look for examples or any other idea?


回答1:


Oh sorry for confusion - somehow I overlooked that I must change POST to GET; with that simple fix everything worked fine.



来源:https://stackoverflow.com/questions/44569955/check-status-of-job-requested-through-travis-api-v3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!