Closed vytjak closed 4 years ago
Hello,
That endpoint is used quite heavily and I could not reproduce the problem. The 404 error can happen if the project does not exist or the authenticated user does not have access to it.
Please check you're fetching the right ID and have everything using
curl -v -u <your_api_token>:api_token \
-X GET https://www.toggl.com/api/v8/projects/<your_project_id>
If you get a 200 response you should also be able to update the name in the same manner:
curl -v -u <your_api_token>:api_token \
-H "Content-Type: application/json" \
-d '{"project":{"name":"Changed the name"}}' \
-X PUT https://www.toggl.com/api/v8/projects/<your_project_id>
Hi,
I've been testing exactly as you've described, trying both curl and Postman, with same results.
GET https://toggl.com/api/v8/projects/<project id>
returns project data
PUT https://toggl.com/api/v8/projects/<same project id>
results in 404
I am the owner and administrator of the workspace, it's on a free subscription plan.
Please send us an email to support@toggl.com with the project information so we can take a closer look at the data and get back to you.
Sent.
After some more investigation, we've discovered that the fault was API test setup on our end. The particular project update test was setup with a different (non-admin) user api_token, as opposed to all other tests.
What has put us off the track when trying to resolve this, is that we did not get any error messages in the API response, except for the HTTP status code. Toggl API documentation states:
Failed requests
If a create or update action failed, HTTP status code 404 and an array of localized error messages will be returned.
Request
[...]
(sample code skipped)
Response
["Start can't be blank"]
In the project update case, if the user did not have the permission to change the project, the HTTP status code returned was 404 and the response content was empty.
We would have expected to get an error message about insufficient permissions as per the API documentation, or HTTP 403.
Having said that, we generally find Toggl API very clean and robust, as apposed to some wild beast out there - keep up the good work.
We will see what we can do with this since v8
is now only changed for critical bugs. I can confirm this is how it behaves since projects can only be updated either by workspace admins or project managers.
And thank you for your kind words.
I've been struggling for a few hours trying to get project update to work, as per the documentation: https://github.com/toggl/toggl_api_docs/blob/master/chapters/projects.md The request fail with Status 404 and a null response body.
API request URL:
PUT https://toggl.com/api/v8/projects/<project id>
request data: