FlapIt - Panel de usuario
Avanzar al contenido principal
en
it
de
fr
pt
ru
es
zh
Estás navegando por nuestro servidor seguro.

POST /control/group endpoint

This call sends a command to a named group of devices, specified in the web UI. The request must contain the following fields:

  • group_id -- The name of the group, chosen by the user in the web UI.
  • token -- a string. This should be the token given to the user from the web UI.
  • message -- a string containing the symbols to be displayed on the Flapit devices

Every device has a program associated to it, which is responsible for sending commands to the device. Multiple devices can be assigned the same program from the Flapit web UI, in which case they will be assigned a group name. When the API control is activated for such a group, the previous program controlling the group will be suppressed and the user will be fully responsible for managing the group through the API. Deactivating the API control will restore the previous program assigned to the group.

If you want to have a default automatic behavior for a Flapit device but still want to send direct commands occasionally, you should use the 'control/device' API call.

Examples

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"group_id": "GROUP_ID", "token": "USER_ACCESS_TOKEN", "message": ":) FLAPIT"}' \
  https://www.flapit.com/control/group
var request = require('request');

function show(message, callback) {
  request.post({
    url:'https://www.flapit.com/control/group',
    form: {
      'group_id': "GROUP_ID",
      'token': "USER_ACCESS_TOKEN",
      "message": message
    }
  }, callback);
}

show(":) FLAPIT");
import json, requests

def show(message):
  data = {'group_id': 'GROUP_ID', 'token': 'USER_ACCESS_TOKEN', 'message': message}
  return requests.post('https://www.flapit.com/control/group', data=data)

show(":) FLAPIT")
require 'rest_client'

def show(message)
  RestClient.post "https://www.flapit.com/control/group",
    :group_id => "GROUP_ID",
    :token => "USER_ACCESS_TOKEN",
    :message => message
end

show ":) FLAPIT"
import java.io.IOException;
import org.apache.http.client.fluent.Form;
import org.apache.http.client.fluent.Request;

public class App
{
    public static void show(String message) throws IOException
    {
        Request request = Request.Post("https://www.flapit.com/control/group")
            .setHeader("content-type", "application/x-www-form-urlencoded")
            .bodyForm(Form.form()
                .add("group_id", "GROUP_ID")
                .add("token", "USER_ACCESS_TOKEN")
                .add("message", message)
                .build());

        request.execute();
    }

    public static void main(String[] args) throws IOException
    {
        show(":) FLAPIT");
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;

public class App
{
    public static async Task Show(string message)
    {
        var client = new HttpClient();
        var uri = new Uri("https://www.flapit.com/control/group");
        var fields = new Dictionary
        {
            {"group_id", "GROUP_ID"},
            {"token","USER_ACCESS_TOKEN"},
            {"message", message}
        };
        var content = new FormUrlEncodedContent(fields);
        await client.PostAsync(uri, content);
    }

    public static void Main()
    {
        var task = Show(":) FLAPIT");
        task.Wait();
    }
}
-- requires http-streams and io-streams
{-# LANGUAGE OverloadedStrings #-}
import Network.Http.Client

send message = postForm "https://www.flapit.com/control/group"
       [("group_id", "GROUP_ID"),
        ("token", "USER_ACCESS_TOKEN"),
        ("message", message)] $ \_ _->return ()

main:: IO ()
main = send ":) FLAPIT"