Whenever I use the following Keybase Chat API query:
{
"method": "read",
"params": {
"options": {
"channel": {
"name": "teamnamehere",
"pagination": {
"num": 1000
},
"members_type": "team"
"topic_name": "channelnamehere"
}
}
}
}
I get this result returned every time:
{'error': {'code': 0, 'message': "invalid character 'm' looking for beginning of object key string"}}
This is the Python code to execute the query, with q
being the query and json_out
being a file that this error is written to:
q = json.dumps(query)
cmd = "echo {} | keybase chat api > {}".format(q, json_out)
This works fine for the normal Chat API specifications between two users with the following:
{
"method": "read",
"params": {
"options": {
"channel": {
"name": "user1,user2",
"pagination": {
"num": 1000
}
}
}
}
}
As far as I can tell, this confines to the standards set forth by the Chat API. Does anyone have any ideas on how to avoid this error?
I found the problem, the Keybase API just wasn't very helpful with the provided error message.
You need to put quotes around the {}
in the echo
statement, like such:
cmd = "echo '{}' | keybase chat api > {}".format(q, json_out)