Adding new Environment fails through API

michiel's Avatar

michiel

22 Oct, 2015 09:07 AM

I try to create new deploy environments through the API. But all I'm getting is a 500 response.

Getting my current list of Environments is working fine. So the bearer token is correct.
But when I'm posting values, this is returned. Error 500:
{"message":"Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details."}

I tried posting the exact JSON from this example, but that also fails:
http://www.appveyor.com/docs/api/environments-deployments#add-environment

Any suggestions?

  1. 1 Posted by michiel on 22 Oct, 2015 12:03 PM

    michiel's Avatar

    Some more context for this issue, I'm working on two tools.

    First one is a tool to Download all Publishing Profiles for our Azure Websites.
    We have lots of websites and downloading each profile manually takes a lot of time.
    This tool downloads all publish settings to a single directory.
    Code is here:
    https://github.com/michielpost/DumpAzurePublishProfiles

    Now I want to create AppVeyor deployment environments based on each Publishing Profile. That also takes a lot of time to do manually, copy pasting values etc.
    So I also created a tool for that. It reads all PublishSettings files from a directory and creates an Environment.
    Code is here:
    https://github.com/michielpost/PublishSettings2AppVeyor

    Only creating an environment does not work yet due to the Error 500.

  2. Support Staff 2 Posted by Feodor Fitsner on 22 Oct, 2015 04:38 PM

    Feodor Fitsner's Avatar

    Nice, we should have Azure website publishing profile parser built-in in AppVeyor!

    You can grab correct payload from the browser. Open Developer Tools in Chrome, then Network, create a new Environment on UI and see the payload sent to API.

  3. 3 Posted by michiel on 22 Oct, 2015 06:09 PM

    michiel's Avatar

    Thanks for the suggestion. On further investigation the difference was the content type header.
    I had to include:
    Content-Type: application/json;charset=utf-8

    Now it works!

  4. michiel closed this discussion on 22 Oct, 2015 06:09 PM.

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