Hi,
I’m currently dealing with multiple issues when I’m trying to create/update environment variables through the Netlify API. I’ve tried to call multiple endpoints to achieve what I want to achieve, but I keep getting 500 responses on different endpoints.
These are the issues that I’ve encountered so far:
The site_id property seems to be ignored, environment variables are always created on team level, and thats not what I want in my specific case.
So I went to use another/different endpoint:
According to the API docs I can set a context here. This works for a custom context (“dev” “branch-deploy” “deploy-preview” “production” “branch”), but as soon as I send context=“all”, I will get a 500 response, according to the docs this should be possible.
What I don’t really understand is why this endpoint (as the only upsert endpoint) doesn’t allow me to set is_secret & scopes. This was a reason for me to also call the updateEnvVar endpoint.
This endpoint doesn’t seem to work at all. I keep getting 500 responses without any explanation what went wrong. I did make sure my environment variable existed on site level, because this endpoint can only update existing variables.
Seems related to issue: 500 Internal Server Error when setting Env Vars via API
Another (unrelated) thing that I’ve found: The OpenAPI specifications that I’ve downloaded from https://open-api.netlify.com/ (and the docs itself) are not fully up-to-date with the current API version, It’s missing quite some properties on the repoInfo object for example (base, untrusted_flow, base_rel_dir, package_path, repo_type, repo_owner_type, skip_automatic_builds, configuration_file_path)
I hope someone can help me out.
Thanks!