Closed swathi-ssunder closed 8 years ago
@swathi-ssunder how are the search parameters to be specified? Is it encoded in the URL like /api/pokemon/search?id=5&location=x,y or how does it work?
@jonas-he - Yes, the search parameters need to be specified in the url, as query parameters. Just like the sample you mentioned above.
Mappings implemented for few attributes, thus taking care of validation.
Wait, wait! &location=..
? Please divide in &lat=...&lng=...
Changes made to work now for &lat=... &lng=...
as suggested.
@sacdallago -
As per your comment https://github.com/PokemonGoers/PokeData/pull/131#issuecomment-245300110, changes have been made.
&location=..? Please divide in &lat=...&lng=...
Also, what about nested parameters such as nextEvolutions, previousEvolutions, fastAttacks, weight etc? How should the query parameters be like?
"nextEvolutions": [{
"name": "Ivysaur",
"_id": "57c7433c7db332a41b06d4f8",
"pokemonId": 2
}],
"height": {
"maximum": "0.79m",
"minimum": "0.61m"
},
"weight": {
"maximum": "7.76kg",
"minimum": "6.04kg"
},
"specialAttacks": [{
"type": "Grass",
"name": "Power Whip",
"damage": 70,
"_id": "57c7433c7db332a41b06d4f5"
}]
We, the app team, would like to implement something like this on the client side:
findPokemon({ gender: 'w' })
findPokemon({ attackType: 'fire' })
findPokemon({ attackType: 'fire', minAttackDamage: 200, maxAttackDamage: 500 })
findPokemon({ gender: 'w', attackType: 'fire', minAttackDamage: 200, maxAttackDamage: 500 })
... (other options, other combinations)
will this be supported?
Also, for locations we also need a radius around that. There's no use for exact location queries.
@swathi-ssunder sorry for the late reply, am currently (till monday) in Malaysia. Well you don't have to go so deep into the tree, the only call I would implement in that specific example is evolution=x
where x is a pokemonId. Of your question is how to treat the calls, well, there has some preprocessing to be done (obviously it doesn't make sense to encode the whole evolution/Pokémon object in the GET call :) so, yeah, only the id and then you construct the query object :) Mongo is able to search for nested object too, no worries about that ;)
@MajorBreakfast - Please find below the equivalent apis for the above requirements. Other use-cases should work similarly. Let me know in case of any issues.
findPokemon({ gender: 'w' })
http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/api/pokemon/gender/w
http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/api/pokemon/search?gender=w
findPokemon({ attackType: 'fire' })
http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/api/pokemon/search?attackType=fire
findPokemon({ attackType: 'fire', minAttackDamage: 200, maxAttackDamage: 500 })
http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/api/pokemon/search?attackType=fire&minAttackDamage=200&maxAttackDamage=500
findPokemon({ gender: 'w', attackType: 'fire', minAttackDamage: 200, maxAttackDamage: 500 })
http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/api/pokemon/search?gender=w&attackType=fire&minAttackDamage=200&maxAttackDamage=500
Validations(to check for existence, type of attribute) are still pending.