Search code examples
ibm-cloud-infrastructure

How to add bulk hardware access in softlayer using API and nodejs


I have below code to add bulk hardware access in softlayer using API and nodejs:

slClient
    .auth(slUserID, slApiKey)
    .path('User_Customer', userID, 'addBulkHardwareAccess',{"hardwareIds":["XXXXX,XXXXXXX"]})
    .post()
    .then(res => {
        resolve(res);
    })
    .catch(err => {
        reject(err);
    });   
};

But it gives error: TypeError: Cannot read property 'constructor' of undefined


Solution

  • There is parameters() method to provide parameters.

    slClient
        .auth(slUserID, slApiKey)
        .path('User_Customer', args.userID, 'addBulkHardwareAccess')
        .parameters([[XXXXXX,XXXXXXXXXX]])
        .post()
        .then(res => {
            resolve(res);
        })
        .catch(err => {
            reject(err);
        });