Add a device via HTTP POST.

    POST JSON in the following format ::

        {
            "device_id": "<your_device_id>",
            "host": "<address>:<port>",
            "adbkey": "<path to the adbkey file>"
        }
965868
def add_device():
    
    req = request.get_json()
    success = False
    if 'device_id' in req and 'host' in req:
        success = add(req['device_id'], req['host'], req.get('adbkey', ''), req.get('adb_server_ip', ''), req.get('adb_server_port', 5037))
    return jsonify(success=success)
815188
function sendSignature(device_address, signed_text, signature, signing_path, address){
	device.sendMessageToDevice(device_address, "signature", {signed_text: signed_text, signature: signature, signing_path: signing_path, address: address});
}
1007201
def add_input_data(self, datastream, data_type, options, data):
        

        url = self.get_add_input_data_url(datastream, options)

        form_data = {
            'files': {
                'data': (
                    Utils.random_string(10)+('.json' if data_type == 'json' else '.csv'),
                    StringIO(data),
                    'text/plain;charset=UTF-8',
                    {'Expires': '0'}
                )
            }
        }
        response = self.http.fpost(url, form_data)
        return response
417900
def json_post(methodname, rtype, key):
    """"""
    return compose(
        reusable,
        map_return(registry(rtype), itemgetter(key)),
        basic_interaction,
        map_yield(partial(_json_as_post, methodname)),
        oneyield,
    )
509919
def install_json(self):
        """"""
        file_fqpn = os.path.join(self.app_path, 'install.json')
        if self._install_json is None:
            if os.path.isfile(file_fqpn):
                try:
                    with open(file_fqpn, 'r') as fh:
                        self._install_json = json.load(fh)
                except ValueError as e:
                    self.handle_error('Failed to load "{}" file ({}).'.format(file_fqpn, e))
            else:
                self.handle_error('File "{}" could not be found.'.format(file_fqpn))
        return self._install_json
900191
def add(self, client_id, email_address, name, access_level, password):
        """"""
        body = {
            "EmailAddress": email_address,
            "Name": name,
            "AccessLevel": access_level,
            "Password": password}
        response = self._post("/clients/%s/people.json" %
                              client_id, json.dumps(body))
        return json_to_py(response)
1129368
def devices(self):
        ''''''
        out = self.raw_cmd("devices").communicate()[0].decode("utf-8")
        match = "List of devices attached"
        index = out.find(match)
        if index < 0:
            raise EnvironmentError("adb is not working.")
        return dict([s.split("\t") for s in out[index + len(match):].strip().splitlines() if s.strip()])
441093
public void insert(final DeviceData deviceData, final String[] argin) {
        DevVarStringArrayHelper.insert(deviceData.getAny(), argin);
    }
550921
def _add_device(self, scs_id, ha_id, name):
        
        if scs_id in self._devices:
            return

        self._devices[scs_id] = {
            'name': name,
            'ha_id': ha_id
        }
973672
def post_json(endpoint, payload)
      s = payload.to_json
      uri = URI(endpoint)
      http = Net::HTTP.new(uri.host, uri.port)
      req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
      req.body = s
      begin
        res = http.request(req)
      rescue StandardError => e
        Spectator.logger.info("Cause #{e.cause} - msg=#{e.message}")
        return 400
      end

      res.value
    end
355831
def to_json(self) -> dict:
        ''''''

        d = self.__dict__
        d['p2th_wif'] = self.p2th_wif
        return d
435618
def dictify_device_meta(device_object):
    
    try:
        if  isinstance(device_object['info']['description']['meta'], str) or \
            isinstance(device_object['info']['description']['meta'], unicode):
            device_object['info']['description']['meta'] =\
                json.loads(device_object['info']['description']['meta'])
    except ValueError as err:
        print("dictify: {0}".format(err))
    return device_object
21370
def add(name, device):
    '''
    

    '''

    cmd = 'mdadm --manage {0} --add {1}'.format(name, device)
    if __salt__['cmd.retcode'](cmd) == 0:
        return True
    return False
910531
public void insert(final DevState[] argIn, final int dim_x, final int dim_y) {
        deviceAttributeDAO.insert(argIn, dim_x, dim_y);
    }
1321393
function(callback) {
                var deviceId;

                var params = {
                    url: SERVICE_ADDRESSES.SSO_ADDRESS + SERVICES_PATH.SSO_DEVICES,
                    method: 'GET',
                    headers: {
                        'Authorization': 'Bearer ' + token
                    }
                };

                httpRequest(params, function(result) {
                    if (!result.hasError) {
                        var devices = JSON.parse(result.result.responseText).devices;
                        if (devices && devices.length > 0) {
                            for (var i = 0; i < devices.length; i++) {
                                if (devices[i].current) {
                                    deviceId = devices[i].uid;
                                    break;
                                }
                            }

                            if (!deviceId) {
                                fireEvent('error', {
                                    code: 6000,
                                    message: CHAT_ERRORS[6000],
                                    error: null
                                });
                            }
                            else {
                                callback(deviceId);
                            }
                        }
                        else {
                            fireEvent('error', {
                                code: 6001,
                                message: CHAT_ERRORS[6001],
                                error: null
                            });
                        }
                    }
                    else {
                        fireEvent('error', {
                            code: result.errorCode,
                            message: result.errorMessage,
                            error: result
                        });
                    }
                });
            }
1228430
def postWebhook(self, dev_id, external_id, url, event_types):
        
        path = 'notification/webhook'
        payload = {'device': {'id': dev_id}, 'externalId': external_id,
                   'url': url, 'eventTypes': event_types}
        return self.rachio.post(path, payload)
692655
def post(self, content, endpoint=''):
        '''
        
        '''
        url = self.url(endpoint)
        post_content = json.dumps(content).encode('utf-8')
        headers = {'Content-Type': 'application/json'}
        request = Request(url, post_content, headers)

        response = urlopen(request)

        return json.loads(response.read().decode('utf-8'))