koala
koala copied to clipboard
Cannot use filtering parameters and cannot log request for debugging
Hi there, I am having trouble with request parameters, especially filtering arrays... I also cannot find any way to log the actual request to facebook servers.
The code:
client.get_connections("act_XXXXXXXXX/customaudiences?filtering[0][value]=Client&filtering[0][operator]=CONTAIN&filtering[0][field]=name")
The error:
Koala::Facebook::ClientError: type: OAuthException, code: 100, message: (#100) The parameter filtering[0][operator] is required [HTTP 400]
This works perfectly fine in the graph api explorer...
I think it crashes specifically on the word operator
, is that a reserved word or so?
I checked with a simple RestClient, the request works fine.
Thanks for the issue! Apologies for the late response. I appreciate your reproducing it in the Graph API explorer.
I'm guessing it might be an encoding issue — I'll try testing it with the logger level set to debug and see what's produced and compare that to the explorer and fix it. (If you have a chance to test that, that would be awesome.)
@AlexCppns Try this instead
client.get_connections("act_XXXXXXXXX",'customaudiences', { :filtering => [{ :field => 'name', :operator => 'CONTAIN', :value => 'Client' }].to_json })
Let me know if this works.
And for request logging try this -
Koala::Utils.level = Logger::DEBUG
@AlexCppns Try this instead
client.get_connections("act_XXXXXXXXX",'customaudiences', { :filtering => [{ :field => 'name', :operator => 'CONTAIN', :value => 'Client' }].to_json })
Let me know if this works.
And for request logging try this -
Koala::Utils.level = Logger::DEBUG
@agnel-waghela It works perfectly.