PUT /api/projects

Douglas's Avatar

Douglas

16 Jun, 2017 02:34 PM

I've been tasked with updating a project environment variable via code (we want to regularly rotate an AWS user key). I'll be doing this through the appveyor api.

The update project api requires a rather lengthy list of configuration values to be supplied in the body as part of the put request.
PUT /api/projects
https://www.appveyor.com/docs/api/projects-builds/#update-project

I can get these values as part of the get project settings GET /api/projects/{accountName}/{projectSlug}/settings, but the response from the 'get', doesn't' align with what the 'put' want. This means I have to figure out some type of translation layer between the get and the put. when all I want to do is update one environment variable.

Question:. Is there an recommended (easier) way of doing this. I tried including only the baseline info (projectId, accountId, etc) but of course the api rejected that.

(as an aside
To me it would make sense to have a endpoint like
/api/projects/{accountName}/{projectSlug}/update ( or even /api/projects/update )
and only update supplied information. The way it is now, as the end user I have to worry about all those settings, that I don't care about for what I'm doing and don't want modified. )

  1. Support Staff 1 Posted by Feodor Fitsner on 16 Jun, 2017 03:14 PM

    Feodor Fitsner's Avatar

    Hi Douglas,

    The best way to see correct payload is to check it in Browser Developer Console while updating environment through UI.

  2. 2 Posted by douglas on 16 Jun, 2017 05:02 PM

    douglas's Avatar

    Hi Feodor - thanks for the reply.

    I guess I'm a little confused. Are you telling me that the documentation is wrong and that I should use some third party tool to figure out what the GUI is sending back?

  3. Support Staff 3 Posted by Feodor Fitsner on 16 Jun, 2017 05:12 PM

    Feodor Fitsner's Avatar

    There could be some discrepancies in documentation as models are constantly changing. Developer Tools in browser is not a 3rd-party tool and yes checking what's being sent by UI is the quickest way to get your integration working.

  4. 4 Posted by douglas on 16 Jun, 2017 05:31 PM

    douglas's Avatar

    Hi Feodor - thanks again, but I think that you are missing the point.

    I know how to get the request details (developer tools or whatever), my question is how do I avoid having to 'put' the entire GUI list of variables, which as you mentioned is constantly changing. I only want to put the one that has changed.

    If I have to 'put' all the configuration, I have to get the project settings first (via the api), transform it to what the api is expecting and then send all sorts of configuration values that haven't been modified back. (and if fact could have been modified by a different process in the meantime.)

  5. Support Staff 5 Posted by Feodor Fitsner on 16 Jun, 2017 05:39 PM

    Feodor Fitsner's Avatar

    Right, I see what you mean. Unfortunately, right now partial updates (patch requests) are not supported for project settings, however, I agree it makes sense to implement that for project environment variables at least.

    I've created a new issue: https://github.com/appveyor/ci/issues/1613

  6. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:17 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac