I'm trying to consume the vso-node-api, and I want to automatically set the backlog iteration for a team that I've created fresh using the API previously.
I'm having some trouble using the updateTeamSettings
in the WorkApi
:
updateTeamSettings(teamSettingsPatch: WorkInterfaces.TeamSettingsPatch, teamContext: TfsCoreInterfaces.TeamContext): Promise<WorkInterfaces.TeamSetting>;
As you see here, I need to provide a teamSettingsPatch
object and a teamContext
object. I've already figured out teamContext
and have used it successfully in other calls, but I can't seem to provide a teamSettingsPatch
object that causes the API to return a successful response. So far I get 400 Bad Request
and an empty object in return ({ }
) for everything I've tried. (Edit: This empty object and bad request was due to a bug in my own wrapper code, what you'll really get with a TeamSettingsUpdate that isn't successful is a settings object returned with values that weren't changed as you'd expect).
WorkInterfaces.ts indicates that I need to provide an object like this:
/**
* Data contract for what we expect to receive when PATCH
*/
export interface TeamSettingsPatch {
backlogIteration: string;
backlogVisibilities: { [key: string] : boolean; };
bugsBehavior: BugsBehavior;
defaultIteration: string;
defaultIterationMacro: string;
workingDays: SystemInterfaces.DayOfWeek[];
}
I've tried to provide an object like this. In my previous experiences, the vso-node-api
wants all properties to be defined whether or not their values are filled with anything, so first I tried this:
{
backlogIteration: 'Backlog-Iteration-Name',
backlogVisibilities: { },
bugsBehavior: null,
defaultIteration: null,
defaultIterationMacro: '@currentIteration',
workingDays: [
1,
2,
3,
4,
5
]
}
However, I still get the Bad Request message when I try this.
I've also tried to use the getTeamSettings
call to attempt to figure out what the API wants for the TeamSettingsPatch
object, and I've tried to fill in everything possible including values that are already being shown to me from getTeamSettings
. Note that the zeroed GUID is exactly what getTeamSettings
gives me:
{
backlogIteration: {
id: '00000000-0000-0000-0000-000000000000'
},
backlogVisibilities: {
'Custom.1f38c336-f308-41a6-adaa-eb78c0f72dd5': false,
'Microsoft.FeatureCategory': true,
'Microsoft.EpicCategory': false,
'Microsoft.RequirementCategory': true
},
bugsBehavior: 2,
defaultIteration: null,
defaultIterationMacro: '@currentIteration',
workingDays: [
1,
2,
3,
4,
5
]
}
I'm at a bit of a loss. Is it not working because I'm providing a bad object in my request, or is it not working because this API functionality isn't working yet? The response from the API isn't providing any hints, just an empty object and a 400 error.