Excellent, after changing my code to this...
Public Property Get HubEndpoint() As String
'Endpoint that CAFE connects to
HubEndpoint = "pmhub/pm/tm1/"
End Property
Public Property Get OData(Server As String) As String
'OData endpoint
OData = "tm1/" + Server + "/api/v1"
End Property
Public Property Get Current() As String
Current = Reporting.Settings.GetValue("MruServer")
End Property
Public Function GetCurrentServer() As String
Dim sServerCubeMRU As String
Dim sServerCube As Variant
Dim sServer As String
sServerCubeMRU = Reporting.Settings.GetValue("MruPackage")
sServerCubeMRU = Mid(sServerCubeMRU, 2, Len(sServerCubeMRU) - 2)
sServerCube = Split(sServerCubeMRU, ",")
sServer = Split(sServerCube(0), ":")(1)
GetCurrentServer = Mid(sServer, 3, Len(sServer) - 3)
End Function
Public Function oDataGet(path As String) As String
'Public Function oDataGet(path As String) As JSONObjectWrapper
'Dim result As New JSONParser
'Dim response As Object
Dim response As String
Dim theConnection As Object
Set theConnection = Reporting.getConnection(Current)
response = Reporting.getConnection(Current).Get(OData(GetCurrentServer) & "/" & path).toString()
MsgBox (response)
End Function
Public Sub doGetThreads()
Dim aWrapper As String
aWrapper = oDataGet("")
End Sub
I received the following pop-up...
… which is what I was expecting. Now that I can connect using the REST API I should be able to muddle my way through to do what I'm hoping using the IBM PAX API.
Thanks,
------------------------------
Wayne
------------------------------
Original Message:
Sent: Tue October 15, 2019 08:51 PM
From: Hubert Heijkers
Subject: Using REST with PAX API in Cloud
Hi Wayne,
I think the sample in the documentation is a tad outdated (read: I, preparing for a Hands-on Lab, noticed my samples didn't work any longer either).
The path to the TM1 server's REST resources has changed which, in your sample, can be fixed by changing the OData property (a very poorly chosen name for this property function IMHO) in:
OData = "tm1/" + Server + "/api/v1"
That fixed this issue for me.
------------------------------
Hubert Heijkers
------------------------------
Original Message:
Sent: Tue October 15, 2019 12:29 AM
From: Wayne Deleersnyder
Subject: Using REST with PAX API in Cloud
Apologies it took some time to reply.
This is the code that I'm using... it's a modified copy and paste of the IBM PAX API code (https://ibm.github.io/paxapi/#rest-api)
Public Property Get OData(Server As String) As String 'OData endpoint OData = HubEndpoint + "server('" + Server + "')/api/v1"End PropertyPublic Property Get Current() As String Current = Reporting.Settings.GetValue("MruServer")End PropertyPublic Function GetCurrentServer() As String Dim sServerCubeMRU As String Dim sServerCube As Variant Dim sServer As String sServerCubeMRU = Reporting.Settings.GetValue("MruPackage") sServerCubeMRU = Mid(sServerCubeMRU, 2, Len(sServerCubeMRU) - 2) sServerCube = Split(sServerCubeMRU, ",") sServer = Split(sServerCube(0), ":")(1) GetCurrentServer = Mid(sServer, 3, Len(sServer) - 3)End FunctionPublic Function oDataGet(path As String) As String'Public Function oDataGet(path As String) As JSONObjectWrapper 'Dim result As New JSONParser 'Dim response As Object Dim response As String Dim theConnection As Object Set theConnection = Reporting.getConnection(Current) response = Reporting.getConnection(Current).Get(OData(GetCurrentServer) & "/" & path) MsgBox (response)End FunctionPublic Sub doGetThreads() Dim aWrapper As String aWrapper = oDataGet("")End Sub
When I step through the code it resolves the server correctly but when it retrieves the response it returns the 404 error. This is just a test at this point. I'm trying to simulate a REST call that I'm able to successfully perform. I'm not including any wrappers, etc... I just want a response, which I'm not getting. My expectation is that this would be similar to https://[SERVER].planning-analytics.ibmcloud.com/tm1/api/
------------------------------
Wayne
Original Message:
Sent: Fri October 11, 2019 02:07 PM
From: Ted Phillips
Subject: Using REST with PAX API in Cloud
If you could provide a sample, we may be able to give some more direct advice.
You should be able to post to the ExecuteMDX action with the query payload, and PA for Excel's REST api VBA facility should help with any processing of the JSON reply on a successful call.
404 implies more that the uri component of the vba call was incorrect, as Tim said.
------------------------------
Ted Phillips