<universes>
<universe>
<id>6773</id>
<cuid>AXyRzvmRrJxLqUm6_Jbf7lE</cuid>
<name>efashion.unx</name>
<type>unx</type>
<folderId>6771</folderId>
</universe>
<universe>
<id>5612</id>
<cuid>AYCKrid6ngFGvrKlwVfZKj4</cuid>
<name>Salary.unv</name>
<type>unv</type>
<folderId>509</folderId>
</universe>
...
</universes>
Public Sub refreshListUnivers()
Dim objHTTP As WinHttp.WinHttpRequest
Dim objXML As MSXML2.DOMDocument
Dim oNodeXML, oSubNodeXML As MSXML2.IXMLDOMNode
Dim folderId, errorCodeREST, t As String
Dim i, l As Integer
Call logon
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
Set objXML = CreateObject("Microsoft.XMLDOM")
'clear worksheet
Sheets("liste univers").Range("A2:Z65000").ClearContents
l = 0
Do
url = boUrlSL & "/universes?offset=" & l & "&limit=50"
Debug.Print url
objHTTP.Open "GET", url, False
objHTTP.SetRequestHeader "Content-type", "application/xml"
objHTTP.SetRequestHeader "Accept", "application/xml"
objHTTP.SetRequestHeader "X-SAP-LogonToken", boToken
objHTTP.Send ""
errorCodeREST = getErrorCodeREST(objHTTP)
If errorCodeREST <> "" And errorCodeREST <> "WSR 00400" Then
Call afficheErrorREST(objHTTP, "RefreshlistUnivers", "Error getting list of universes")
Call logoff
End
End If
objXML.LoadXML (objHTTP.ResponseText)
'Debug.Print objHTTP.ResponseText
i = 0
For Each oNodeXML In objXML.SelectNodes("/universes/universe")
t = "/universes/universe[" & i & "]"
Sheets("liste univers").Cells(l + 2, 1) = objXML.SelectSingleNode(t & "/id").Text
Sheets("liste univers").Cells(l + 2, 2) = objXML.SelectSingleNode(t & "/cuid").Text
Sheets("liste univers").Cells(l + 2, 4) = objXML.SelectSingleNode(t & "/type").Text
folderId = objXML.SelectSingleNode(t & "/folderId").Text
Sheets("liste univers").Cells(l + 2, 3) = getFolder(folderId)
Sheets("liste univers").Cells(l + 2, 5) = Decode_UTF8(objXML.SelectSingleNode(t & "/name").Text)
l = l + 1
i = i + 1
Next
Loop While i > 0
logoff:
Call logoff
End Sub
<entry xmlns="http://www.w3.org/2005/Atom"> <author><name>System Account</name></author> <id>tag:sap.com,2010:bip-rs/AWItAeqx.FpBgqTpFH8LqwE</id>
Business Intelligence Platform RESTful Web Service Developer Guide
API reference © 2014 SAP SE or an SAP affiliate company. All rights reserved. 93
<title type="text">Root Folder 99</title> <updated>2011-04-14T10:27:50.969Z</updated> <link href="http://localhost:6405/biprws/infostore/99/children" rel="http://www.sap.com/rws/bip#children"></link> <link href="http://localhost:6405/biprws/infostore/Application%20Folder" rel="up"></link> <content type="application/xml"> <attrs xmlns="http://www.sap.com/rws/bip"> <attr name="id" type="int32">99</attr> <attr name="description" type="string" null="true"></attr> <attr name="cuid" type="string">AWItAeqx.FpBgqTpFH8LqwE</attr><attr name="description" type="string" null="true"></attr> <attr name="name" type="string">Root Folder 99</attr> <attr name="type" type="string">Folder</attr> </attrs> </content></entry>
Private Function getAttribute(o As WinHttp.WinHttpRequest, name As String)
Dim tmpXML As MSXML2.DOMDocument
Dim node As MSXML2.IXMLDOMNode
Set tmpXML = CreateObject("Microsoft.XMLDOM")
tmpXML.LoadXML (o.ResponseText)
'recup attribut
For Each node In tmpXML.SelectNodes("//attrs/attr")
If node.Attributes.getNamedItem("name").Text = name Then getAttribute = node.Text
Next
End Function
Private Function getFolder(id)
Dim tmpHTTP As WinHttp.WinHttpRequest
Dim tmpXML As MSXML2.DOMDocument
Dim s As String
url = boUrl & "/infostore/" & id
Debug.Print url
Set tmpHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
tmpHTTP.Open "GET", url, False
tmpHTTP.SetRequestHeader "Accept", "application/xml"
tmpHTTP.SetRequestHeader "X-SAP-LogonToken", boToken
tmpHTTP.Send ""
If tmpHTTP.Status <> "200" Then
Call afficheErrorREST(tmpHTTP, "getFolder", "Error gettin folder " & id)
Else
s = getAttribute(tmpHTTP, "name")
getFolder = Decode_UTF8(s)
End If
End Function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |