Build API fails with Internal Server Error 500

alexander's Avatar

alexander

21 Jun, 2018 06:06 AM

I'm trying to start a build of specific branch commit using the Build REST API but the following gives me a 500 error which gives me no clue to whether my request is bad or if the API is broken (details omitted):

POST /api/builds
BODY
{
    "accountName": "XXX",
    "projectSlug": "XXX",
    "branch": "XXX",
    "commitId": "XXX"
}

Result:
500 Internal Server Error

I have double checked and made sure I pass the correct values for the body payload.

Is there something obvious I'm missing?

  1. Support Staff 1 Posted by Owen McDonnell on 21 Jun, 2018 07:22 AM

    Owen McDonnell's Avatar

    Here is a powershell script that works for me... Maybe it will give you some ideas

    $token = '<my-token>'
    $headers = @{
      "Authorization" = "Bearer $token"
      "Content-type" = "application/json"
    }
    $body = @{
      "accountName" = "<my-account-name>"
      "projectSlug" = "<my-project>"
      "branch" = "master"
      "commitId" = "584ec7d9"
    }
    Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Body ($body|ConvertTo-Json) -Method Post
    
  2. 2 Posted by alexander on 21 Jun, 2018 07:25 AM

    alexander's Avatar

    Thanks! I was using Powershell as well but I missed the part where I should convert the body payload to json. My bad! Thanks a lot for the sample script. However it still would be nice if there was some kind of error message returned for a bad request :)

  3. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:50 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