Trouble receiving data on device // Send from C# API


#1

I am able to send data from the device without issue using the Python SDK.

I am using the C# API to send data to my Device(s). The method returns success so I know that it has made it as far as the Hologram backend but it does not arrive on the device. The same data sent from the Dashboard is received. I am using the Python SDK on a linux device. I am not sure what is missing. The documentation is a bit sparse for this functionality. There is no error message the data simply does not arrive on the device.

Please see code below (DeviceID and APIKey have been modified for security). Any thoughts will be appreciated.

Code:

http://www.nex-tech.biz:1109/Mailit.aspx?Recipient=mfuriate@nex-tech.biz&Subject=Test&Body=<<device_name>><><>

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.Http;

namespace HologramAPI_1
{

public partial class Form1 : Form
{

    public Form1()
    {
        InitializeComponent();
    }


    private async void cmdRun_Click(object sender, EventArgs e)
    {
        txtMsg.Text = "";
        txtMsg.Text = "Sending Data";
        var baseAddress = new Uri("https://dashboard.hologram.io/");
        using (var httpClient = new HttpClient { BaseAddress = baseAddress })
        {

            using (var content = new StringContent("{  \"apikey\": \"1234\", \"deviceid\": \"1234 \",  \"protocol\": \"TCP\",  \"port\": 4010,  \"data\": \"Send Update\"}", System.Text.Encoding.Default, "application/json"))

            {
                using (var response = await httpClient.PostAsync("api/1/csr/rdm", content))
                {
                    string responseData = await response.Content.ReadAsStringAsync();
                    txtMsg.Text = responseData;
                }
            }
        }

    }
}

}


closed #2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.