live_help Notes

assignment_ind This action requires a token resource owner scoped on forum with enough privileges .

settings Params

Param name Description
message_id optional . Must be String

The message id

vote optional , nil allowed . Must be a Hash
vote[user_id] required . Must be Fixnum

The user id. Must be unique in the scope of a given message id and kind.

vote[message_id] required . Must be Fixnum

The message id.

vote[kind] optional , nil allowed . Must be one of: upvote, downvote, trollvote, problem.

The kind.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/votes
{
  "vote": {
    "kind": "upvote",
    "message_id": "5",
    "user_id": "27"
  }
}
201
{
  "id": 20,
  "kind": "upvote",
  "created_at": "2017-03-06T15:20:51.292Z",
  "user": {
    "login": "kiki-adi",
    "id": 27,
    "url": "https://profile.intra.42.fr/users/kiki-adi"
  },
  "message": {
    "id": 5,
    "author": {
      "login": "kiki-adi",
      "id": 27,
      "url": "https://profile.intra.42.fr/users/kiki-adi"
    },
    "content": "3 wolf moon shoreditch kale chips meditation jean shorts thundercats. Neutra vhs pork belly literally. Synth pabst iphone kitsch green juice. Flexitarian intelligentsia pitchfork thundercats art party.\nPork belly twee butcher. Ethical bitters leggings celiac normcore vegan. Narwhal chillwave pabst leggings chambray actually ramps sartorial.\nTrust fund art party single-origin coffee poutine vinegar cleanse. Letterpress ugh fashion axe lumbersexual neutra skateboard synth bitters. Diy pug bicycle rights asymmetrical pitchfork thundercats mumblecore.",
    "content_html": null,
    "replies": [],
    "created_at": "2017-03-06T14:59:38.075Z",
    "updated_at": "2017-03-06T15:20:51.300Z",
    "parent_id": null,
    "is_root": false,
    "messageable_id": 1,
    "messageable_type": "Topic",
    "votes_count": {
      "upvote": 1,
      "downvote": 0,
      "trollvote": 0,
      "problem": 0
    },
    "user_votes": {
      "upvote": false,
      "downvote": false,
      "trollvote": false,
      "problem": false
    },
    "readings": 0
  }
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"vote":{"kind":"upvote","message_id":"5","user_id":"27"}}' "https://api.intra.42.fr/v2/votes"

{
  "id": 20,
  "kind": "upvote",
  "created_at": "2017-03-06T15:20:51.292Z",
  "user": {
    "login": "kiki-adi",
    "id": 27,
    "url": "https://profile.intra.42.fr/users/kiki-adi"
  },
  "message": {
    "id": 5,
    "author": {
      "login": "kiki-adi",
      "id": 27,
      "url": "https://profile.intra.42.fr/users/kiki-adi"
    },
    "content": "3 wolf moon shoreditch kale chips meditation jean shorts thundercats. Neutra vhs pork belly literally. Synth pabst iphone kitsch green juice. Flexitarian intelligentsia pitchfork thundercats art party.\nPork belly twee butcher. Ethical bitters leggings celiac normcore vegan. Narwhal chillwave pabst leggings chambray actually ramps sartorial.\nTrust fund art party single-origin coffee poutine vinegar cleanse. Letterpress ugh fashion axe lumbersexual neutra skateboard synth bitters. Diy pug bicycle rights asymmetrical pitchfork thundercats mumblecore.",
    "content_html": null,
    "replies": [],
    "created_at": "2017-03-06T14:59:38.075Z",
    "updated_at": "2017-03-06T15:20:51.300Z",
    "parent_id": null,
    "is_root": false,
    "messageable_id": 1,
    "messageable_type": "Topic",
    "votes_count": {
      "upvote": 1,
      "downvote": 0,
      "trollvote": 0,
      "problem": 0
    },
    "user_votes": {
      "upvote": false,
      "downvote": false,
      "trollvote": false,
      "problem": false
    },
    "readings": 0
  }
}
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 = {vote: {kind: "upvote", message_id: "5", user_id: "27"}}
response = token.post("/v2/votes", params: params)
response.status
# => 201
response.parsed
# => {"id"=>20, "kind"=>"upvote", "created_at"=>"2017-03-06T15:20:51.292Z", "user"=>{"login"=>"kiki-adi", "id"=>27, "url"=>"https://profile.intra.42.fr/users/kiki-adi"}, "message"=>{"id"=>5, "author"=>{"login"=>"kiki-adi", "id"=>27, "url"=>"https://profile.intra.42.fr/users/kiki-adi"}, "content"=>"3 wolf moon shoreditch kale chips meditation jean shorts thundercats. Neutra vhs pork belly literally. Synth pabst iphone kitsch green juice. Flexitarian intelligentsia pitchfork thundercats art party.\nPork belly twee butcher. Ethical bitters leggings celiac normcore vegan. Narwhal chillwave pabst leggings chambray actually ramps sartorial.\nTrust fund art party single-origin coffee poutine vinegar cleanse. Letterpress ugh fashion axe lumbersexual neutra skateboard synth bitters. Diy pug bicycle rights asymmetrical pitchfork thundercats mumblecore.", "content_html"=>nil, "replies"=>[], "created_at"=>"2017-03-06T14:59:38.075Z", "updated_at"=>"2017-03-06T15:20:51.300Z", "parent_id"=>nil, "is_root"=>false, "messageable_id"=>1, "messageable_type"=>"Topic", "votes_count"=>{"upvote"=>1, "downvote"=>0, "trollvote"=>0, "problem"=>0}, "user_votes"=>{"upvote"=>false, "downvote"=>false, "trollvote"=>false, "problem"=>false}, "readings"=>0}}