live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
quest optional , nil allowed . Must be a Hash
quest[id] optional , nil allowed . Must be Fixnum

The id.

quest[name] required . Must be String

The name.

quest[slug] optional , nil allowed . Must be String

The slug.

quest[kind] required . Must be one of: main, optional, mandatory, repeatable.

The kind.

quest[internal_name] optional , nil allowed . Must be String

The internal name.

quest[duration] required . Must be Fixnum

The duration.

quest[ancestry] optional , nil allowed . Must be String

The ancestry.

quest[description] required . Must be String

The description.

quest[guild_size] optional , nil allowed . Must be Fixnum

The guild size.

quest[guild_prct] optional , nil allowed . Must be Fixnum

The guild prct.

quest[cursus_id] required . Must be Fixnum

The cursus id.

quest[campus_id] optional , nil allowed . Must be Fixnum

The campus id.

quest[certificate_id] optional , nil allowed . Must be Fixnum

The certificate id.

quest[created_at] optional , nil allowed . Must be DateTime

The created at.

quest[updated_at] optional , nil allowed . Must be DateTime

The updated at.

quest[grade_id] optional , nil allowed . Must be Fixnum

The grade id.

quest[position] optional , nil allowed . Must be Fixnum

The position.

quest[tries_number] required . Must be Fixnum

The tries number.

quest[success_number] required . Must be Fixnum

The success number.

quest[close_on_fail] optional , nil allowed . Must be one of: true, false.

Is it close on fail ?

quest[mails_from] required . Must be String

The mails from.

quest[parent_id] optional , nil allowed . Must be String

The parent id.

POST /v2/quests
{
  "quest": {
    "close_on_fail": "",
    "cursus_id": "1",
    "description": "You must take a coffee.",
    "kind": "main",
    "mails": "",
    "mails_from": "",
    "name": "Take a coffee ☕️",
    "success_number": "",
    "tries_number": ""
  }
}
201
{
  "id": 2,
  "name": "Take a coffee ☕️",
  "slug": "take-a-coffee",
  "kind": "main",
  "internal_name": null,
  "description": "You must take a coffee.",
  "cursus_id": 1,
  "campus_id": null,
  "created_at": "2017-11-22T13:43:57.270Z",
  "updated_at": "2017-11-22T13:43:57.270Z",
  "grade_id": null,
  "position": 2,
  "guild_size": null,
  "guild_prct": null,
  "mails": null,
  "duration": null,
  "ancestry": null,
  "grade": null,
  "cursus": {
    "id": 1,
    "created_at": "2017-11-22T13:41:00.750Z",
    "name": "Piscine C",
    "slug": "piscine-c"
  },
  "campus": null
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"quest":{"close_on_fail":"","cursus_id":"1","description":"You must take a coffee.","kind":"main","mails":"","mails_from":"","name":"Take a coffee ☕️","success_number":"","tries_number":""}}' "https://api.intra.42.fr/v2/quests"

{
  "id": 2,
  "name": "Take a coffee ☕️",
  "slug": "take-a-coffee",
  "kind": "main",
  "internal_name": null,
  "description": "You must take a coffee.",
  "cursus_id": 1,
  "campus_id": null,
  "created_at": "2017-11-22T13:43:57.270Z",
  "updated_at": "2017-11-22T13:43:57.270Z",
  "grade_id": null,
  "position": 2,
  "guild_size": null,
  "guild_prct": null,
  "mails": null,
  "duration": null,
  "ancestry": null,
  "grade": null,
  "cursus": {
    "id": 1,
    "created_at": "2017-11-22T13:41:00.750Z",
    "name": "Piscine C",
    "slug": "piscine-c"
  },
  "campus": null
}
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 = {quest: {close_on_fail: "", cursus_id: "1", description: "You must take a coffee.", kind: "main", mails: "", mails_from: "", name: "Take a coffee ☕️", success_number: "", tries_number: ""}}
response = token.post("/v2/quests", params: params)
response.status
# => 201
response.parsed
# => {"id"=>2, "name"=>"Take a coffee ☕️", "slug"=>"take-a-coffee", "kind"=>"main", "internal_name"=>nil, "description"=>"You must take a coffee.", "cursus_id"=>1, "campus_id"=>nil, "created_at"=>"2017-11-22T13:43:57.270Z", "updated_at"=>"2017-11-22T13:43:57.270Z", "grade_id"=>nil, "position"=>2, "guild_size"=>nil, "guild_prct"=>nil, "mails"=>nil, "duration"=>nil, "ancestry"=>nil, "grade"=>nil, "cursus"=>{"id"=>1, "created_at"=>"2017-11-22T13:41:00.750Z", "name"=>"Piscine C", "slug"=>"piscine-c"}, "campus"=>nil}