Skip to content

Instantly share code, notes, and snippets.

@bgwaltney
Last active January 13, 2017 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bgwaltney/d16c1252db878e24a223a7538cc1d2e9 to your computer and use it in GitHub Desktop.
Save bgwaltney/d16c1252db878e24a223a7538cc1d2e9 to your computer and use it in GitHub Desktop.
function createProjectSpecialists(project_name){
var templateID = xxxx;
request({'url': 'https://www.toggl.com/api/v8/projects', //URL to hit
'method': 'POST',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
'auth': {
'user': settings.passwords.toggl_key,
'pass': 'api_token'
},
'json': {
"project":{
"name": project_name,
"wid":xxx,
"template_id": templateID,
"is_private":false
}}
}, function(error, response, body){
if(error) {
console.log(error);
context.done(null, error);
} else {
if(response.statusCode == 200){
console.log(response.statusCode, "toggl specialist project was created");
}
else{
console.log(response.statusCode, "toggl specialist project was NOT created");
}
}
});
} // end of create project function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment