1
votes

I'm using Xcode server for CI, here we have couple of BOTs they are pointing to specific branch now and what we need is that whenever there is new release we should be able to switch them to new release branch using API without going to server manually and update them, For this option we tried using PATCH command recommended by apple, but it does not work rather it keep saying 400 even if we try apple's sample here https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/XcodeServerAPIReference/Bots.html#//apple_ref/doc/uid/TP40016472-CH2-SW1

Any help is highly appreciated. Thanks

2

2 Answers

0
votes

I was having a similar problem and ended up using Charles proxy to see how Xcode modifies the branch when changed through the UI. I eventually ended up with the following tricks (overwriteBlueprint=true was the last piece of the puzzle for me)

let botsURL = NSURL(string:"\(botBaseURL)/\(bot.botID)?overwriteBlueprint=true")!
let updateRequest = NSMutableURLRequest(URL: botsURL)

updateRequest.HTTPMethod = "PATCH"
updateRequest.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
updateRequest.setValue("4", forHTTPHeaderField: "x-xcsclientversion")
updateRequest.HTTPBody = NSJSONSerialization.dataWithJSONObject(patchDictionary, options: NSJSONWritingOptions.PrettyPrinted)
0
votes

I've posted my full findings on how I finally got this to work, attached to another Stack Overflow question about the same thing.

XCode Bots API configuration edit fails