I am trying to create a label with a custom id using the node library for the Gmail API. The API has a request parameter for setting your own id however when I try to create the label I get the error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Invalid request"
}
],
"code": 400,
"message": "Invalid request"
}
}
The label is created with no problems when I don't give an id. However for my purposes I need to have a set standard label id. Anyone know what is going on here or if it is just a bug/error with the api? You can try creating your own label for your account and see more of what I am talking about here: https://developers.google.com/apis-explorer/#p/gmail/v1/gmail.users.labels.create
Code to create label:
var service = Google.gmail({version : 'v1', auth : oauth2Client});
service.users.labels.create({
userId : 'user address here',
labelListVisibility : 'labelShow',
messageListVisibility : 'show',
name : 'label name here',
id : 'label id here'
}, function (err) {
if (err) {
throw err;
} else {
callback();
}
});
Thanks!