We have a Google Analytics query setup with a parameter:
?ids=ga:xxxxx&start-date=2020-01-01&end-date=yesterday&metrics=ga:pageviews&dimensions=ga:pagePath,ga:month&filters=ga:month=={{ month }}&sort=-ga:month&max-results=10000

We wanted to call that query using an API following this guide: https://redash.io/help/user-guide/integrations-and-api/api

When making the call, we got this error:

{
    "job": {
        "status": 4,
        "error": "This query contains potentially unsafe parameters and cannot be executed on a shared dashboard or an embedded visualization."
    }
}

Any workarounds? Or is this a bug?

That’s an odd response. What endpoint did you hit which returned that response?

POST /api/queries/<id>/results with the following JSON request body:

{
    "parameters": {
        "month": "11"
    }
}

EDIT: as per the guide in the link shared above
also to get the exact link I clicked the “Show API Key” button available in my query page

Which API key are you using for the request?

[EDIT]: Try it with your user API key instead of the query API key.

1 Like

using the user API key instead of query API key worked! thank you

1 Like