I am trying to access an API using the REST feature. But I can't retrieve the data.
Here the code
Dim Session As New NotesSession
Dim ret As Variant
Dim URL As String
Dim headers As Variant
Dim webRequest As NotesHTTPRequest
Set webRequest = session.createhttprequest()
URL = "https://www.meteoblue.com/en/server/search/query3?query=basel"
ret = webrequest.Get(URL)
Messagebox ret
I already solved my previous problem with this solution, but I have another error now. When I run this code, I get the following error (The problem is with "ret"):
Type mismatch in method OP_CHECK_TOS_BYVAL : BYTE found, Unknown expected
Does anyone have any idea what the problem is?
I repeat myself like a broken record: Add error handler to EVERY LINE OF CODE.
In your example you have exactly 4 lines of code where something can go wrong. And nevertheless you can't find out, which of the 4 lines causes the error if you don't use error handling (of course you could by using the debugger, but this is another story...).
Without an error handler I can only guess, that your error comes from this line:
Messagebox ret
ret is defined as Variant and the help of the function tells you, that it will return a byte array:
Return value Variant
Returns Variant content as JSON UTF8 byte array. Use the preferstrings property to return Unicode rather than UTF8 byte array.
But Messagebox expects a String as parameter --> Type mismatch...