View Single Post
Old 05-10-2022, 06:43 AM  
drexl
Whale Hunter
 
drexl's Avatar
 
Industry Role:
Join Date: Jan 2016
Posts: 930
dzhanova is 100% right : fields=geobans will add geo bans info to the response.

It is important to note that it is not applying any geo filters, it merely enrich the json response.

without fields=geobans you get:
Code:
{"count":1,"total":5187,"models":[{"id":57297042,"username":"testmodelname"]}
with fields=geobans you get:
Code:
{"count":1,"total":5187,"models":[{"id":57297042,"username":"testmodelname"],"geobans":{"blockedCountries":["ru"],"blockedRegions":{}}}
But the model still shows up until you do one of those two things:

- add country=xx (replace xx by the 2 letters country code of the current visitor)
This is the preferred solution because the business logic is on the API side. country=ru will have the API ruturn all models except those who have geo banned Russia.

- add some code on your website where you handle the JSON response to compare current user location with list of geo bans returned. This is a poor solution.

** disclaimer : all the above is based on my tests + info I read in the doc (country parameter)

Quote:
Originally Posted by dzhanova View Post
we'll improve our API documentation to make it more clear.
for geobans, it's enough to use 1 parameter "fields=geobans" (it will both extract model blocked country info + user GEO).

For widgets, it's same way
drexl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote