POST /v2/groups
Create a group
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
settings Params
Param name | Description |
---|---|
group | optional , nil allowed . Must be a Hash |
group[name] |
required
. Must be String
The name. |
group[color] |
required
. Must be String
The color. |
group[important] |
optional
, nil allowed
. Must be one of: true , false .
Is it important ? Default to false. |
Examples
POST /v2/groups
{
"group": {
"color": "#ed5462",
"important": "true",
"name": "tigers"
}
}
201
{
"id": 5,
"name": "tigers"
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"group":{"color":"#ed5462","important":"true","name":"tigers"}}' "https://api.intra.42.fr/v2/groups"
{
"id": 5,
"name": "tigers"
}
require "oauth2"
UID = "Your application uid"
SECRET = "Your application secret"
client = OAuth2::Client.new(UID, SECRET, site: "https://api.intra.42.fr")
token = client.client_credentials.get_token
params = {group: {color: "#ed5462", important: "true", name: "tigers"}}
response = token.post("/v2/groups", params: params)
response.status
# => 201
response.parsed
# => {"id"=>5, "name"=>"tigers"}