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": "4",
    "user_id": "79"
  }
}
201
{
  "id": 35,
  "kind": "upvote",
  "created_at": "2017-11-21T17:32:40.291Z",
  "user": {
    "login": "paamidal",
    "id": 79,
    "url": "https://profile.intra.42.fr/users/paamidal"
  },
  "message": {
    "id": 4,
    "author": {
      "login": "watwatto",
      "id": 81,
      "url": "https://profile.intra.42.fr/users/watwatto"
    },
    "content": "Ennui pitchfork green juice letterpress pop-up. Taxidermy irony semiotics meh lo-fi yuccie ennui aesthetic. Chambray truffaut selfies ugh gastropub goth migas. Locavore etsy paleo street offal fingerstache.\nAesthetic cardigan brooklyn art party. Heirloom fanny pack polaroid tumblr cliche migas keytar. Ramps single-origin coffee quinoa. Ramps kogi williamsburg. Kitsch distillery art party godard ennui sartorial retro.\nBlue bottle direct trade deep v venmo. Direct trade literally goth sriracha typewriter. Hella hoodie ramps gluten-free freegan. Post-ironic food truck craft beer butcher flexitarian pickled tattooed.",
    "content_html": null,
    "replies": [],
    "created_at": "2017-11-21T17:09:50.566Z",
    "updated_at": "2017-11-21T17:32:40.297Z",
    "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":"4","user_id":"79"}}' "https://api.intra.42.fr/v2/votes"

{
  "id": 35,
  "kind": "upvote",
  "created_at": "2017-11-21T17:32:40.291Z",
  "user": {
    "login": "paamidal",
    "id": 79,
    "url": "https://profile.intra.42.fr/users/paamidal"
  },
  "message": {
    "id": 4,
    "author": {
      "login": "watwatto",
      "id": 81,
      "url": "https://profile.intra.42.fr/users/watwatto"
    },
    "content": "Ennui pitchfork green juice letterpress pop-up. Taxidermy irony semiotics meh lo-fi yuccie ennui aesthetic. Chambray truffaut selfies ugh gastropub goth migas. Locavore etsy paleo street offal fingerstache.\nAesthetic cardigan brooklyn art party. Heirloom fanny pack polaroid tumblr cliche migas keytar. Ramps single-origin coffee quinoa. Ramps kogi williamsburg. Kitsch distillery art party godard ennui sartorial retro.\nBlue bottle direct trade deep v venmo. Direct trade literally goth sriracha typewriter. Hella hoodie ramps gluten-free freegan. Post-ironic food truck craft beer butcher flexitarian pickled tattooed.",
    "content_html": null,
    "replies": [],
    "created_at": "2017-11-21T17:09:50.566Z",
    "updated_at": "2017-11-21T17:32:40.297Z",
    "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: "4", user_id: "79"}}
response = token.post("/v2/votes", params: params)
response.status
# => 201
response.parsed
# => {"id"=>35, "kind"=>"upvote", "created_at"=>"2017-11-21T17:32:40.291Z", "user"=>{"login"=>"paamidal", "id"=>79, "url"=>"https://profile.intra.42.fr/users/paamidal"}, "message"=>{"id"=>4, "author"=>{"login"=>"watwatto", "id"=>81, "url"=>"https://profile.intra.42.fr/users/watwatto"}, "content"=>"Ennui pitchfork green juice letterpress pop-up. Taxidermy irony semiotics meh lo-fi yuccie ennui aesthetic. Chambray truffaut selfies ugh gastropub goth migas. Locavore etsy paleo street offal fingerstache.\nAesthetic cardigan brooklyn art party. Heirloom fanny pack polaroid tumblr cliche migas keytar. Ramps single-origin coffee quinoa. Ramps kogi williamsburg. Kitsch distillery art party godard ennui sartorial retro.\nBlue bottle direct trade deep v venmo. Direct trade literally goth sriracha typewriter. Hella hoodie ramps gluten-free freegan. Post-ironic food truck craft beer butcher flexitarian pickled tattooed.", "content_html"=>nil, "replies"=>[], "created_at"=>"2017-11-21T17:09:50.566Z", "updated_at"=>"2017-11-21T17:32:40.297Z", "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}}