live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
flash optional , nil allowed . Must be a Hash
flash[content] required . Must be String

The content.

flash[selector] optional , nil allowed . Must be String

The selector.

flash[identifier] required . Must be String

The identifier.

flash[title] required . Must be String

The title.

flash[url] optional , nil allowed . Must be String

The url.

flash[duration] required . Must be Fixnum

The duration.

POST /v2/flashes
{
  "flash": {
    "title": "Almost the end!",
    "content": "One of our member is leaving us in few days...",
    "identifier": "the_end",
    "duration": 4200
  }
}
201
{
  "id": 53,
  "title": "Almost the end!",
  "content": "One of our member is leaving us in few days...",
  "identifier": "the_end",
  "duration": 4200
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"flash":{"title":"Almost the end!","content":"One of our member is leaving us in few days...","identifier":"the_end","duration":4200}}' "https://api.intra.42.fr/v2/flashes"

{
  "id": 53,
  "title": "Almost the end!",
  "content": "One of our member is leaving us in few days...",
  "identifier": "the_end",
  "duration": 4200
}
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: {title: "Almost the end!", content: "One of our member is leaving us in few days...", identifier: "the_end", duration: 4200}}
response = token.post("/v2/flashes", params: params)
response.status
# => 201
response.parsed
# => {"id"=>53, "title"=>"Almost the end!", "content"=>"One of our member is leaving us in few days...", "identifier"=>"the_end", "duration"=>4200}