Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Does anyone have working example of such an implementation?
I can use variable withing URL but not as query header.
In below example:
let v='Assignments';
let v2='Authorization%2WRAP access_token%%2%%3client%%2336b434e68de4f97ba5ad160.26395&user_token%%2db2b40ac154c4dbeb36f5e686899b211.26395%%3%1Accept%2application/json';
CUSTOM CONNECT TO "Provider=QvRestConnector.exe;url= https://api.dovico.com/$(v)/?version=5;
timeout=30;method=GET;autoDetectResponseType=true;
keyGenerationStrategy=3;useWindowsAuthentication=false;useCertificate=No;
certificateStoreLocation=CurrentUser;certificateStoreName=My;queryParameters=version%25;
queryHeaders=$(v2);
PaginationType=None;
XUserId=BIZYJNJbaCGLA;
XPassword=cJfbZSUEQLYGXZdOPTcIWMFTcSEXVKLLJCTaB;";
the first variable v works but the second v2 throws an error:
Parameter "$(v2)" has no value, or a misplaced semicolon.
CUSTOM CONNECT TO "Provider=QvRestConnector.exe;url= https://api.dovico.com/Assignments/?version=5;
timeout=30;method=GET;autoDetectResponseType=true;
keyGenerationStrategy=3;useWindowsAuthentication=false;useCertificate=No;
certificateStoreLocation=CurrentUser;certificateStoreName=My;queryParameters=version%25;
queryHeaders=$(v2);
PaginationType=None;
XUserId=BIZYJZJbaCGLA;
XPassword=cJfbZSUEQLYGXZdOPTcDCJMFTcSEXVKLLJCTaB;"
The intial CUSTOM CONNECT statement is valid until a SQL SELECT with the WITH CONNECTION statement is executed. The parameters mentioned in the WITH CONNECT statement will override any of the headers, url, query and body paremeters. You don't need to change the URL if that is static. You can easily change some or all of the QUERY parameters of the URL by just using the QUERY part of WITH CONNECTION or HTTPHEADER.
You should in other words only modify what you need to.
The contents of your v2 variable seems a bit odd to me. Is this a composition of multiple headers?
The proper way of overriding URL, query parameters, headers or body dynamically it using the WITH CONNECTION clause as part of your SELECT statement:
The format:
<select_stmt> WITH CONNECTION (<connection_item> {,<connection_item>})
connection_item = URL "new url" | QUERY "param name" "param value" | HEADER "header name" "header value" | BODY "request body text"
Example:
I can not see any variable used here.
Could you give more details,please?
You can put $-sign expansion of variables like you normally would like this:
FOR i=1 TO 20
paramURL = 'http:.....$(i)....';
....
headerToken = 'adklfjadflkjasdskdfljf';
SQL SELECT
....
....
WITH CONNECTION (
URL "$(paramURL)",
QUERY "type" "$(querystringType)",
QUERY "size" "$(querystringSize)",
HTTPHEADER "auth_type" "$(headerAuthType)",
HTTPHEADER "auth_token" "$(headerToken)"
);
NEXT
Thank you, Petter.
How the REST - CUSTOM CONNECT header will then look like?
What will be the parameter for URL?
Generic or empty or...?
The intial CUSTOM CONNECT statement is valid until a SQL SELECT with the WITH CONNECTION statement is executed. The parameters mentioned in the WITH CONNECT statement will override any of the headers, url, query and body paremeters. You don't need to change the URL if that is static. You can easily change some or all of the QUERY parameters of the URL by just using the QUERY part of WITH CONNECTION or HTTPHEADER.
You should in other words only modify what you need to.
The contents of your v2 variable seems a bit odd to me. Is this a composition of multiple headers?
All works now.
Thank you Petter for your time.
Can I also use pagination parameters in "with connection"-statement?
Yes you can. If you choose Custom Pagination that is how you have to do it.
Petter:
I believe to have a similar problem, but I am not quite sure if I understand everything.
I have the following API: https://api.census.gov/data/2015/acs5?get=NAME,GEOID,B17024_001E,B17024_001M,B17024_002E,B17024_002M...
In the example above, I am not able to use in=state:* - a wildcard, and was looking for a solution how to create a dynamic variables
Thanks for your input.
Branislav