Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify which PATCH requests add vs. overwrite #350

Open
kaganjd opened this issue Jul 28, 2021 · 1 comment
Open

Clarify which PATCH requests add vs. overwrite #350

kaganjd opened this issue Jul 28, 2021 · 1 comment

Comments

@kaganjd
Copy link

kaganjd commented Jul 28, 2021

We had an enterprise customer who was surprised when their PATCH request to update environment variables actually overwrote their existing variables. They said:

I made this patch request, expecting only the named environment variables to be updated. Instead, the entire env block was replaced.

The API call was curl --location --request PATCH 'https://api.netlify.com/api/v1/sites/:site_id' with payload

"build_settings": {
        "env": {
            "KEY": "VALUE"
        }

which resulted in replacing several variables with just this one new one, KEY=VALUE

@keiko713
Copy link
Contributor

keiko713 commented Aug 5, 2021

Because the env there is nested, we did the PATCH that level, to only update env (not other build settings). However, I agree that this is confusing behavior. We are working on improving the Open API doc, I think this is something we could document well in the doc for the next generation one, to explain how it exactly works.
Alternatively, we could create a separate endpoint specific to update/patch the env, but that'll be a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants