xlively conversion from Pachube Feed VB.net

50 Views Asked by At

Trying to convert and old Pachube feed to Xively using Visual Studio 2013. Receive a 400 error.

Here is a snippet of my code base.It still works with my old pachube feed but after changing to xlivey api no longer works.

Dim PachubeStream As String = timestamp + "," + PT1Meter + "," + PT2Meter + "," + LevelOffset + "," + CurrentLevel + "," + PT1Raw + "," + PT2Raw + "," + PT1Offset + "," + PT2Offset + "," + RateofRise + "," + PeakRateofRise
'prepare to Upload the latest changed data to pachube for on-line data storage and plotting

Dim myWebClient As New WebClient()     
uploaddatapachubekey = TextBox7.Text
myWebClient.Headers.Add("X-ApiKey", uploaddatapachubekey)
' Apply ASCII Encoding to obtain the string as a byte array.
Dim byteArray As Byte() = Encoding.ASCII.GetBytes(PachubeStream)
'added 11/11/2010
'configure uploaddata pachube port url
uploaddatapachubeport = "https://api.xively.com/v2/feeds/" + pachubeport + ".csv"
'UploadData input string using Http 1.0 PUT Method if not in test mode
'added 11/11/2010
If TestMode = False Then myWebClient.UploadData(uploaddatapachubeport, "put", byteArray)
1

There are 1 best solutions below

0
Ken On

Solved my own problem. Issue was the new format of all data submission is "Channel Name",Timestamp UTC Format,Channel Data VBCRLF

i.e.

Dim PachubeStream As String = "PT1Meter"+","+timestamp+","+PT1Meter