Hi,
I’m trying to create a new expense entry with python and the Clockify API and get the following error:
‘{“message”:“createExpense.request.date: You entered invalid value for field : [date]. Values that represent [date] can't be null and can't be empty. Please make sure that the [date] date is not greater than 9999-12-31 and not less than 0001-01-01. Ensure that the [date] date is in following format: \“yyyy-MM-ddThh:mm:ssZ\” Example: 2018-11-29T13:00:46Z.”,“code”:501}’
and here ist the code:
api_key="XXX"
header = {'Content-Type': 'multipart/form-data; boundary=ebf9f03029db4c2799ae16b5428b06bd', 'x-api-key': api_key}
expense = {
"userId": "XXX",
"date": "2022-05-26T18:17:01.123Z",
"projectId": "XXX",
"categoryId": "XXX",
"notes": "My note",
"amount": "2.0",
"billable": "true",
"file": "(binary)",
}
z = requests.post('https://api.clockify.me/api/workspaces/XXXXXXXXXX/expenses', data=expense, headers=header)
print(z.content)
I don’t know why, because the Date Format is right. It doesn’t work even with the suggested format in the message “2018-11-29T13:00:46Z”
Can anyone help?
Thanks