-
-
Save refiito/d275eb14028cef6b2bc969e63d8faff9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/v9/workspaces/xxx/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, <-- not needed here, move to the part of the URL | |
"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"); | |
console.log(body) | |
} | |
} | |
}); | |
} // end of create project function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment