当后,本 API 让请求者可以查看该任务所产生的的状态,获取工作者提交的结果,并根据指定工作的结果决定或该指定工作。
HTTP Request
URL
https://api.crowdsdom.com/v1/jobs/:id/tasks
HTTP Method
GET
HTTP Header
Content-Type: application/json
Authorization: YOUR_ACCESS_TOKEN
URL
以下的参数直接放在 http 请求的 URL 中。
名称 | 描述 | Type | Default | Required |
---|---|---|---|---|
id | 欲取得指定工作的任务专属识别号 | String | None | Yes |
若 http request 成功取得任务的指定工作列表,则将返回 status code : 200及一个的阵列。
若没成功,系统则会返回错误的代码及原因。
以Python requests 直接调用 API 接口为例:
12345678 | import requestsAPI_URL = 'https://api.crowdsdom.com/v1/jobs/507f191e810c19729de860ea/tasks'headers = {'Authorization': 'YOUR_ACCESS_TOKEN'}response = requests.get(API_URL, headers=headers) |
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | [ { id: '507f191e810c19729devxbbx', status: 'submitted', expirationTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", rejectionTime: null, approvalTime: null, submitTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", acceptTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", deadline: , answers: [ { questionId: 'sentiment', answer: ['neutral'] } ], jobId: '507f191e810c19729de860ea', contributorId: '507f191e810c19729de8adfaf' }, { id: '507f191e810c19bcvbfghbcv', status: 'approved', expirationTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", rejectionTime: null, approvalTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", submitTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", acceptTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", answers: [ { questionId: 'sentiment', answer: ['positive'] } ], jobId: '507f191e810c19729de860ea', contributorId: '507f191e810c19729dgdfbvb' }, { id: '507f191e810c197dgdsfgrthgf', status: 'init', expirationTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", rejectionTime: null, approvalTime: null, submitTime: null, acceptTime: "Mon Oct 26 2015 07:17:24 GMT+0800 (CST)", jobId: '507f191e810c19729de860ea', contributorId: '507f191e810c19729xvbxaf' }] |
原文:大专栏GET /jobs/:id/tasks (取得任务的指定工作)
来源:博客园
作者:王子自强男
链接:https://www.cnblogs.com/wangziqiang123/p/11618459.html