无法使用API​​记录时间输入

时间:2019-01-16 15:17:33

标签: clockify

我正在尝试使用Clockify API记录时间条目。当我在终端中运行以下行时,我得到以下响应

curl -H 'content-type':'application/json' -H 'X-Api-Key':'api-key' -X POST https://api.clockify.me/api/workspaces/workspace-id/timeEntries/{"start": "2019-16-01T10:00:00" , "billable": "false" , "description": "Clockify API post" , "end": "2019-16-01T10:30:00"}/


curl: (3) [globbing] unmatched brace in column 77
curl: (3) Port number ended with ':'
curl: (6) Could not resolve host: ,
curl: (6) Could not resolve host: billable
curl: (6) Could not resolve host: false
curl: (6) Could not resolve host: ,
curl: (6) Could not resolve host: description
curl: (6) Could not resolve host: Clockify API post
curl: (6) Could not resolve host: ,
curl: (6) Could not resolve host: end
curl: (3) [globbing] unmatched close brace/bracket in column 20

1 个答案:

答案 0 :(得分:0)

我使用Postman生成了cURL代码,这就是它创建的:

curl -X POST \
  https://api.clockify.me/api/workspaces/workspace-id/timeEntries/ \
  -H 'Content-Type: application/json' \
  -H 'X-Api-Key: value' \
  -H 'cache-control: no-cache' \
  -d '{"start": "2019-16-01T10:00:00" , "billable": "false" , "description": "Clockify API post" , "end": "2019-16-01T10:30:00"}'

我认为您在JSON前面缺少-d-我认为它可能也需要用''(单引号)包围,但是我不是cURL的专家,所以我不能说当然可以。