Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
ylchuang
Contributor II
Contributor II

Issue using variable in REST URL with GET method (works with POST)

Hi all,

I’m struggling with a strange behavior when using variables in the REST Connector URL with the GET method.

 

What works

If the URL variable is a static string, the REST call works as expected:

 

set vURL=https://mktorest.com/bulk/v1/leads/export/abc123/file.json;

LIB CONNECT TO 'Marketo File';

RestConnectorMasterTable:
SQL SELECT 
	"company",
    "email",
    "firstName",
    "lastName"
FROM CSV (header on, delimiter ",", quote """") "CSV_source"
			WITH CONNECTION (
            			URL "$(vURL)"						
);

 

What does NOT work

If the URL variable is built using another variable, the REST call fails, even though the resolved URL is identical.
let vExportID='abc123';
set vURL=https://mktorest.com/bulk/v1/leads/export/$(vExportID)/file.json;

TRACE vURL: $(vURL);

LIB CONNECT TO 'Marketo File';

RestConnectorMasterTable:
SQL SELECT 
	"company",
    "email",
    "firstName",
    "lastName"
FROM CSV (header on, delimiter ",", quote """") "CSV_source"
			WITH CONNECTION (
            			URL "$(vURL)"						
);

 

  • The TRACE log shows the exact same URL string as the hard‑coded version.
  • The same variable pass‑through works when the REST call uses POST, but fails with GET.
  • The REST connection has “Allow WITH CONNECTION” enabled.
  • No query parameters are involved. The variable is part of the URL.
  • Using SET and LET have the same outcome.

Is this a known limitation or quirk of the Qlik REST Connector with GET request?
Thanks in advance!

Labels (2)
1 Solution

Accepted Solutions
marksouzacosta

Hmm, if I understand it right, maybe at the time you are doing the GET automatically, the file is not ready yet. Is that a possibility? If so, is there an endpoint to check if the file is ready to get?


Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

View solution in original post

12 Replies
marksouzacosta

Hi @ylchuang ,

Try this:

SET vExportID = 'abc123';
LET vURL = 'https://mktorest.com/bulk/v1/leads/export/$(vExportID)/file.json';

 

Explanation:

Use SET for static values. Use single quotes when the values are strings. For numeric values you don't need single quotes.

Use LET when you need to process something before assign the value to the variable. In your case, vURL, you are adding the vExportID to a string value.

 

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

ylchuang
Contributor II
Contributor II
Author

Thanks for the suggestion.

It does work if vExportID is static, but actually vExportID is dynamic from a previous table. That's why I used LET.

I tried below combinations and sadly none of them worked.

They work in POST method though. 

 

Both LETs >> does not work

Let vExportID = peek('exportId',0,'result');
Let vURL = 'https://mktorest.com/bulk/v1/leads/export/$(vExportID)/file.json';

 

LET for dynamic vExportID, SET for vURL >> does not work

Let vExportID = peek('exportId',0,'result'); 
SET vURL = 'https://mktorest.com/bulk/v1/leads/export/$(vExportID)/file.json';

 

marksouzacosta

Using LET in both is the correct approach.

I believe the problem is something else.

  • What is the error message?
  • Can you share the REST API Data Connection settings you are using?
  • Why are you trying to use GET instead of POST in this case?
  • Can you share a valid Endpoint to test on our side?

 

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

ylchuang
Contributor II
Contributor II
Author

Thanks so much for checking. Below is when using both LETs

Error Message

The following error occurred:
The remote server returned an error: (404) Not Found.

The error occurred here:
RestConnectorMasterTable:
SQL SELECT 
	"company",
    "email",
    "firstName",
    "lastName"
FROM CSV (header on, delimiter ",", quote """") "CSV_source"
			WITH CONNECTION (
            			URL "https://mktorest.com/bulk/v1/leads/export/1468a515-d55d-4042-9aa6-b354e44c6aee/file.json",
						HTTPHEADER "Authorization" "Bearer $(vToken)"
						);

If I type in the same URL as string, it works without issue.

This URL is coming from variable vURL.

 

REST API Data Connection Settings

Untitled.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

GET as the last step

According to Marketo documentation, first we need to POST: create.json > then POST: enqueue.json > and after the file is created, GET: file.json.

 

Unfortunately I don't have a public endpoint for testing. But I will check our team.

marksouzacosta

Hmm, if I understand it right, maybe at the time you are doing the GET automatically, the file is not ready yet. Is that a possibility? If so, is there an endpoint to check if the file is ready to get?


Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

ylchuang
Contributor II
Contributor II
Author

I thought so at first as well, so I tested using following steps:

1. Confirm file is ready

I copied and pasted the URL as string directly into URL "https://...." and then reload. The file can be read without issue.

2. Store confirmed URL as text in a table and then assign vExportID to value in this table.

This ensures vExportID is not using a newly generated id from the previous loading script, but is using this confirmed ExportID that has file ready.

This is also done within a few minutes, so the file is not expired.

[tbl_ExportID]:
NoConcatenate Load * Inline [
ID
1468a515-d55d-4042-9aa6-b354e44c6aee
];


Let vExport = peek('ID',0,'tbl_ExportID');
Let vURL = 'https://mktorest.com/bulk/v1/leads/export/$(vExportID)/file.json';

 

3. Reload > Same error message

After hitting reload, the same error message appears. 

It seems GET: URL cannot handle variable that is not static string.

The following error occurred:
The remote server returned an error: (404) Not Found.

 

marksouzacosta

In this last version you sent, the variable names are not matching:

Let vExport = peek('ID',0,'tbl_ExportID');

Should be

Let vExportID = peek('ID',0,'tbl_ExportID');

Can you please double check?

 

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

ylchuang
Contributor II
Contributor II
Author

Sorry... typo here, but the actual script is using 

Let vExportID = peek('ID',0,'tbl_ExportID');

 

Gui_Approbato
Partner - Creator III
Partner - Creator III

If I understood correctly you are not using SET because you need it as a dynamic expression.

If that is the case, just use two variables.. first with LET and then define SET from LET , and pass the SET one as a parameter.

image.png