For POST method I have this piece of code in LR (it is working):
web_custom_request(transname,
URL,
"Method=POST",
"TargetFrame=",
"Mode=HTML",
"Resource=0",
"Referer=",
EncodingType,
lr_eval_string(request),
LAST);
This piece of code is placed in a separated .c file and called from user_init using a long sequence of related functions working with XML, arrays, strings data.
URL for POST requests has structure in user_init like this: URL=https://{HOST}/aaa/bbb/page.asp
Also user_init contains this piece of code:
web_custom_request("Login_page",
"URL=http://{HOST}/api/04_00/Pr_NAME.asp",
"Method=POST",
"RecContentType=text/xml",
"Body="
"<?xml version=\"1.0\"?>"
"<Request xmlns=\"http://api.rr.com/Pr_NAME\">\r\n"
" <MethodRequest>\r\n"
" <AuthenticateUserRequest appID=\"value_appID\" password=\"value_password\">\r\n"
" <User>\r\n"
" <LoginName>value_LoginName</LoginName>\r\n"
" </User>\r\n"
" </AuthenticateUserRequest>\r\n"
" </MethodRequest>\r\n"
"</Request>\r\n",
LAST);
I need something additional to this code, that will allow to send both POST and GET requests to web-service. Now it sends only POST requests.
There are some questions:
1) How should I change this function to get the possibility to send both types of requests, POST and GET? What strings should I add to this function?
2) How should I change the URL for GET requests?
I think, it should be something like this:
URL=https://{HOST}/aaa/bbb/page.asp?param1=value1¶m2=value2...¶mN=valueN
But what parameters should I add as param1, param2, ..., paramN?
How to define, how many and what parameters I need put in this URL construction?
Should I write this structure:
URL=http://{HOST}/api/04_00/Pr_NAME.asp?appID=value_appID&password=value_password&LoginName=value_LoginName
or shouldn't I add LoginName=value_LoginName in this structure?
3) How can I combine both 2 methods POST and GET in 1 function, to have the possibility to send both types of requests, POST and GET, from LR?
Please, could you help me? I'm a novice in data transferring in LR using POST and GET methods and functions.