The /envvar endpoint is showing unusual behavior. I’m unable to create environment variables using the endpoint programmatically (i.e. via ?circle-token=... from my own script), but the web app appears to use it just fine. As best I can tell, it seems like it doesn’t work when authenticating using the query param, but it works fine is authenticating using cookies.
When authenticating using query params, I get:
{ "message" : "You must choose a name for this environment variable"}
Even if I send an identical request body to the one sent by the web app’s own XHR request.
Can you share the code that you are using to make this? This endpoint is a part of the wrapper I wrote and it does not appear to have any issues. API — circleci.py 2.0.0 documentation
Note that this endpoint requires a name and a value for your env var, so it looks like either you are not providing a name, or it is unable to read the name key.
Instead of passing a simple key:value pair as JSON, circle wants to have two key:value pairs for ONE env var. The names for both need to be explictily set as “name” and “value”, as specified also in the Circle CI API help pages.