SuperEvilMegacorp / vainglory-assets

Community provided art, schemas, and other assets that make using the Vainglory API easier
https://developer.vainglorygame.com
MIT License
54 stars 40 forks source link

Bug: Page[limit] documents say 50, actual 5 #88

Closed ChrisLundquist closed 7 years ago

ChrisLundquist commented 7 years ago

Version:

{"data":{"type":"status","id":"gamelocker","attributes":{"releasedAt":"2017-02-24T20:44:05Z","version":"gamelockerd-v4.0.2"}}}

Ruby

irb(main):046:0> data = JSON.parse(get_change_set({'page[limit]': 50, 'filter[createdAt-start]': '2017-01-01T13:25:30Z', 'page[offset]': 0})); nil
=> nil
irb(main):047:0> data["data"].size
=> 5
irb(main):048:0> data = JSON.parse(get_change_set({'page[limit]': 2, 'filter[createdAt-start]': '2017-01-01T13:25:30Z', 'page[offset]': 0})); nil
=> nil
irb(main):049:0> data["data"].size
=> 2

Docs say:

page[limit] 50  The default (and current maximum) is 50. Values less than 50 and great than 2 are supported.

Ruby code. (Same results seen via curl)

require "net/http"

ENDPOINT= "https://api.dc01.gamelockerapp.com/shards/na/matches"
def get_change_set(params = {})
  uri = URI(ENDPOINT)
  uri.query = URI.encode_www_form(params)

  req = Net::HTTP::Get.new(uri)
  req['x-title-id'] = 'semc-vainglory'
  req['Authorization'] = ENV["VG_TOKEN"]
  req['Accept'] = 'application/vnd.api+json'

  res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") {|http|
    http.request(req)
  }
  #puts res.inspect
  #puts res.body
  res.body if res.is_a?(Net::HTTPSuccess)
end
ChrisLundquist commented 7 years ago

It looks like I get more results if I scope it to my player name?

data = JSON.parse(get_change_set({'page[limit]': 100, 'filter[createdAt-start]': '2017-01-01T13:25:30Z', 'filter[playerNames]': 'EnabrenTane', 'page[offset]': 0}))
data["data"].size
=> 32

It seems like I should get more results without scoping my name.

kvahuja commented 7 years ago

there was a recent announcement - to assist some development a blank call with no filters will return random 5 results. however it's expected to send in proper filters to get everything working properly.