0

我正在尝试使用 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
4

1 回答 1

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 专家,所以我不能肯定地说。

于 2019-01-17T14:15:06.873 回答