I'm trying to add a filtered view of an ArcServer map service (or feature service, if necessary) to ArcGIS Online by REST service URL using the API for Python. I can create the item in ArcGIS online using the url, but how do I add a filter? When I do this manually, I add the item to my content, go to the item details page, got the Visualization tab, click filter, add the filter, and save. Can this be done programmatically, using the Python API? Any help would be appreciated.
Edit: Perhaps layer definition or definition expression are better terms than filter.