用于在特定项目中创建用户故事的拉力API?

时间:2017-05-10 21:19:00

标签: rally

我试过以下代码没有运气

var rally = require('rally'),
    restApi = rally({
        user: 'userName', //required if no api key, defaults to process.env.RALLY_USERNAME
        pass: 'password', //required if no api key, defaults to process.env.RALLY_PASSWORD
        apiKey: 'XXXXX', //preferred, required if no user/pass, defaults to process.env.RALLY_API_KEY
        apiVersion: 'v2.0', //this is the default and may be omitted
        server: 'https://rally1.rallydev.com',  //this is the default and may be omitted
        requestOptions: {
            headers: {
                'X-RallyIntegrationName': 'My cool node.js program',  //while optional, it is good practice to
                'X-RallyIntegrationVendor': 'My company',             //provide this header information
                'X-RallyIntegrationVersion': '1.0'                    
            }
            //any additional request options (proxy options, timeouts, etc.)     
        }
    });

    restApi.create({
    type: 'hierarchicalrequirement', //the type to create
    data: {
        Name: 'RallYUS',
         //the data with which to populate the new object
    },
    fetch: ['FormattedID'],  //the fields to be returned on the created object
    scope: {
        //optional, only required if creating in non-default workspace
        project: 'rally',
        workspace: 'abcd'
    },
    requestOptions: {} //optional additional options to pass through to request
}, function(error, result) {
    if(error) {
        console.log(error);
    } else {
        console.log(result.Object);
    }
});

我能够创建一个美国但是在另一个项目中。我一直在尝试修复项目问题,事件也输入了ObjectID和Object UUID,但仍然在附加到用户配置文件的默认项目中继续创建。任何帮助强制用户使用层次关系创建美国肯定有帮助

1 个答案:

答案 0 :(得分:0)

使用Web Services API中的refs指定所有对象关系。这应该有效:

scope: {
    project: '/project/12345' //where 12345 is the object id
}