Hey hey everyone,
I’ve currently been playing with the API in Python and I’m already facing a wall which I can’t seem to be able to move past. My goal is to create a redash query with certain visualizations already set up. My json data looks like this:
dictCounters = {'query': '1SLF2Q-L5L4TMZUcZ9vzTGQr37onfe83q5RKXitbYVhQ|1',
'data_source_id': 3,
'schedule': {'interval': 900,'until': '2022-01-18','day_of_week': None,'time': None},
'name': "API_Test_3",
'is_draft': False,
'visualizations': [{'type': 'TABLE',
'options': {},
'name': "Table"},
{'type': 'COUNTER',
'options': {'tooltipFormat': '0,0.000',
'rowNumber': 1,
'stringDecChar': '.',
'stringDecimal': 0,
'counterColName': '#',
'counterLabel': 'Backlinks',
'stringThouSep': ',',
'targetRowNumber': 1},
'name': "Counter_Backlinks"},
{'type': 'COUNTER',
'options': {'tooltipFormat': '0,0.000',
'rowNumber': 5,
'stringDecChar': '.',
'stringDecimal': 0,
'counterColName': '#',
'counterLabel': 'Mentions',
'stringThouSep': ',',
'targetRowNumber': 1},
'name': "Counter_Mentions"}]}
Assume the indentation is correct in my code. However for some reason, the only parameters that are recognized is the query’s name, the scheduling parameters and the query itself (Which is a Google Sheets data source). The rest does not show up. I would also like for the query to be published and not in draft mode but for some reason this is not recognized as well.
Does anyone have an idea of what I’m missing here? I’ve been trying to create the query first and then update it with new parameters but it does not seem to work. I’ve also tried to json.dumps the parameters dictionary before using the create_query function but I get a INTERNAL SERVER ERROR when using the function then. So I’m a bit out of ideas right now