POST /v2/dashes
Create a dash
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
settings Params
Param name | Description |
---|---|
dash | optional , nil allowed . Must be a Hash |
dash[name] |
required
. Must be String
The name. Must be unique in the scope of a given cursus. |
dash[description] |
required
. Must be String
The description. |
dash[slug] |
optional
, nil allowed
. Must be String
The slug. |
dash[cursus_id] |
required
. Must be Fixnum
The cursus id. |
dash[campus_id] |
required
. Must be Fixnum
The campus id. |
dash[skill_id] |
required
. Must be Fixnum
The skill id. |
dash[nbr_xp] |
required
. Must be String
The nbr xp. |
dash[begin_at] |
required
. Must be Fixnum
The begin at. Must be after today. |
dash[duration] |
required
. Must be Fixnum
The duration. |
Examples
POST /v2/dashes
{
"dash": {
"begin_at": "2017-11-25 13:43:35 UTC",
"campus_id": "2",
"cursus_id": "1",
"description": "Le sujet dbon courage!",
"duration": "20",
"name": "Dashname",
"nbr_xp": "20",
"skill_id": "3",
"slug": "dashname"
}
}
201
{
"id": 2,
"name": "Dashname",
"description": "Le sujet dbon courage!",
"slug": "dashname",
"cursus_id": 1,
"campus_id": 2,
"skill_id": 3,
"nbr_xp": "20",
"begin_at": "2017-11-25T13:43:35.000Z",
"end_at": "2017-11-25T14:03:35.000Z"
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"dash":{"begin_at":"2017-11-25 13:43:35 UTC","campus_id":"2","cursus_id":"1","description":"Le sujet dbon courage!","duration":"20","name":"Dashname","nbr_xp":"20","skill_id":"3","slug":"dashname"}}' "https://api.intra.42.fr/v2/dashes"
{
"id": 2,
"name": "Dashname",
"description": "Le sujet dbon courage!",
"slug": "dashname",
"cursus_id": 1,
"campus_id": 2,
"skill_id": 3,
"nbr_xp": "20",
"begin_at": "2017-11-25T13:43:35.000Z",
"end_at": "2017-11-25T14:03:35.000Z"
}
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 = {dash: {begin_at: "2017-11-25 13:43:35 UTC", campus_id: "2", cursus_id: "1", description: "Le sujet dbon courage!", duration: "20", name: "Dashname", nbr_xp: "20", skill_id: "3", slug: "dashname"}}
response = token.post("/v2/dashes", params: params)
response.status
# => 201
response.parsed
# => {"id"=>2, "name"=>"Dashname", "description"=>"Le sujet dbon courage!", "slug"=>"dashname", "cursus_id"=>1, "campus_id"=>2, "skill_id"=>3, "nbr_xp"=>"20", "begin_at"=>"2017-11-25T13:43:35.000Z", "end_at"=>"2017-11-25T14:03:35.000Z"}