live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
quests_user optional , nil allowed . Must be a Hash
quests_user[quest_id] required . Must be Fixnum

The quest id. Must be unique in the scope of a given user.

quests_user[user_id] required . Must be Fixnum

The user id.

quests_user[end_at] optional , nil allowed . Must be DateTime

The end at.

quests_user[validated_at] optional , nil allowed . Must be DateTime

The validated at.

quests_user[prct] optional , nil allowed . Must be Fixnum

The prct.

quests_user[advancement] optional , nil allowed . Must be String

The advancement.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/quests_users
{
  "quests_user": {
    "end_at": "2017-03-08 15:19:52 UTC",
    "prct": "42",
    "quest_id": "2",
    "user_id": "54"
  }
}
201
{
  "id": 16,
  "end_at": "2017-03-08T15:19:52.000Z",
  "quest_id": 2,
  "validated_at": null,
  "prct": 42,
  "advancement": null,
  "created_at": "2017-03-06T15:20:30.663Z",
  "updated_at": "2017-03-06T15:20:30.663Z",
  "user": {
    "id": 54,
    "login": "jhutt",
    "url": "https://api.intra.42.fr/v2/users/jhutt"
  },
  "quest": {
    "id": 2,
    "name": "Level 7",
    "slug": "level-7",
    "kind": "mandatory",
    "internal_name": null,
    "description": "Reach the level 7.",
    "cursus_id": 1,
    "campus_id": null,
    "created_at": "2017-03-06T14:59:36.694Z",
    "updated_at": "2017-03-06T14:59:36.694Z",
    "grade_id": null,
    "position": 2,
    "guild_size": null,
    "guild_prct": null,
    "mails": null,
    "duration": null,
    "ancestry": null
  }
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"quests_user":{"end_at":"2017-03-08 15:19:52 UTC","prct":"42","quest_id":"2","user_id":"54"}}' "https://api.intra.42.fr/v2/quests_users"

{
  "id": 16,
  "end_at": "2017-03-08T15:19:52.000Z",
  "quest_id": 2,
  "validated_at": null,
  "prct": 42,
  "advancement": null,
  "created_at": "2017-03-06T15:20:30.663Z",
  "updated_at": "2017-03-06T15:20:30.663Z",
  "user": {
    "id": 54,
    "login": "jhutt",
    "url": "https://api.intra.42.fr/v2/users/jhutt"
  },
  "quest": {
    "id": 2,
    "name": "Level 7",
    "slug": "level-7",
    "kind": "mandatory",
    "internal_name": null,
    "description": "Reach the level 7.",
    "cursus_id": 1,
    "campus_id": null,
    "created_at": "2017-03-06T14:59:36.694Z",
    "updated_at": "2017-03-06T14:59:36.694Z",
    "grade_id": null,
    "position": 2,
    "guild_size": null,
    "guild_prct": null,
    "mails": null,
    "duration": null,
    "ancestry": 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 = {quests_user: {end_at: "2017-03-08 15:19:52 UTC", prct: "42", quest_id: "2", user_id: "54"}}
response = token.post("/v2/quests_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>16, "end_at"=>"2017-03-08T15:19:52.000Z", "quest_id"=>2, "validated_at"=>nil, "prct"=>42, "advancement"=>nil, "created_at"=>"2017-03-06T15:20:30.663Z", "updated_at"=>"2017-03-06T15:20:30.663Z", "user"=>{"id"=>54, "login"=>"jhutt", "url"=>"https://api.intra.42.fr/v2/users/jhutt"}, "quest"=>{"id"=>2, "name"=>"Level 7", "slug"=>"level-7", "kind"=>"mandatory", "internal_name"=>nil, "description"=>"Reach the level 7.", "cursus_id"=>1, "campus_id"=>nil, "created_at"=>"2017-03-06T14:59:36.694Z", "updated_at"=>"2017-03-06T14:59:36.694Z", "grade_id"=>nil, "position"=>2, "guild_size"=>nil, "guild_prct"=>nil, "mails"=>nil, "duration"=>nil, "ancestry"=>nil}}