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, mandatory, optional, social.

The kind.

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

The internal name.

quest[duration] optional , nil allowed . 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[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[parent_id] optional , nil allowed . Must be String

The parent id.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/quests
{
  "quest": {
    "campus_id": "",
    "cursus_id": "2",
    "description": "You must take a coffee.",
    "grade_id": "7",
    "internal_name": "TakeACoffee",
    "kind": "main",
    "mails": [
      "You didn't take a coffee on time..."
    ],
    "name": "Take a coffee ☕️",
    "position": "1"
  }
}
201
{
  "id": 5,
  "name": "Take a coffee ☕️",
  "slug": "take-a-coffee",
  "kind": "main",
  "internal_name": "TakeACoffee",
  "description": "You must take a coffee.",
  "cursus_id": 2,
  "campus_id": null,
  "created_at": "2017-03-06T15:20:29.754Z",
  "updated_at": "2017-03-06T15:20:29.754Z",
  "grade_id": 7,
  "position": 1,
  "guild_size": null,
  "guild_prct": null,
  "mails": [
    "You didn't take a coffee on time..."
  ],
  "duration": null,
  "ancestry": null,
  "grade": {
    "id": 7,
    "name": "Commodore",
    "created_at": "2017-03-06T14:58:44.532Z",
    "updated_at": "2017-03-06T15:20:29.764Z",
    "cursus_id": 1,
    "is_primary": null,
    "position": null
  },
  "cursus": {
    "id": 2,
    "created_at": "2017-03-06T14:58:44.047Z",
    "name": "42",
    "slug": "42"
  },
  "campus": null
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"quest":{"campus_id":"","cursus_id":"2","description":"You must take a coffee.","grade_id":"7","internal_name":"TakeACoffee","kind":"main","mails":["You didn't take a coffee on time..."],"name":"Take a coffee ☕️","position":"1"}}' "https://api.intra.42.fr/v2/quests"

{
  "id": 5,
  "name": "Take a coffee ☕️",
  "slug": "take-a-coffee",
  "kind": "main",
  "internal_name": "TakeACoffee",
  "description": "You must take a coffee.",
  "cursus_id": 2,
  "campus_id": null,
  "created_at": "2017-03-06T15:20:29.754Z",
  "updated_at": "2017-03-06T15:20:29.754Z",
  "grade_id": 7,
  "position": 1,
  "guild_size": null,
  "guild_prct": null,
  "mails": [
    "You didn't take a coffee on time..."
  ],
  "duration": null,
  "ancestry": null,
  "grade": {
    "id": 7,
    "name": "Commodore",
    "created_at": "2017-03-06T14:58:44.532Z",
    "updated_at": "2017-03-06T15:20:29.764Z",
    "cursus_id": 1,
    "is_primary": null,
    "position": null
  },
  "cursus": {
    "id": 2,
    "created_at": "2017-03-06T14:58:44.047Z",
    "name": "42",
    "slug": "42"
  },
  "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: {campus_id: "", cursus_id: "2", description: "You must take a coffee.", grade_id: "7", internal_name: "TakeACoffee", kind: "main", mails: ["You didn't take a coffee on time..."], name: "Take a coffee ☕️", position: "1"}}
response = token.post("/v2/quests", params: params)
response.status
# => 201
response.parsed
# => {"id"=>5, "name"=>"Take a coffee ☕️", "slug"=>"take-a-coffee", "kind"=>"main", "internal_name"=>"TakeACoffee", "description"=>"You must take a coffee.", "cursus_id"=>2, "campus_id"=>nil, "created_at"=>"2017-03-06T15:20:29.754Z", "updated_at"=>"2017-03-06T15:20:29.754Z", "grade_id"=>7, "position"=>1, "guild_size"=>nil, "guild_prct"=>nil, "mails"=>["You didn't take a coffee on time..."], "duration"=>nil, "ancestry"=>nil, "grade"=>{"id"=>7, "name"=>"Commodore", "created_at"=>"2017-03-06T14:58:44.532Z", "updated_at"=>"2017-03-06T15:20:29.764Z", "cursus_id"=>1, "is_primary"=>nil, "position"=>nil}, "cursus"=>{"id"=>2, "created_at"=>"2017-03-06T14:58:44.047Z", "name"=>"42", "slug"=>"42"}, "campus"=>nil}