/envvar endpoint not working for API

#1

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.

0 Likes

#2

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. https://circlecipy.readthedocs.io/en/latest/api.html#circleci.api.Api.add_envvar

Code example: https://github.com/levlaz/circleci.py/blob/master/circleci/api.py#L598

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.

0 Likes