Hey, I'm having issues with the PATCH /envs/<en...
# permit-saas
c
Hey, I'm having issues with the PATCH /envs/<env-id> endpoint. When I make a request to update the custom-branch-name, I get a succesful response but the value doesn't update.
curl '<https://api.permit.io/v2/projects/><proj-id>/envs/dev' -X 'PATCH' \
-H 'authorization: Bearer <my-key>'\
--data-raw '{"custom_branch_name": "development"}'
a
Hi @Christie Molloy, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
I see you're trying to update the
custom_branch_name
field for an environment. (1) Your curl command syntax looks correct based on the documentation for updating an environment's custom branch name. The correct endpoint format for updating an existing environment's custom branch name is:
Copy code
curl '<https://api.permit.io/v2/projects/{project_id}/envs/{env_id}>' -X 'PATCH' \
 -H 'authorization: Bearer {API_SECRET_KEY}'\
 --data-raw '{"custom_branch_name": "new-env-branch-name"}'
A few things to check: 1. ​*GitOps Configuration*​: The custom branch name feature requires GitOps to be properly configured. Make sure the Policy Repo is activated on your project for the custom branch name to work properly. (2) 2. ​*Repository Activation*​: You need to activate your repository in Permit after configuring it. This is done with:
Copy code
curl -X PUT "<https://api.permit.io/v2/projects/<your-project-id-or-key>/repos/<your-repo-id-or-key>/activate>" -H "Authorization: Bearer <your-permit-api-key>"
To help our engineers investigate this issue further, could you please provide: 1. Which Workspace / Project / Env you are using 2. What calls you are performing (as SDK code or CURL) 3. Which PDP version you are running 4. Any relevant logs from your PDP This information will help us determine w
To learn more, see the sources I considered: [[1] Create a new Environment](https://docs.permit.io/manage-your-account/creating-environments) [[2] Git and Permit](https://docs.permit.io/integrations/gitops/github)
c
Yes, the repository is activated, and my GitLab repo looks good -- receiving updates when I edit on the UI
a
Hey @Christie Molloy, can you try to deactivate and activate again?
and then try to update the name again
c
I've done that now, stil seeing
"custom_branch_name":null
when I GET the env
a
understood. can you try update the name right after the deactivate?
You need to activate your repository in Permit after configuring it.
c
Ok, I tried that and the same thing. I also tried to update the 'name' property as a test and that does not update either. Can you confirm that the PATCH projects/<project_id>/envs/<env_id> is working on your side?
t
Hey @Christie Molloy give us a little while to test and make sure.
👍 1
a
Hey @Christie Molloy, checked it on our side and it worked
Copy code
curl <https://api.permit.io/v2/projects/default/envs/dev> \
  --request PATCH \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "",
  "description": "",
  "custom_branch_name": "<https://my-website.com/path/to/page>",
  "settings": {}
}'