{"_id":"54ab036defb39016009e4d85","editedParams2":true,"version":{"_id":"54343531bfaa3d0800c4d4af","project":"54343170fa5527080064f449","__v":27,"forked_from":"54343170fa5527080064f44c","createdAt":"2014-10-07T18:47:13.086Z","releaseDate":"2014-10-07T18:47:13.086Z","categories":["54343531bfaa3d0800c4d4b0","543435b1edce040800409240","543435b9edce040800409241","543435bcedce040800409243","543435bfedce040800409244","543435c2edce040800409245","54370cc426469424002a6dfa","54370cf026469424002a6dfd","5437129d26469424002a6e2f","543712d226469424002a6e30","5480c8fd74904f1a00053c86","54aafc6eefb39016009e4d71","54ac1d36de18cc1400226e01","54ad59369219922100751732","54b41bcf4f25cb1600518d2c","54b533a3a806f40c0050d53c","54b54bbf96fe3c0b00d38d2a","54b688a27379a90c00f53a8a","54b699efbc1a46160005edfa","54b8191691011f0b00068804","54bfb002d03bfc0d0000e814","54bfb33ed03bfc0d0000e816","55a3e94e912a6e2300882cdb","55a56c370f354f0d00fd02a8","55e85ad034516037002e9325","5638ecb62fc5520d001a4cf9","572cba2fc310640e008f63d5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3.0"},"project":"54343170fa5527080064f449","editedParams":true,"user":"54343147fa5527080064f43f","parentDoc":null,"__v":1,"category":{"_id":"543435bfedce040800409244","__v":13,"pages":["543493365b10711400c6c48e","54349a445b10711400c6c515","5434a0fe0ef9c008001652ed","54aafac199f6581600167c9a","54ab036defb39016009e4d85","54ab09c699f6581600167cc4","54ab6a8499f6581600167d42","54abf047ec3be11400c8af25","54abfcf2de18cc1400226dbc","54abfe45ec3be11400c8af64","54ac0037de18cc1400226dc7","54c6a0d5f2ab9319008e81aa","54d52803ba860f0d003de534"],"project":"54343170fa5527080064f449","version":"54343531bfaa3d0800c4d4af","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-07T18:49:35.512Z","from_sync":false,"order":3,"slug":"projects","title":"Projects"},"updates":["54c65baf2b94bb19003d3404"],"next":{"pages":[],"description":""},"createdAt":"2015-01-05T21:34:37.788Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":204,"language":"json","code":"// Success\n{}","name":""}]},"method":"post","auth":"required","params":[{"_id":"54ab036defb39016009e4d88","ref":"","in":"path","required":true,"desc":"The id of the project","default":"","type":"string","name":"projectId"},{"_id":"54ab036defb39016009e4d87","ref":"","in":"path","required":true,"desc":"The id of the user","default":"","type":"string","name":"userId"},{"_id":"54ab036defb39016009e4d86","ref":"","in":"path","required":true,"desc":"The id of the roleTemplate to be used","default":"","type":"string","name":"roleTemplateId"}],"url":"/projects/:projectId/users/:userId/roletemplates/:roleTemplateId"},"isReference":false,"order":5,"body":"Adding an existing user to a project requires the projectId, userId, and the roleTemplateId. It's likely that this call is preceded by a call to retrieve all users and all roles templates.\n\nBefore adding an existing user to a project, we likely need to retrieve a list of all users to populate a drop down menu.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v3/users/\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nAlternatively, we could search based on a users name, such as:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Search by username\\nGET v3/users/?userName=myname\\n\\n// Search by last name\\nGET v3/users/?lastName=mylastname\\n\\n// Search by first name\\nGET v3/users/?firstName=firstname\\n\\n// Search by email\\nGET v3/users/?email=email\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nThe returning data set includes an array of user objects including a users defaultRoleTemplateId.\n\nIt is also possible to assign a user a different role than the default role by first retrieving a list of all roleTemplates:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Retrieve a list of all templates \\nGET /v3/roletemplates\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Permissions\"\n}\n[/block]\nA user must be a PROJECT OWNER to add or invite users to a project. Users with an account-level role of ADMINISTRATOR can add or invite users to any project.","excerpt":"Adds an existing user to a project with a specific role.","slug":"add-user-to-project","type":"endpoint","title":"Add User to Project"}

postAdd User to Project

Adds an existing user to a project with a specific role.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

projectId:
required
string
The id of the project
userId:
required
string
The id of the user
roleTemplateId:
required
string
The id of the roleTemplate to be used

Result Format


Documentation

Adding an existing user to a project requires the projectId, userId, and the roleTemplateId. It's likely that this call is preceded by a call to retrieve all users and all roles templates. Before adding an existing user to a project, we likely need to retrieve a list of all users to populate a drop down menu. [block:code] { "codes": [ { "code": "GET /v3/users/", "language": "json" } ] } [/block] Alternatively, we could search based on a users name, such as: [block:code] { "codes": [ { "code": "// Search by username\nGET v3/users/?userName=myname\n\n// Search by last name\nGET v3/users/?lastName=mylastname\n\n// Search by first name\nGET v3/users/?firstName=firstname\n\n// Search by email\nGET v3/users/?email=email", "language": "json" } ] } [/block] The returning data set includes an array of user objects including a users defaultRoleTemplateId. It is also possible to assign a user a different role than the default role by first retrieving a list of all roleTemplates: [block:code] { "codes": [ { "code": "// Retrieve a list of all templates \nGET /v3/roletemplates", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Permissions" } [/block] A user must be a PROJECT OWNER to add or invite users to a project. Users with an account-level role of ADMINISTRATOR can add or invite users to any project.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}