I'm working with Microsoft Graph API via Python 3 and Requests. The following code works:
r = graph_session.get(graph_endpoint + '''/groups?$filter=groupTypes/any(c:c+eq+'Unified')''')
print(r.url)
>>> https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/any(c:c+eq+'Unified')
However, this does not work:
parameters = {'$filter': '''groupTypes/any(c:c+eq+'Unified')'''}
r = graph_session.get(graph_endpoint + '/groups', params=parameters)
print(r.url)
>>> https://graph.microsoft.com/v1.0/groups?%24filter=groupTypes%2Fany%28c%3Ac%2Beq%2B%27Unified%27%29
Why does the latter method, which seems to be cleaner, produce a 400 error (Bad request)? It seems like an encoding problem.