A Vote is set on a message by an user. A vote can be an upvote, a downvote, a problem (when people report a content as inappropriate) or a trollvote. Each user can upvote OR downvote a message, and can trollvote and mark as inappropriate as well.

This call obviously lists all votes.

The user id of the voter is always hidden.

if there is a resource owner (an user uses this api trough your app, with the web application flow):

  • The /me/*/votes endpoint will list all the votes mades by the current user. If you want to known is the current user have made a vote on a particular message, you can hit the endpoint /v2/me/messages/:message_id/votes.

live_help Notes

chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
topic_id optional . Must be String

The topic id

message_id optional . Must be String

The message id

sort optional . Must be one of: id, message_id, created_at, kind, updated_at.

The sort field. Sorted by created_at asc by default.

Example:

To sort on votes on the fields kind on a descending order and updated_at on a ascending order:

...&sort=-kind,updated_at

filter optional . Must be one of: id, message_id, created_at, kind, updated_at.

Filtering on one or more fields

Example:

To filter on votes with the id field matching a_value or another_value:

...&filter[id]=a_value,another_value

Filterable fields:
  • id (standard field)
  • message_id (standard field)
  • created_at (standard field)
  • kind (standard field)
  • updated_at (standard field)
range optional . Must be one of: id, message_id, created_at, updated_at.

Select on a particular range

Example:

To range on votes with the updated_at field between min_value and max_value:

...&range[updated_at]=min_value,max_value

Rangeable fields:
  • id
  • message_id
  • created_at
  • updated_at
page optional . Must be a Hash

The pagination params, as a hash

page[number] optional . Must be Fixnum

The current page

page[size] optional . Must be Fixnum

The number of items per page, defaults to 30, maximum 100

GET /v2/votes
200
[
  {
    "id": 1,
    "kind": "trollvote",
    "created_at": "2017-11-22T13:42:20.052Z",
    "user": null,
    "message": {
      "id": 2,
      "author": {
        "login": "yyoda2",
        "id": 80,
        "url": "https://profile.intra.42.fr/users/yyoda2"
      },
      "content": "Hammock helvetica retro before they sold out kogi franzen taxidermy swag. Austin ramps goth actually wayfarers food truck pinterest. Knausgaard yolo chambray hashtag tacos whatever.\n90's fixie yolo typewriter schlitz drinking +1. Lo-fi tousled hashtag distillery mlkshk health kinfolk. Ugh brooklyn mustache actually health selfies post-ironic normcore. Shoreditch wes anderson gluten-free butcher whatever.\nNeutra waistcoat williamsburg put a bird on it cold-pressed yuccie keytar. Poutine offal schlitz tacos etsy pbr&b godard. Pickled forage kombucha schlitz truffaut dreamcatcher intelligentsia echo.",
      "content_html": null,
      "replies": [],
      "created_at": "2017-11-22T13:42:13.332Z",
      "updated_at": "2017-11-22T13:42:20.055Z",
      "parent_id": null,
      "is_root": false,
      "messageable_id": 1,
      "messageable_type": "Topic",
      "votes_count": {
        "upvote": 0,
        "downvote": 0,
        "trollvote": 1,
        "problem": 0
      },
      "user_votes": {
        "upvote": false,
        "downvote": false,
        "trollvote": false,
        "problem": false
      },
      "readings": 0
    }
  },
  {
    "id": 2,
    "kind": "downvote",
    "created_at": "2017-11-22T13:42:20.072Z",
    "user": null,
    "message": {
      "id": 92,
      "author": {
        "login": "jeanne",
        "id": 1,
        "url": "https://profile.intra.42.fr/users/jeanne"
      },
      "content": "Freegan meh marfa umami. Kogi gastropub loko wes anderson selvage. Freegan listicle dreamcatcher tilde squid.\nSelvage before they sold out beard quinoa put a bird on it pour-over. Before they sold out squid lumbersexual fashion axe pickled. Bitters yuccie trust fund bespoke green juice knausgaard. Farm-to-table wes anderson fixie hoodie kinfolk tacos. Gastropub blog food truck.\nPop-up stumptown offal kogi. Jean shorts thundercats cold-pressed squid authentic street locavore semiotics. Chartreuse 3 wolf moon mustache quinoa. Craft beer lumbersexual loko pork belly 90's kale chips scenester. Messenger bag carry church-key pork belly farm-to-table +1.",
      "content_html": null,
      "replies": [
        {
          "id": 100,
          "author": {
            "id": 24,
            "login": "spalpati",
            "url": "https://api.intra.42.fr/v2/users/spalpati"
          },
          "content": "Chambray kombucha pop-up shoreditch. Disrupt hashtag offal ramps. Vinegar sustainable plaid yolo forage.\nTaxidermy chillwave shabby chic cold-pressed. Fingerstache beard before they sold out. Diy single-origin coffee selfies vegan cornhole.\nMessenger bag typewriter church-key pitchfork. Authentic banjo kogi gentrify. Echo pinterest bespoke flexitarian cred slow-carb. Keffiyeh pop-up kombucha put a bird on it pork belly.",
          "content_html": null,
          "replies": [],
          "created_at": "2017-11-22T13:42:19.964Z",
          "updated_at": "2017-11-22T13:42:19.964Z",
          "parent_id": 92,
          "is_root": false,
          "messageable_id": 10,
          "messageable_type": "Topic",
          "votes_count": {
            "upvote": 0,
            "downvote": 0,
            "trollvote": 0,
            "problem": 0
          },
          "user_votes": {
            "upvote": false,
            "downvote": false,
            "trollvote": false,
            "problem": false
          },
          "readings": 0
        }
      ],
      "created_at": "2017-11-22T13:42:19.432Z",
      "updated_at": "2017-11-22T13:42:20.077Z",
      "parent_id": null,
      "is_root": false,
      "messageable_id": 10,
      "messageable_type": "Topic",
      "votes_count": {
        "upvote": 0,
        "downvote": 1,
        "trollvote": 0,
        "problem": 0
      },
      "user_votes": {
        "upvote": false,
        "downvote": false,
        "trollvote": false,
        "problem": false
      },
      "readings": 0
    }
  },
  {
    "id": 3,
    "kind": "trollvote",
    "created_at": "2017-11-22T13:42:20.092Z",
    "user": null,
    "message": {
      "id": 79,
      "author": {
        "login": "lskywalk",
        "id": 51,
        "url": "https://profile.intra.42.fr/users/lskywalk"
      },
      "content": "Microdosing cardigan street five dollar toast. Yolo austin lumbersexual thundercats kickstarter. Five dollar toast slow-carb vinegar. Readymade neutra letterpress artisan trust fund. Etsy 3 wolf moon meggings bushwick actually.\nSalvia farm-to-table yuccie food truck venmo freegan. Asymmetrical tattooed fingerstache beard fixie direct trade church-key. Humblebrag celiac goth 90's chambray asymmetrical chartreuse craft beer. Scenester organic single-origin coffee brooklyn yr.\nIphone williamsburg helvetica before they sold out portland. Mustache trust fund retro. Street venmo lumbersexual cray iphone kombucha literally. Twee listicle master normcore tumblr cleanse.",
      "content_html": null,
      "replies": [],
      "created_at": "2017-11-22T13:42:18.557Z",
      "updated_at": "2017-11-22T13:42:20.094Z",
      "parent_id": 71,
      "is_root": false,
      "messageable_id": 8,
      "messageable_type": "Topic",
      "votes_count": {
        "upvote": 0,
        "downvote": 0,
        "trollvote": 1,
        "problem": 0
      },
      "user_votes": {
        "upvote": false,
        "downvote": false,
        "trollvote": false,
        "problem": false
      },
      "readings": 0
    }
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/votes"

[
  {
    "id": 1,
    "kind": "trollvote",
    "created_at": "2017-11-22T13:42:20.052Z",
    "user": null,
    "message": {
      "id": 2,
      "author": {
        "login": "yyoda2",
        "id": 80,
        "url": "https://profile.intra.42.fr/users/yyoda2"
      },
      "content": "Hammock helvetica retro before they sold out kogi franzen taxidermy swag. Austin ramps goth actually wayfarers food truck pinterest. Knausgaard yolo chambray hashtag tacos whatever.\n90's fixie yolo typewriter schlitz drinking +1. Lo-fi tousled hashtag distillery mlkshk health kinfolk. Ugh brooklyn mustache actually health selfies post-ironic normcore. Shoreditch wes anderson gluten-free butcher whatever.\nNeutra waistcoat williamsburg put a bird on it cold-pressed yuccie keytar. Poutine offal schlitz tacos etsy pbr&b godard. Pickled forage kombucha schlitz truffaut dreamcatcher intelligentsia echo.",
      "content_html": null,
      "replies": [],
      "created_at": "2017-11-22T13:42:13.332Z",
      "updated_at": "2017-11-22T13:42:20.055Z",
      "parent_id": null,
      "is_root": false,
      "messageable_id": 1,
      "messageable_type": "Topic",
      "votes_count": {
        "upvote": 0,
        "downvote": 0,
        "trollvote": 1,
        "problem": 0
      },
      "user_votes": {
        "upvote": false,
        "downvote": false,
        "trollvote": false,
        "problem": false
      },
      "readings": 0
    }
  },
  {
    "id": 2,
    "kind": "downvote",
    "created_at": "2017-11-22T13:42:20.072Z",
    "user": null,
    "message": {
      "id": 92,
      "author": {
        "login": "jeanne",
        "id": 1,
        "url": "https://profile.intra.42.fr/users/jeanne"
      },
      "content": "Freegan meh marfa umami. Kogi gastropub loko wes anderson selvage. Freegan listicle dreamcatcher tilde squid.\nSelvage before they sold out beard quinoa put a bird on it pour-over. Before they sold out squid lumbersexual fashion axe pickled. Bitters yuccie trust fund bespoke green juice knausgaard. Farm-to-table wes anderson fixie hoodie kinfolk tacos. Gastropub blog food truck.\nPop-up stumptown offal kogi. Jean shorts thundercats cold-pressed squid authentic street locavore semiotics. Chartreuse 3 wolf moon mustache quinoa. Craft beer lumbersexual loko pork belly 90's kale chips scenester. Messenger bag carry church-key pork belly farm-to-table +1.",
      "content_html": null,
      "replies": [
        {
          "id": 100,
          "author": {
            "id": 24,
            "login": "spalpati",
            "url": "https://api.intra.42.fr/v2/users/spalpati"
          },
          "content": "Chambray kombucha pop-up shoreditch. Disrupt hashtag offal ramps. Vinegar sustainable plaid yolo forage.\nTaxidermy chillwave shabby chic cold-pressed. Fingerstache beard before they sold out. Diy single-origin coffee selfies vegan cornhole.\nMessenger bag typewriter church-key pitchfork. Authentic banjo kogi gentrify. Echo pinterest bespoke flexitarian cred slow-carb. Keffiyeh pop-up kombucha put a bird on it pork belly.",
          "content_html": null,
          "replies": [],
          "created_at": "2017-11-22T13:42:19.964Z",
          "updated_at": "2017-11-22T13:42:19.964Z",
          "parent_id": 92,
          "is_root": false,
          "messageable_id": 10,
          "messageable_type": "Topic",
          "votes_count": {
            "upvote": 0,
            "downvote": 0,
            "trollvote": 0,
            "problem": 0
          },
          "user_votes": {
            "upvote": false,
            "downvote": false,
            "trollvote": false,
            "problem": false
          },
          "readings": 0
        }
      ],
      "created_at": "2017-11-22T13:42:19.432Z",
      "updated_at": "2017-11-22T13:42:20.077Z",
      "parent_id": null,
      "is_root": false,
      "messageable_id": 10,
      "messageable_type": "Topic",
      "votes_count": {
        "upvote": 0,
        "downvote": 1,
        "trollvote": 0,
        "problem": 0
      },
      "user_votes": {
        "upvote": false,
        "downvote": false,
        "trollvote": false,
        "problem": false
      },
      "readings": 0
    }
  },
  {
    "id": 3,
    "kind": "trollvote",
    "created_at": "2017-11-22T13:42:20.092Z",
    "user": null,
    "message": {
      "id": 79,
      "author": {
        "login": "lskywalk",
        "id": 51,
        "url": "https://profile.intra.42.fr/users/lskywalk"
      },
      "content": "Microdosing cardigan street five dollar toast. Yolo austin lumbersexual thundercats kickstarter. Five dollar toast slow-carb vinegar. Readymade neutra letterpress artisan trust fund. Etsy 3 wolf moon meggings bushwick actually.\nSalvia farm-to-table yuccie food truck venmo freegan. Asymmetrical tattooed fingerstache beard fixie direct trade church-key. Humblebrag celiac goth 90's chambray asymmetrical chartreuse craft beer. Scenester organic single-origin coffee brooklyn yr.\nIphone williamsburg helvetica before they sold out portland. Mustache trust fund retro. Street venmo lumbersexual cray iphone kombucha literally. Twee listicle master normcore tumblr cleanse.",
      "content_html": null,
      "replies": [],
      "created_at": "2017-11-22T13:42:18.557Z",
      "updated_at": "2017-11-22T13:42:20.094Z",
      "parent_id": 71,
      "is_root": false,
      "messageable_id": 8,
      "messageable_type": "Topic",
      "votes_count": {
        "upvote": 0,
        "downvote": 0,
        "trollvote": 1,
        "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

response = token.get("/v2/votes")
response.status
# => 200
response.parsed
# => [{"id"=>1, "kind"=>"trollvote", "created_at"=>"2017-11-22T13:42:20.052Z", "user"=>nil, "message"=>{"id"=>2, "author"=>{"login"=>"yyoda2", "id"=>80, "url"=>"https://profile.intra.42.fr/users/yyoda2"}, "content"=>"Hammock helvetica retro before they sold out kogi franzen taxidermy swag. Austin ramps goth actually wayfarers food truck pinterest. Knausgaard yolo chambray hashtag tacos whatever.\n90's fixie yolo typewriter schlitz drinking +1. Lo-fi tousled hashtag distillery mlkshk health kinfolk. Ugh brooklyn mustache actually health selfies post-ironic normcore. Shoreditch wes anderson gluten-free butcher whatever.\nNeutra waistcoat williamsburg put a bird on it cold-pressed yuccie keytar. Poutine offal schlitz tacos etsy pbr&b godard. Pickled forage kombucha schlitz truffaut dreamcatcher intelligentsia echo.", "content_html"=>nil, "replies"=>[], "created_at"=>"2017-11-22T13:42:13.332Z", "updated_at"=>"2017-11-22T13:42:20.055Z", "parent_id"=>nil, "is_root"=>false, "messageable_id"=>1, "messageable_type"=>"Topic", "votes_count"=>{"upvote"=>0, "downvote"=>0, "trollvote"=>1, "problem"=>0}, "user_votes"=>{"upvote"=>false, "downvote"=>false, "trollvote"=>false, "problem"=>false}, "readings"=>0}}, {"id"=>2, "kind"=>"downvote", "created_at"=>"2017-11-22T13:42:20.072Z", "user"=>nil, "message"=>{"id"=>92, "author"=>{"login"=>"jeanne", "id"=>1, "url"=>"https://profile.intra.42.fr/users/jeanne"}, "content"=>"Freegan meh marfa umami. Kogi gastropub loko wes anderson selvage. Freegan listicle dreamcatcher tilde squid.\nSelvage before they sold out beard quinoa put a bird on it pour-over. Before they sold out squid lumbersexual fashion axe pickled. Bitters yuccie trust fund bespoke green juice knausgaard. Farm-to-table wes anderson fixie hoodie kinfolk tacos. Gastropub blog food truck.\nPop-up stumptown offal kogi. Jean shorts thundercats cold-pressed squid authentic street locavore semiotics. Chartreuse 3 wolf moon mustache quinoa. Craft beer lumbersexual loko pork belly 90's kale chips scenester. Messenger bag carry church-key pork belly farm-to-table +1.", "content_html"=>nil, "replies"=>[{"id"=>100, "author"=>{"id"=>24, "login"=>"spalpati", "url"=>"https://api.intra.42.fr/v2/users/spalpati"}, "content"=>"Chambray kombucha pop-up shoreditch. Disrupt hashtag offal ramps. Vinegar sustainable plaid yolo forage.\nTaxidermy chillwave shabby chic cold-pressed. Fingerstache beard before they sold out. Diy single-origin coffee selfies vegan cornhole.\nMessenger bag typewriter church-key pitchfork. Authentic banjo kogi gentrify. Echo pinterest bespoke flexitarian cred slow-carb. Keffiyeh pop-up kombucha put a bird on it pork belly.", "content_html"=>nil, "replies"=>[], "created_at"=>"2017-11-22T13:42:19.964Z", "updated_at"=>"2017-11-22T13:42:19.964Z", "parent_id"=>92, "is_root"=>false, "messageable_id"=>10, "messageable_type"=>"Topic", "votes_count"=>{"upvote"=>0, "downvote"=>0, "trollvote"=>0, "problem"=>0}, "user_votes"=>{"upvote"=>false, "downvote"=>false, "trollvote"=>false, "problem"=>false}, "readings"=>0}], "created_at"=>"2017-11-22T13:42:19.432Z", "updated_at"=>"2017-11-22T13:42:20.077Z", "parent_id"=>nil, "is_root"=>false, "messageable_id"=>10, "messageable_type"=>"Topic", "votes_count"=>{"upvote"=>0, "downvote"=>1, "trollvote"=>0, "problem"=>0}, "user_votes"=>{"upvote"=>false, "downvote"=>false, "trollvote"=>false, "problem"=>false}, "readings"=>0}}, {"id"=>3, "kind"=>"trollvote", "created_at"=>"2017-11-22T13:42:20.092Z", "user"=>nil, "message"=>{"id"=>79, "author"=>{"login"=>"lskywalk", "id"=>51, "url"=>"https://profile.intra.42.fr/users/lskywalk"}, "content"=>"Microdosing cardigan street five dollar toast. Yolo austin lumbersexual thundercats kickstarter. Five dollar toast slow-carb vinegar. Readymade neutra letterpress artisan trust fund. Etsy 3 wolf moon meggings bushwick actually.\nSalvia farm-to-table yuccie food truck venmo freegan. Asymmetrical tattooed fingerstache beard fixie direct trade church-key. Humblebrag celiac goth 90's chambray asymmetrical chartreuse craft beer. Scenester organic single-origin coffee brooklyn yr.\nIphone williamsburg helvetica before they sold out portland. Mustache trust fund retro. Street venmo lumbersexual cray iphone kombucha literally. Twee listicle master normcore tumblr cleanse.", "content_html"=>nil, "replies"=>[], "created_at"=>"2017-11-22T13:42:18.557Z", "updated_at"=>"2017-11-22T13:42:20.094Z", "parent_id"=>71, "is_root"=>false, "messageable_id"=>8, "messageable_type"=>"Topic", "votes_count"=>{"upvote"=>0, "downvote"=>0, "trollvote"=>1, "problem"=>0}, "user_votes"=>{"upvote"=>false, "downvote"=>false, "trollvote"=>false, "problem"=>false}, "readings"=>0}}]