Data Query equivalent on the API for passing variables

I am trying to use dataquery to fetch an SQL VIEW resource. The view has variables.

From the Web API, i am able to fetch the data like this:

http://localhost/api/29/sqlViews/lvWZykGDQHY/data?var=partner:Q6UQPyQFdHt

however i am unable to reconstruct the same using data query

{
	"face": {
        "resource": "sqlViews/lvWZykGDQHY/data",
        "params": {
            "paging": "false",
            "filter": "partner:eq:Q6UQPyQFdHt"
        }
    }
}


{
	"face": {
        "resource": "sqlViews/lvWZykGDQHY/data",
        "params": {
            "paging": "false",
            "var": "partner:eq:Q6UQPyQFdHt"
        }
    }
}

I have tried the two resource above without any success.

Kindly assist.

Hello @BMugwe

I think the second one has a bit of an error. the var value should be partner:Q6UQPyQFdHt instead of partner:eq:Q6UQPyQFdHt. The eq is for the filter parameter.

@nnkogift
Thanks for your response , it was really helpful.

What about when i want to have more than one variable.

/api/32/sqlViews/R6AgmtG6UBb/data?var=datasetid:Q6UQPyQFdHt&var=startdateid:2022-01-01&var=enddateid:2022-01-31

The resources is producing the correct api in console but its failing and returning a 409

Perhaps you can try

{
  "face": {
    "resource": "sqlViews/R6AgmtG6UBb/data",
    "params": {
      "var": [
        "datasetid:Q6UQPyQFdHt",
        "startdateid:2022-01-01",
        "enddateid:2022-01-31"
      ]
    }
  }
}

1 Like

This works perfectly.

You are a live saver man

2 Likes