Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Search the Community

Showing results for tags 'post'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 5 results

  1. Hello, I'm trying to make a method in my C# application which either turns on or off a Wall Plug. If I'm using the POST method/devices/{deviceID}/action/{actionName} on the "FibaroIpAddress/docs" API website, it works e.g. when I type in 11 as deviceId and turnOn/turnOff in actionName. the website then tells me that the request URL will look like this: http://IpAddress/api/devices/11/action/turnOff or http://IpAddress/api/devices/11/action/turnOn In my application I then use the same request URL with the code: try { var endPoint = new Uri(url); //stores credentials for the API access var cache = new CredentialCache { { endPoint, "Basic", new NetworkCredential(userName, password) } }; // Create a new request to the URL endpoint. var request = WebRequest.Create(endPoint); // Adds credentials to the WebRequest. request.Credentials = cache; //Assign the response object of 'WebRequest' to a 'WebResponse' variable using (var response = request.GetResponse()) { //Reads everything from the API call and stores it. using (var reader = new StreamReader(response.GetResponseStream())) { toReturn = reader.ReadToEnd(); } } } catch (UriFormatException e) { Console.WriteLine("Error:" + e); } But nothing happens when this runs. I've also tried this code: // Creates a endpoint to the url. var endpoint = new Uri(url); // Creates credentials for the endpoint. var cache = new CredentialCache { { endpoint, "Basic", new NetworkCredential(userName, password) } }; // Creates a new request and sets credentials. var request = (HttpWebRequest)WebRequest.Create(endpoint); request.Credentials = cache; // Specifies request. request.Method = "POST"; request.ContentType = "application/json"; request.Timeout = 5000; // Gets a streamObject to use to write request data. var dataStream = request.GetRequestStream(); // Sends the data. dataStream.Flush(); But nothing happens here either. I've use the same code for different GET requests or PUT requests (e.g. change name of device) and it works. I've also tried to just run the request URL directly into my browser, but nothing happens there either. Does someone know what I'm doing wrong?
  2. Hi to all, Sorry if I started a new discussion but I don't find information about my doubt. My main need is to send some information from an external server to HC2 ... to a scena ... or a virtual device... I try to call HC2 through API from another server using REST API but i cannot find the correct syntax to ... for examples "press a button " in a virtual devices... There is someone that can help me? Thanks a lot in advance Paolino
  3. Hej, Czy komuś z Was może udało się przy pomocy urządzenia wirtualnego (HCL - bez LUA) zawołać akcje na jakimś urządzeniu wykorzystując REST API? Pogrzebałem na forum, ale nic z podanych rozwiązań nie działa...
  4. Hi, I'm trying to test the REST API via PHP. GET is ok, I'm able to read and display each data in my application. Now I want to test the POST and PUT API. I tryed to change a device name, but nothing happens. This is my code: $dati = '{"id":197,"name":"zanna","roomID":6,"type":"com.fibaro.motionSensor","baseType":"com.fibaro.lifeDangerSensor","enabled":true,"visible":true,"isPlugin":false,"parentId":195,"remoteGatewayId":0,"interfaces":["fibaroAlarm","fibaroAlarmArm","fibaroBreach","tamper","zwave","zwaveSceneActivation"],"properties":{"parameters":[{"id":1,"lastReportedValue":0,"lastSetValue":0,"size":2,"value":0},{"id":2,"lastReportedValue":0,"lastSetValue":0,"size":2,"value":0},{"id":3,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":4,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":5,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":6,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":7,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":8,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":9,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":10,"lastReportedValue":20,"lastSetValue":20,"size":1,"value":20},{"id":11,"lastReportedValue":200,"lastSetValue":200,"size":1,"value":200},{"id":12,"lastReportedValue":8,"lastSetValue":8,"size":1,"value":8},{"id":13,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":14,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0}],"zwaveCompany":"Fibargroup","zwaveInfo":"3,3,52","zwaveVersion":"2.1","pollingTimeSec":0,"alarmDelay":"0","alarmExclude":"false","alarmTimeTimestamp":"0","armConditions":"{}","armConfig":"0","armDelay":"0","armError":"{}","armTimeTimestamp":"0","armed":"false","configured":"true","dead":"false","deviceControlType":"0","deviceIcon":"21","emailNotificationID":"0","emailNotificationType":"0","endPointId":"1","fibaroAlarm":"false","lastBreached":"1479350609","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"true","model":"","nodeId":"38","parametersTemplate":"85","productInfo":"1,15,5,1,16,2,2,1","pushNotificationID":"0","pushNotificationType":"0","remoteGatewayId":"0","saveLogs":"true","sceneActivation":"0","serialNumber":"","smsNotificationID":"0","smsNotificationType":"0","tamper":"false","useTemplate":"true","userDescription":"","value":"false"},"actions":{"forceArm":0,"meetArmConditions":0,"reconfigure":0,"sceneActivationSet":0,"setArmed":1},"created":1478196735,"modified":1478196735,"sortOrder":112}'; $stringa_dati = json_encode($dati); // Get cURL resource $curl = curl_init(); // Set some options - we are passing in a useragent too here curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $stringa_dati, CURLOPT_HTTPHEADER => array('Content-Type: application/json','Content-Length: ' . strlen($stringa_dati)), CURLOPT_URL => $ZanGeneric->domotica_hc2_api . '/devices/197', CURLOPT_TIMEOUT => 5, CURLOPT_USERAGENT => 'Codular Sample cURL Request' )); // Send the request & save response to $resp $resp = curl_exec($curl); //Trasformo la stringa in un oggetto JSON $obj = json_decode($resp,true); // Close request to clear up some resources curl_close($curl); Is there someone can send an example? Thanks
  5. Hi folks, A bit of a puzzler I'm hoping that some of our http/api specialist might be able to offer some advice I'm working with openremote and at it's heart are http calls to the HC2 api I have a GET request working but when I try and create a POST request in a similar manner it doesn't seem to work (both work in a browser) Are their some special conditions/setting that a POST must have that a GET doesn't GET - http://192.168.1.90:80/api/devices/92 POST - http://192.168.1.90:80/api/callAction?deviceID=92&name=setValue&arg1=55 I spent a day on this - all suggestions welcome......
×
×
  • Create New...