POST /v2/expertises
Create an expertise
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
settings Params
Param name | Description |
---|---|
expertise | optional , nil allowed . Must be a Hash |
expertise[name] |
required
. Must be String
The name. Must be unique. |
expertise[slug] |
required
. Must be String
The slug. |
expertise[kind] |
required
. Must be one of: languages , frameworks , databases , admin_sys , other .
The kind. |
Examples
POST /v2/expertises
{
"expertise": {
"kind": "databases",
"name": "West Virginia frogs"
}
}
201
{
"id": 11,
"name": "West Virginia frogs",
"slug": "west-virginia-frogs",
"url": "https://api.intra.42.fr/v2/expertises/west-virginia-frogs",
"kind": "databases",
"created_at": "2017-11-22T13:43:39.345Z",
"expertises_users_url": "https://api.intra.42.fr/v2/expertises/west-virginia-frogs/expertises_users"
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"expertise":{"kind":"databases","name":"West Virginia frogs"}}' "https://api.intra.42.fr/v2/expertises"
{
"id": 11,
"name": "West Virginia frogs",
"slug": "west-virginia-frogs",
"url": "https://api.intra.42.fr/v2/expertises/west-virginia-frogs",
"kind": "databases",
"created_at": "2017-11-22T13:43:39.345Z",
"expertises_users_url": "https://api.intra.42.fr/v2/expertises/west-virginia-frogs/expertises_users"
}
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 = {expertise: {kind: "databases", name: "West Virginia frogs"}}
response = token.post("/v2/expertises", params: params)
response.status
# => 201
response.parsed
# => {"id"=>11, "name"=>"West Virginia frogs", "slug"=>"west-virginia-frogs", "url"=>"https://api.intra.42.fr/v2/expertises/west-virginia-frogs", "kind"=>"databases", "created_at"=>"2017-11-22T13:43:39.345Z", "expertises_users_url"=>"https://api.intra.42.fr/v2/expertises/west-virginia-frogs/expertises_users"}