# Add People Group POST https://api.trebellar.app/api/v2/people/groups Content-Type: application/json Reference: https://docs.trebellar.app/api-reference/api-resources/people-groups/add-people-group ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Add People Group version: endpoint_peopleGroups.addPeopleGroup paths: /api/v2/people/groups: post: operationId: add-people-group summary: Add People Group tags: - - subpackage_peopleGroups parameters: - name: X-Trebellar-Api-Key in: header required: true schema: type: string responses: '200': description: Successful people-group inserted content: application/json: schema: $ref: '#/components/schemas/PeopleGroup' '400': description: Bad Request Error content: {} '404': description: Not Found Error content: {} '500': description: Internal Server Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/PeopleGroupInput' components: schemas: PeopleGroupProperties: type: object properties: color: type: string PeopleGroupInput: type: object properties: id: type: string path: type: string parentId: type: string avatarUrl: type: string name: type: string description: type: string properties: $ref: '#/components/schemas/PeopleGroupProperties' externalId: type: string required: - name PeopleGroupPropertiesOutput: type: object properties: color: type: string PeopleGroup: type: object properties: id: type: string path: type: string parentId: type: string avatarUrl: type: string name: type: string description: type: string properties: $ref: '#/components/schemas/PeopleGroupPropertiesOutput' externalId: type: string required: - id - name ``` ## SDK Code Examples ```typescript import { TrebellarApiClient } from "@trebellar/api-sdk"; async function main() { const client = new TrebellarApiClient({ environment: "https://api.trebellar.app", }); await client.peopleGroups.addPeopleGroup({ name: "Engineering Team", parentId: "grp_technology_dept", description: "Software development and infrastructure team", properties: { color: "#2196F3", }, externalId: "DEPT_ENG", }); } main(); ``` ```python from trebellar import TrebellarApi client = TrebellarApi( base_url="https://api.trebellar.app", api_key= ) client.people_groups.add_people_group( name="Engineering Team", parent_id="grp_technology_dept", description="Software development and infrastructure team", properties={ "color": "#2196F3" }, external_id="DEPT_ENG" ) ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.trebellar.app/api/v2/people/groups" payload := strings.NewReader("{\n \"name\": \"Engineering Team\",\n \"parentId\": \"grp_technology_dept\",\n \"description\": \"Software development and infrastructure team\",\n \"properties\": {\n \"color\": \"#2196F3\"\n },\n \"externalId\": \"DEPT_ENG\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-Trebellar-Api-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.trebellar.app/api/v2/people/groups") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-Trebellar-Api-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"Engineering Team\",\n \"parentId\": \"grp_technology_dept\",\n \"description\": \"Software development and infrastructure team\",\n \"properties\": {\n \"color\": \"#2196F3\"\n },\n \"externalId\": \"DEPT_ENG\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.trebellar.app/api/v2/people/groups") .header("X-Trebellar-Api-Key", "") .header("Content-Type", "application/json") .body("{\n \"name\": \"Engineering Team\",\n \"parentId\": \"grp_technology_dept\",\n \"description\": \"Software development and infrastructure team\",\n \"properties\": {\n \"color\": \"#2196F3\"\n },\n \"externalId\": \"DEPT_ENG\"\n}") .asString(); ``` ```php request('POST', 'https://api.trebellar.app/api/v2/people/groups', [ 'body' => '{ "name": "Engineering Team", "parentId": "grp_technology_dept", "description": "Software development and infrastructure team", "properties": { "color": "#2196F3" }, "externalId": "DEPT_ENG" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-Trebellar-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.trebellar.app/api/v2/people/groups"); var request = new RestRequest(Method.POST); request.AddHeader("X-Trebellar-Api-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"Engineering Team\",\n \"parentId\": \"grp_technology_dept\",\n \"description\": \"Software development and infrastructure team\",\n \"properties\": {\n \"color\": \"#2196F3\"\n },\n \"externalId\": \"DEPT_ENG\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-Trebellar-Api-Key": "", "Content-Type": "application/json" ] let parameters = [ "name": "Engineering Team", "parentId": "grp_technology_dept", "description": "Software development and infrastructure team", "properties": ["color": "#2196F3"], "externalId": "DEPT_ENG" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.trebellar.app/api/v2/people/groups")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```