Hi Mountainner,
Thank you for the
WEBSERVICE link I did not know and it gives a starting point.
In fact for my extensions I use the
Python Request API, one of the easiest HTTP request APIs to use.
As I use it from different extensions, I finally managed to port the Request API to UNO and should therefore also be accessible to BASIC.
This port of the Request API provides two new interfaces under UNO:
These two new interfaces try to mimic as closely as possible that of the Request API, especially for XRequestResponse which allows:
- To know the status of the HTTP request.
- To access the content of the request as a binary stream XEnumeration.
- To manage the tokens of the following pages found in the JSON or XLM APIs of google Drive API or Microsoft graph, allowing the execution of requests in a loop.
The use is very simple:
- Create the UNO service:
Code: Select all
session = CreateUnoService("io.github.prrvchr.OAuth2OOo.OAuth2Service")
- If you want to use OAuth2 initialize session (optionnal):
Code: Select all
session.initializeSession(url, emailaddress)
- Get a Request Parameter:
Code: Select all
parameter = session.getRequestParameter("aname")
- Set a least an URL and the NoAuth properties (the default HTTP request method is GET):
- Get the HTTP response from parameter:
Code: Select all
response = session.execute(parameter)
- do what you have to do with your response then:
With this new UNO API, I think it will be quite easy for the
OAuth2Service service to offer a method:
Code: Select all
pullToCalc(XRequestParameter, ThisComponent, contenttype)
(with contenttype as a
ContentType) allowing to suck web pages in Calc.
I have to create a dialog box to set the properties of XRequestParameter, that's not too complicated.
The Calc part is accessing the correct cell and injecting the data. For this part I cruelly lack skills.