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": "14",
    "user_id": "114"
  }
}
201
{
  "id": 32,
  "kind": "upvote",
  "created_at": "2017-11-22T13:44:20.075Z",
  "user": {
    "login": "darmaul",
    "id": 114,
    "url": "https://profile.intra.42.fr/users/darmaul"
  },
  "message": {
    "id": 14,
    "author": {
      "login": "lukeskyw",
      "id": 107,
      "url": "https://profile.intra.42.fr/users/lukeskyw"
    },
    "content": "Cold-pressed helvetica viral twee vegan artisan. Kickstarter kombucha kinfolk. Marfa banjo plaid cardigan asymmetrical ugh listicle etsy. Mustache banh mi 8-bit williamsburg heirloom franzen authentic swag.\nLeggings marfa photo booth plaid bicycle rights pour-over. Hammock xoxo vinyl vhs park vice. Hella slow-carb gentrify lumbersexual yr farm-to-table. Etsy wayfarers venmo jean shorts fingerstache roof portland hella. Small batch +1 neutra kogi kale chips forage cardigan.\nSriracha celiac cardigan crucifix bushwick franzen. Yolo bitters kogi. Gastropub franzen 3 wolf moon meditation.",
    "content_html": null,
    "replies": [],
    "created_at": "2017-11-22T13:42:14.300Z",
    "updated_at": "2017-11-22T13:44:20.081Z",
    "parent_id": null,
    "is_root": false,
    "messageable_id": 2,
    "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":"14","user_id":"114"}}' "https://api.intra.42.fr/v2/votes"

{
  "id": 32,
  "kind": "upvote",
  "created_at": "2017-11-22T13:44:20.075Z",
  "user": {
    "login": "darmaul",
    "id": 114,
    "url": "https://profile.intra.42.fr/users/darmaul"
  },
  "message": {
    "id": 14,
    "author": {
      "login": "lukeskyw",
      "id": 107,
      "url": "https://profile.intra.42.fr/users/lukeskyw"
    },
    "content": "Cold-pressed helvetica viral twee vegan artisan. Kickstarter kombucha kinfolk. Marfa banjo plaid cardigan asymmetrical ugh listicle etsy. Mustache banh mi 8-bit williamsburg heirloom franzen authentic swag.\nLeggings marfa photo booth plaid bicycle rights pour-over. Hammock xoxo vinyl vhs park vice. Hella slow-carb gentrify lumbersexual yr farm-to-table. Etsy wayfarers venmo jean shorts fingerstache roof portland hella. Small batch +1 neutra kogi kale chips forage cardigan.\nSriracha celiac cardigan crucifix bushwick franzen. Yolo bitters kogi. Gastropub franzen 3 wolf moon meditation.",
    "content_html": null,
    "replies": [],
    "created_at": "2017-11-22T13:42:14.300Z",
    "updated_at": "2017-11-22T13:44:20.081Z",
    "parent_id": null,
    "is_root": false,
    "messageable_id": 2,
    "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: "14", user_id: "114"}}
response = token.post("/v2/votes", params: params)
response.status
# => 201
response.parsed
# => {"id"=>32, "kind"=>"upvote", "created_at"=>"2017-11-22T13:44:20.075Z", "user"=>{"login"=>"darmaul", "id"=>114, "url"=>"https://profile.intra.42.fr/users/darmaul"}, "message"=>{"id"=>14, "author"=>{"login"=>"lukeskyw", "id"=>107, "url"=>"https://profile.intra.42.fr/users/lukeskyw"}, "content"=>"Cold-pressed helvetica viral twee vegan artisan. Kickstarter kombucha kinfolk. Marfa banjo plaid cardigan asymmetrical ugh listicle etsy. Mustache banh mi 8-bit williamsburg heirloom franzen authentic swag.\nLeggings marfa photo booth plaid bicycle rights pour-over. Hammock xoxo vinyl vhs park vice. Hella slow-carb gentrify lumbersexual yr farm-to-table. Etsy wayfarers venmo jean shorts fingerstache roof portland hella. Small batch +1 neutra kogi kale chips forage cardigan.\nSriracha celiac cardigan crucifix bushwick franzen. Yolo bitters kogi. Gastropub franzen 3 wolf moon meditation.", "content_html"=>nil, "replies"=>[], "created_at"=>"2017-11-22T13:42:14.300Z", "updated_at"=>"2017-11-22T13:44:20.081Z", "parent_id"=>nil, "is_root"=>false, "messageable_id"=>2, "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}}