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.

POST /v2/quests_users
{
  "quests_user": {
    "end_at": "2017-11-24 13:43:10 UTC",
    "prct": "42",
    "quest_id": "4",
    "user_id": "117"
  }
}
201
{
  "id": 6,
  "end_at": "2017-11-24T13:43:10.000Z",
  "quest_id": 4,
  "validated_at": null,
  "prct": 42,
  "advancement": null,
  "created_at": "2017-11-22T13:43:58.265Z",
  "updated_at": "2017-11-22T13:43:58.265Z",
  "user": {
    "id": 117,
    "login": "leiorgan",
    "url": "https://api.intra.42.fr/v2/users/leiorgan"
  },
  "quest": {
    "id": 4,
    "name": "Take a coffee ☕️",
    "slug": "take-a-coffee",
    "kind": "main",
    "internal_name": null,
    "description": "You must take a coffee.",
    "cursus_id": 2,
    "campus_id": null,
    "created_at": "2017-11-22T13:43:58.221Z",
    "updated_at": "2017-11-22T13:43:58.221Z",
    "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-11-24 13:43:10 UTC","prct":"42","quest_id":"4","user_id":"117"}}' "https://api.intra.42.fr/v2/quests_users"

{
  "id": 6,
  "end_at": "2017-11-24T13:43:10.000Z",
  "quest_id": 4,
  "validated_at": null,
  "prct": 42,
  "advancement": null,
  "created_at": "2017-11-22T13:43:58.265Z",
  "updated_at": "2017-11-22T13:43:58.265Z",
  "user": {
    "id": 117,
    "login": "leiorgan",
    "url": "https://api.intra.42.fr/v2/users/leiorgan"
  },
  "quest": {
    "id": 4,
    "name": "Take a coffee ☕️",
    "slug": "take-a-coffee",
    "kind": "main",
    "internal_name": null,
    "description": "You must take a coffee.",
    "cursus_id": 2,
    "campus_id": null,
    "created_at": "2017-11-22T13:43:58.221Z",
    "updated_at": "2017-11-22T13:43:58.221Z",
    "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-11-24 13:43:10 UTC", prct: "42", quest_id: "4", user_id: "117"}}
response = token.post("/v2/quests_users", params: params)
response.status
# => 201
response.parsed
# => {"id"=>6, "end_at"=>"2017-11-24T13:43:10.000Z", "quest_id"=>4, "validated_at"=>nil, "prct"=>42, "advancement"=>nil, "created_at"=>"2017-11-22T13:43:58.265Z", "updated_at"=>"2017-11-22T13:43:58.265Z", "user"=>{"id"=>117, "login"=>"leiorgan", "url"=>"https://api.intra.42.fr/v2/users/leiorgan"}, "quest"=>{"id"=>4, "name"=>"Take a coffee ☕️", "slug"=>"take-a-coffee", "kind"=>"main", "internal_name"=>nil, "description"=>"You must take a coffee.", "cursus_id"=>2, "campus_id"=>nil, "created_at"=>"2017-11-22T13:43:58.221Z", "updated_at"=>"2017-11-22T13:43:58.221Z", "grade_id"=>nil, "position"=>2, "guild_size"=>nil, "guild_prct"=>nil, "mails"=>nil, "duration"=>nil, "ancestry"=>nil}}