POST /v2/flashes/:flash_id/flash_users
Create a flash user for the given Flash
POST /v2/flash_users
Create a flash user
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
settings Params
Param name | Description |
---|---|
flash_id |
optional
. Must be String
The flash id |
flash_user | optional , nil allowed . Must be a Hash |
flash_user[user_id] |
required
. Must be Fixnum
The user id. |
flash_user[flash_id] |
required
. Must be Fixnum
The flash id. |
flash_user[seen] |
optional
, nil allowed
. Must be one of: true , false .
Is it seen ? Default to false. |
flash_user[end_at] |
optional
, nil allowed
. Must be DateTime
The end at. |
Examples
POST /v2/flashes
{
"flash_user": {
"flash_id": 1,
"user_id": 19265,
"end_at": "2018-07-01T18:40:57.031Z"
}
}
201
{
"id": 166513,
"flash_id": 1,
"seen": false,
"end_at": "2018-07-01T18:40:57.031Z",
"user": {
"id": 19265,
"login": "jgengo",
"url": "http://localhost:13000/v2/users/jgengo"
}
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"flash_user":{"flash_id":1,"user_id":19265,"end_at":"2018-07-01T18:40:57.031Z"}}' "https://api.intra.42.fr/v2/flashes"
{
"id": 166513,
"flash_id": 1,
"seen": false,
"end_at": "2018-07-01T18:40:57.031Z",
"user": {
"id": 19265,
"login": "jgengo",
"url": "http://localhost:13000/v2/users/jgengo"
}
}
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 = {flash_user: {flash_id: 1, user_id: 19265, end_at: "2018-07-01T18:40:57.031Z"}}
response = token.post("/v2/flashes", params: params)
response.status
# => 201
response.parsed
# => {"id"=>166513, "flash_id"=>1, "seen"=>false, "end_at"=>"2018-07-01T18:40:57.031Z", "user"=>{"id"=>19265, "login"=>"jgengo", "url"=>"http://localhost:13000/v2/users/jgengo"}}