Last active
January 13, 2017 10:34
-
-
Save bgwaltney/d16c1252db878e24a223a7538cc1d2e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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