MediaMath / t1-python

Python SDK for MediaMath Platform APIs
https://developer.mediamath.com/
Apache License 2.0
18 stars 30 forks source link

Finding campaigns with duplicate strategy names #114

Closed robrechtdr closed 7 years ago

robrechtdr commented 7 years ago

Ideally I'd like to find all campaigns that have strategies with duplicate strategy names for a given organisation, skimming the docs this doesn't look possible atm.

The next best thing seems to get all the campaigns with more than one strategy. I tried the following:

>>> camps_with_more_than_one_strat = t1.find(collection="campaigns", variable="strategies", operator=terminalone.filters.GREATER, candidates=1, limit={"organisation": 101416}) 
TypeError: sequence item 1: expected string, int found

Trying with "1" instead of 1.

>>> camps_with_more_than_one_strat = t1.find(collection="campaigns", variable="strategies", operator=terminalone.filters.GREATER, candidates="1", limit={"organisation": 101416})
ValidationError: invalid

I didn't expect this given the 'find' doc string.

I'm using t1 with commit state of https://github.com/MediaMath/t1-python/commit/f98f2a5048756b22d58abd32c3425cf58ce2af5f.

FodT commented 7 years ago

hey @robrechtdr,

This isn't actually a supported feature in our API.

Just a word on the usage of 'find', it is syntactic sugar for the q parameter of the API which is documented on the Developer Portal - variable is a field name to query on.

I'll pass your feedback onto our development team and we'll try to find a way of supporting this use case somewhere down the line, but your best bet at the moment is to iterate over your campaigns.