HTTP Method: POST
Url: https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/GetDataBundle
Request
{
"DataRequests":[
{
"DataTypes":[
{
"Properties":null,
"Value":"PL"
}],
"Date":
{
"End":"",
"Frequency":"",
"Kind":0,
"Start":"-10D"
},
"Instrument":
{
"Properties":null,
"Value":"VOD"
},
"Tag":null
},
{
"DataTypes":[
{
"Properties":null,
"Value":"PH"
}],
"Date":
{
"End":"-0D",
"Frequency":"D",
"Kind":1,
"Start":"-5D"
},
"Instrument":
{
"Properties":null,
"Value":"BARC"
},
"Tag":null
}],
"Properties":null,
"TokenValue":"FhzsU9Yozo3Ofml6H6D7092"
}
Response
{
"DataResponses":[
{
"AdditionalResponses":null,
"DataTypeNames":null,
"DataTypeValues":[
{
"DataType":"PL",
"SymbolValues":[
{
"Currency":"£ ",
"Symbol":"VOD",
"Type":5,
"Value":191.24
}]
}],
"Dates":["\/Date(1407715200000+0000)\/"],
"SymbolNames":null,
"Tag":null
},
{
"AdditionalResponses":null,
"DataTypeNames":null,
"DataTypeValues":[
{
"DataType":"PH",
"SymbolValues":[
{
"Currency":"£",
"Symbol":"BARC",
"Type":12,
"Value":[222.05,221.95,221.45,223.6,null]
}]
}],
"Dates":["\/Date(1408320000000+0000)\/","\/Date(1408406400000+0000)\/","\/Date(1408492800000+0000)\/","\/Date(1408579200000+0000)\/","\/Date(1408665600000+0000)\/","\/Date(1408924800000+0000)\/"],
"SymbolNames":null,
"Tag":null
}],
"Properties":null
}
{
"DataRequests":[
{
"DataTypes":[
{
"Properties":null,
"Value":"PL"
}],
"Date":
{
"End":"",
"Frequency":"",
"Kind":0,
"Start":"-10D"
},
"Instrument":
{
"Properties":null,
"Value":"VOD"
},
"Tag":null
},
{
"DataTypes":[
{
"Properties":null,
"Value":"PH"
}],
"Date":
{
"End":"-0D",
"Frequency":"D",
"Kind":1,
"Start":"-5D"
},
"Instrument":
{
"Properties":null,
"Value":"BARC"
},
"Tag":null
}],
"Properties":null,
"TokenValue":"FhzsU9Yozo3Ofml6H6D7092"
}
{
"DataResponses":[
{
"AdditionalResponses":null,
"DataTypeNames":null,
"DataTypeValues":[
{
"DataType":"PL",
"SymbolValues":[
{
"Currency":"£ ",
"Symbol":"VOD",
"Type":5,
"Value":191.24
}]
}],
"Dates":["\/Date(1407715200000+0000)\/"],
"SymbolNames":null,
"Tag":null
},
{
"AdditionalResponses":null,
"DataTypeNames":null,
"DataTypeValues":[
{
"DataType":"PH",
"SymbolValues":[
{
"Currency":"£",
"Symbol":"BARC",
"Type":12,
"Value":[222.05,221.95,221.45,223.6,null]
}]
}],
"Dates":["\/Date(1408320000000+0000)\/","\/Date(1408406400000+0000)\/","\/Date(1408492800000+0000)\/","\/Date(1408579200000+0000)\/","\/Date(1408665600000+0000)\/","\/Date(1408924800000+0000)\/"],
"SymbolNames":null,
"Tag":null
}],
"Properties":null
}
HTTP Method: POST
Url: https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/GetDataBundle
Request
<DSGetDataBundleRequest xmlns="http://dsws.datastream.com/client/V1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<DataRequests>
<DSDataRequest>
<DataTypes>
<DSDataType>
<Properties i:nil="true"/>
<Value>PL</Value>
</DSDataType>
</DataTypes>
<Date>
<End/>
<Frequency/>
<Kind>Snapshot</Kind>
<Start>-10D</Start>
</Date>
<Instrument>
<Properties i:nil="true"/>
<Value>VOD</Value>
</Instrument>
<Tag i:nil="true"/>
</DSDataRequest>
<DSDataRequest>
<DataTypes>
<DSDataType>
<Properties i:nil="true"/>
<Value>PH</Value>
</DSDataType>
</DataTypes>
<Date>
<End>-0D</End>
<Frequency>D</Frequency>
<Kind>TimeSeries</Kind>
<Start>-30D</Start>
</Date>
<Instrument>
<Properties i:nil="true"/>
<Value>BARC</Value>
</Instrument>
<Tag i:nil="true"/>
</DSDataRequest>
</DataRequests>
<Properties i:nil="true"/>
<TokenValue>FhzsU9Yozo3Ofml6HRMosEvxIAqM9t+6tOvw7K2V19omP1ls/904D06D7092</TokenValue>
</DSGetDataBundleRequest>
Response
<DSGetDataBundleResponse xmlns="http://dsws.datastream.com/client/V1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<DataResponses>
<DSDataResponse>
<AdditionalResponses i:nil="true"/>
<DataTypeNames i:nil="true"/>
<DataTypeValues>
<DSDataTypeResponseValue>
<DataType>PL</DataType>
<SymbolValues>
<DSSymbolResponseValue>
<Currency>£ </Currency>
<Symbol>VOD</Symbol>
<Type>Double</Type>
<Value i:type="a:double" xmlns:a="http://www.w3.org/2001/XMLSchema">191.24</Value>
</DSSymbolResponseValue>
</SymbolValues>
</DSDataTypeResponseValue>
</DataTypeValues>
<Dates xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:dateTime>2014-08-11T00:00:00</a:dateTime>
</Dates>
<SymbolNames i:nil="true"/>
<Tag i:nil="true"/>
</DSDataResponse>
<DSDataResponse>
<AdditionalResponses i:nil="true"/>
<DataTypeNames i:nil="true"/>
<DataTypeValues>
<DSDataTypeResponseValue>
<DataType>PH</DataType>
<SymbolValues>
<DSSymbolResponseValue>
<Currency>£</Currency>
<Symbol>BARC</Symbol>
<Type>DoubleArray</Type>
<Value i:type="a:ArrayOfdouble" xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:double>222.05</a:double>
<a:double>221.95</a:double>
<a:double>221.45</a:double>
<a:double>223.6</a:double>
<a:double>NaN</a:double>
</Value>
</DSSymbolResponseValue>
</SymbolValues>
</DSDataTypeResponseValue>
</DataTypeValues>
<Dates xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:dateTime>2014-08-19T00:00:00</a:dateTime>
<a:dateTime>2014-08-20T00:00:00</a:dateTime>
<a:dateTime>2014-08-21T00:00:00</a:dateTime>
<a:dateTime>2014-08-22T00:00:00</a:dateTime>
<a:dateTime>2014-08-25T00:00:00</a:dateTime>
</Dates>
<SymbolNames i:nil="true"/>
<Tag i:nil="true"/>
</DSDataResponse>
</DataResponses>
<Properties i:nil="true"/>
</DSGetDataBundleResponse>
<DSGetDataBundleRequest xmlns="http://dsws.datastream.com/client/V1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<DataRequests>
<DSDataRequest>
<DataTypes>
<DSDataType>
<Properties i:nil="true"/>
<Value>PL</Value>
</DSDataType>
</DataTypes>
<Date>
<End/>
<Frequency/>
<Kind>Snapshot</Kind>
<Start>-10D</Start>
</Date>
<Instrument>
<Properties i:nil="true"/>
<Value>VOD</Value>
</Instrument>
<Tag i:nil="true"/>
</DSDataRequest>
<DSDataRequest>
<DataTypes>
<DSDataType>
<Properties i:nil="true"/>
<Value>PH</Value>
</DSDataType>
</DataTypes>
<Date>
<End>-0D</End>
<Frequency>D</Frequency>
<Kind>TimeSeries</Kind>
<Start>-30D</Start>
</Date>
<Instrument>
<Properties i:nil="true"/>
<Value>BARC</Value>
</Instrument>
<Tag i:nil="true"/>
</DSDataRequest>
</DataRequests>
<Properties i:nil="true"/>
<TokenValue>FhzsU9Yozo3Ofml6HRMosEvxIAqM9t+6tOvw7K2V19omP1ls/904D06D7092</TokenValue>
</DSGetDataBundleRequest>
<DSGetDataBundleResponse xmlns="http://dsws.datastream.com/client/V1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<DataResponses>
<DSDataResponse>
<AdditionalResponses i:nil="true"/>
<DataTypeNames i:nil="true"/>
<DataTypeValues>
<DSDataTypeResponseValue>
<DataType>PL</DataType>
<SymbolValues>
<DSSymbolResponseValue>
<Currency>£ </Currency>
<Symbol>VOD</Symbol>
<Type>Double</Type>
<Value i:type="a:double" xmlns:a="http://www.w3.org/2001/XMLSchema">191.24</Value>
</DSSymbolResponseValue>
</SymbolValues>
</DSDataTypeResponseValue>
</DataTypeValues>
<Dates xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:dateTime>2014-08-11T00:00:00</a:dateTime>
</Dates>
<SymbolNames i:nil="true"/>
<Tag i:nil="true"/>
</DSDataResponse>
<DSDataResponse>
<AdditionalResponses i:nil="true"/>
<DataTypeNames i:nil="true"/>
<DataTypeValues>
<DSDataTypeResponseValue>
<DataType>PH</DataType>
<SymbolValues>
<DSSymbolResponseValue>
<Currency>£</Currency>
<Symbol>BARC</Symbol>
<Type>DoubleArray</Type>
<Value i:type="a:ArrayOfdouble" xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:double>222.05</a:double>
<a:double>221.95</a:double>
<a:double>221.45</a:double>
<a:double>223.6</a:double>
<a:double>NaN</a:double>
</Value>
</DSSymbolResponseValue>
</SymbolValues>
</DSDataTypeResponseValue>
</DataTypeValues>
<Dates xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:dateTime>2014-08-19T00:00:00</a:dateTime>
<a:dateTime>2014-08-20T00:00:00</a:dateTime>
<a:dateTime>2014-08-21T00:00:00</a:dateTime>
<a:dateTime>2014-08-22T00:00:00</a:dateTime>
<a:dateTime>2014-08-25T00:00:00</a:dateTime>
</Dates>
<SymbolNames i:nil="true"/>
<Tag i:nil="true"/>
</DSDataResponse>
</DataResponses>
<Properties i:nil="true"/>
</DSGetDataBundleResponse>
Sub RetrieveDataBundleForHttpPOST()
Const URL = "https://product.datastream.com/dswsclient/V1/DSService.svc/rest/"
Dim Token As String: Token = GetTokenToUse()
Dim PostData As String: PostData = DataRequestBundleForHttpPOST()
Dim DswsSvc As New MSXML2.XMLHTTP
DswsSvc.Open "POST", URL + "GetDataBundle", False
DswsSvc.setRequestHeader "Content-Type", "application/xml"
DswsSvc.setRequestHeader "Accept", "application/xml"
DswsSvc.send PostData
Dim ResponseDoc As New MSXML2.DOMDocument
ResponseDoc.LoadXML (DswsSvc.responseText)
If ResponseDoc.ChildNodes(0).nodeName = "DSFault" Then
MsgBox ResponseDoc.SelectSingleNode("//Message").Text, vbCritical, "Datastream Web Service GetDataBundle Error"
Exit Sub
End If
InterpretDataResponse ResponseDoc.SelectNodes("//DSDataResponse")
End Sub
Sub RetrieveDataBundleForHttpPOST()
' Gets data bundle for a given request
' This method uses HTTP POST passing the request parameters as xml post data
' The data exchange format is XML
Const URL = "https://product.datastream.com/dswsclient/V1/DSService.svc/rest/"
' Get Token
' Here GetTokenToUse() reads a stored token (got thro' GetToken)
' Note that you need not get a token everytime you want to get data
Dim Token As String: Token = GetTokenToUse()
' Form the post data containing our request
' Refer "Understanding Requests" section
Dim PostData As String: PostData = DataRequestBundleForHttpPOST()
' Issue the request to server
Dim DswsSvc As New MSXML2.XMLHTTP
DswsSvc.Open "POST", URL + "GetDataBundle", False
DswsSvc.setRequestHeader "Content-Type", "application/xml"
DswsSvc.setRequestHeader "Accept", "application/xml"
DswsSvc.send PostData
' Load the response xml
Dim ResponseDoc As New MSXML2.DOMDocument
ResponseDoc.LoadXML (DswsSvc.responseText)
' Check for errors
If ResponseDoc.ChildNodes(0).nodeName = "DSFault" Then
MsgBox ResponseDoc.SelectSingleNode("//Message").Text, vbCritical, "Datastream Web Service GetDataBundle Error"
Exit Sub
End If
' Interpret the response
' Refer "Understanding Responses" section
InterpretDataResponse ResponseDoc.SelectNodes("//DSDataResponse")
End Sub