enableiot / iotkit-api

External API service for enableiot.com
https://dashboard.us.enableiot.com
BSD 2-Clause "Simplified" License
21 stars 7 forks source link

Submit Data (C-API) ERROR 1404 #7

Closed valekuro closed 8 years ago

valekuro commented 8 years ago

[RESOLVED]

Hi guys,

i've an issue with submitData(..) API method.

response = listAllComponentCatalogs(); printf("Response Received :%s\n", response);

says: trueResponse Received :{"code":200,"data":[{"dimension":"actua13","version":"1.0","type":"actuator","id":"actua13.v1.0","href":"http://dashboard.us.enableiot.com/v1/api/accounts/f4b1e5f2-4604-4e68-a37c-c802d2573097/cmpcatalog/actua13.v1.0"},{"id":"humidity.v1.0","dimension":"humidity","type":"sensor","version":"1.0","href":"http://dashboard.us.enableiot.com/v1/api/accounts/f4b1e5f2-4604-4e68-a37c-c802d2573097/cmpcatalog/humidity.v1.0"},{"id":"powerswitch.v1.0","dimension":"powerswitch","type":"actuator","version":"1.0","href":"http://dashboard.us.enableiot.com/v1/api/accounts/f4b1e5f2-4604-4e68-a37c-c802d2573097/cmpcatalog/powerswitch.v1.0"},{"id":"temperature.v1.0","dimension":"temperature","type":"sensor","version":"1.0","href":"http://dashboard.us.enableiot.com/v1/api/accounts/f4b1e5f2-4604-4e68-a37c-c802d2573097/cmpcatalog/temperature.v1.0"}]}

next i've try to upload a temperature status with cacheSensorList("temperature.v1.0", "temperature", "sensor"); char *response_temperature; response_temperature = submitData("temperature", "26.15"); printf("Response Received :%s\n", response_temperature);

But this generate an error server-side:

Response Received :{"code":404,"data":{"code":1404,"message":"Device not found in IoT cloud. Try initializing and activating the device once again."}}

Please help me!!

marcinma commented 8 years ago

Hi, First of your call is getting Catalog - this is a list of types of components/sensors you can create and attach to your device. This is not list of sensors, it is more like templates of sensors you can create. You are probably trying to send data before creating device, creating component (of type temperature.v1.0) and before adding this component to device. Please read https://github.com/enableiot/iotkit-api/wiki/Device-Management to get knowledge how to create device and Add a Component to a device. Best regards Marcin

valekuro commented 8 years ago

Hi, After creating the component, I used the "add component" function, then with "submit data" function I sent data on IoT cloud and it seems to work! Thanks for your help :)

`char *response_comp=NULL;
 ComponentCatalog *cmpObject = createComponentCatalogObject("temper", "1.0", "sensor", Number", "float", "Degrees Celsius", "timeSeries");
        addMinValue(cmpObject, -150.0f);
        addMaxValue(cmpObject, 150.0f);

        response_comp = createAnComponentCatalog(cmpObject);
        char *response = NULL;
        response = listAllComponentCatalogs();

            char *response_problema = NULL;
            response_problema = addComponent("temper", "temperature.v1.0");

            char *response_temperature;
            response_temperature = submitData("temper", "26");`