live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
tag optional , nil allowed . Must be a Hash
tag[name] required . Must be String

The name. Must be unique.

tag[tags_users_attributes] optional , nil allowed . Must be an Array of nested elements

The tags users attributes.

tag[tags_users_attributes][user_id] required . Must be Fixnum

The user id.

tag[tags_users_attributes][id] optional , nil allowed . Must be Fixnum

The id.

tag[tags_users_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

tag[cursus_ids] optional , nil allowed . Must be an array of Integer

The cursus ids.

POST /v2/tags
{
  "tag": {
    "kind": "general",
    "name": "Legend"
  }
}
201
{
  "id": 18,
  "name": "Legend",
  "kind": "general",
  "users": [],
  "subnotions": []
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"tag":{"kind":"general","name":"Legend"}}' "https://api.intra.42.fr/v2/tags"

{
  "id": 18,
  "name": "Legend",
  "kind": "general",
  "users": [],
  "subnotions": []
}
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 = {tag: {kind: "general", name: "Legend"}}
response = token.post("/v2/tags", params: params)
response.status
# => 201
response.parsed
# => {"id"=>18, "name"=>"Legend", "kind"=>"general", "users"=>[], "subnotions"=>[]}