Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

How to pass parameters dynamically in rest connector in Qlik sense

I have set a variable in qlik sense . i have to pass this variable as query parameters in get method.

I tried to pass this variable . but getting @value .Its  not retrieving data from service. But when I pass hardcoded value ,

then getting result . Can anyone help me

1 Solution

Accepted Solutions
shraddha_g
Honored Contributor III

Re: How to pass parameters dynamically in rest connector in Qlik sense

http://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/1.1/Load-REST-data/Sele...

For Dynamic Parameters Refer Thread REST connector with automatic date update

You can try:

Let vProductId = 2;

RestConnectorMasterTable:

SQL SELECT 

    "CategoryName",

    "Name",

    "Price",

    "ProductId"

FROM JSON (wrap on) "root"

WITH CONNECTION ( 

QUERY "ProductId" "$(vProductId)")

;

[root]:

LOAD    [CategoryName] AS [CategoryName],

    [Name] AS [Name],

    [Price] AS [Price],

    [ProductId] AS [ProductId]

RESIDENT RestConnectorMasterTable;

14 Replies
shraddha_g
Honored Contributor III

Re: How to pass parameters dynamically in rest connector in Qlik sense

Share you code

Not applicable

Re: How to pass parameters dynamically in rest connector in Qlik sense

This is the generated code. I have used getmethod and passed productid = 1 in rest connector

LIB CONNECT TO 'Rest';

RestConnectorMasterTable:

SQL SELECT 

    "CategoryName",

    "Name",

    "Price",

    "ProductId"

FROM JSON (wrap on) "root";

[root]:

LOAD    [CategoryName] AS [CategoryName],

    [Name] AS [Name],

    [Price] AS [Price],

    [ProductId] AS [ProductId]

RESIDENT RestConnectorMasterTable;

DROP TABLE RestConnectorMasterTable;

shraddha_g
Honored Contributor III

Re: How to pass parameters dynamically in rest connector in Qlik sense

http://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/1.1/Load-REST-data/Sele...

For Dynamic Parameters Refer Thread REST connector with automatic date update

You can try:

Let vProductId = 2;

RestConnectorMasterTable:

SQL SELECT 

    "CategoryName",

    "Name",

    "Price",

    "ProductId"

FROM JSON (wrap on) "root"

WITH CONNECTION ( 

QUERY "ProductId" "$(vProductId)")

;

[root]:

LOAD    [CategoryName] AS [CategoryName],

    [Name] AS [Name],

    [Price] AS [Price],

    [ProductId] AS [ProductId]

RESIDENT RestConnectorMasterTable;

Not applicable

Re: How to pass parameters dynamically in rest connector in Qlik sense

I had set query parameter value 1 bydefault in rest connector . I am getting productid 1 data. Its not filtering using vProductId = 2 . Its a get method . Will your query work on get method ?

Not applicable

Re: How to pass parameters dynamically in rest connector in Qlik sense

This is my get method

[OperationContract]

        [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/GetProductListByproductId/{*Id}")]

        List<Product> GetProductListByproductId(string Id);

shraddha_g
Honored Contributor III

Re: How to pass parameters dynamically in rest connector in Qlik sense

I haven't tried with Get Method.

But you can try some solutions from

http://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/1.1/Load-REST-data/Sele...05106734-1799817335.1478168646

Try changing Url parameter.

Example is given in above link

Not applicable

Re: How to pass parameters dynamically in rest connector in Qlik sense

Now I have written one POST method.

   [OperationContract]

         [WebInvoke(Method = "POST",

         BodyStyle = WebMessageBodyStyle.Bare,

         RequestFormat = WebMessageFormat.Json,

         ResponseFormat = WebMessageFormat.Json,

         UriTemplate = "GetCategoryList/")]

         List<Product> GetCategoryList(test id);

What should I do in the request body space in the rest connector ?

shraddha_g
Honored Contributor III

Re: How to pass parameters dynamically in rest connector in Qlik sense

Does POST method works for Productid =1?

Not applicable

Re: How to pass parameters dynamically in rest connector in Qlik sense

In post man application I tested POST method with parameter {"id":"1"}. Then Its working.

Here in rest connector there is a space for request body..what should i fill in that box.

Community Browser