Trying to get a random model

Hi
I’m trying to get a random model through the API and I’m wondering what the correct way would be.
I’ve tried setting a random “offset” parameter like in this (deprecated) example, but I feel like it only works if I also set “staffpicked=true”:

With this I manage to get different models by changing the “offset” parameter:
models?staffpicked=True&count=1&offset=1

But when I set “staffpicked=False”, I always get the same model, no matter what I set the “offset” parameter to:
models?staffpicked=False&count=1&offset=1
(I always get a deleted model with the uid ‘7d310a2921cc47fd806ce20acd819df4’).

Why could that be?
Is the “offset” parameter deprecated?
Is there a better way to get a random model?

Thanks for any advice!

I don’t see the offset query option in the v3 docs. Are you sure it’s supported?

I didn’t find it either. That’s why I wonder if it was deprecated and whether there are alternatives.
The only other option that comes to my mind is to use the “next” url a random number of times to get to a random results page. But I’m afraid that this might lead to too many API calls to just get 1 model.

@james could you tell us whether the offset query parameter still exists in the v3 API?

@aaronateo an alternative way to get somewhat random models is to query the API and pick one of the 24 results (24 is the max number of models in a response). You could increase randomness by adding different types of sorting to your query. Make full use of all the different search parameters that are available and “randomly” combine them. It might just be good enough.

1 Like

Yeah, the approach with the various parameters sounds promising, thank you! I’ll give it a try soon.