API question “Update Project"

Trying to use the https://docs.doppler.com/reference/projects-update API call.
The result of the API call is a new project and not an updated project. I would expect the output of the call that the name of the project would change not that it would create a new project :smirk:.

Hi @MikevdBerge!

I’m not sure how you got that result. I just tested this and if the project specified in the request exists, it renames in place. A new project isn’t created. If the specified project doesn’t exist, you receive an error (it doesn’t create a new project).

This results in the example-project project getting renamed to example-project-renamed. The single secret and integration sync that were on the project were still there post-rename, confirming that the project wasn’t destroyed and recreated.

❯ curl -X POST "https://api.doppler.com/v3/projects/project" \
     -H "Authorization: bearer $(doppler configure get token --plain)" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     --data '
{
  "project": "example-project",
  "name": "example-project-renamed"
}
'
{"project":{"id":"example-project-renamed","slug":"example-project-renamed","name":"example-project-renamed","description":null,"created_at":"2024-11-01T15:08:51.995Z"},"success":true}

This shows that you get an error if you specify a project that doesn’t exist:

❯ curl -X POST "https://api.doppler.com/v3/projects/project" \
     -H "Authorization: bearer $(doppler configure get token --plain)" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     --data '
{
  "project": "example-project-foo",
  "name": "example-project"
}
'
{"messages":["Could not find requested project 'example-project-foo'"],"success":false}

Could you post the exact API call you were making that resulted in a new project?

1 Like

Setup before the update


Postman request for the update

Result in Doppler

While testing I noticed what I was doing wrong. I was using the projects endpoint instead of the projects/project endpoint.
So it’s working now but I think the update on the projects endpoint should have failed.

Regards
Mike