{Pascal Script} Var IdHTTP: TIdHTTP; IdHandler: TIdSSLIOHandlerSocketOpenSSL; received_text: string; json: TlkJSON; jsonlist: TlkJSONlist; i: integer; name, id, s: string; value: double; List: TStringList; procedure OnStartScript; begin json := TlkJSON.Create; IdHTTP := TIdHTTP.Create; IdHandler := TIdSSLIOHandlerSocketOpenSSL.Create (nil); IdHTTP.IOHandler := IdHandler; IdHTTP.Request.ContentType := 'application/json'; IdHTTP.ReadTimeout := 10000; List := TStringList.Create; end; procedure OnStopScript; begin // Aao eia json.free; IdHTTP.free; IdHandler.free; List.free; end; Const CLIENT_ID = '5ba0b2b618e5e27962e72112'; FHOST = 'https://cloud.simplight.ru/'; FCOMMAND_GET = 'api/commands/get?client_id='; FCOMMAND_POST = 'api/commands/complete?client_id='; Begin received_text := IdHTTP.GetEx(FHOST + FCOMMAND_GET + CLIENT_ID); if received_text = '{"status":1,"errors":"Not found commands"}' then exit; if received_text = '' then begin AddToDebugLog('--------------------------------'); exit; end; // AddToDebugLog(received_text); List.Clear; s:=''; s := '{"commands":['; jsonlist := TlkJSONlist(json.ParseText(received_text, true)); for i := 0 to jsonlist.Count - 1 do begin try id := VarToStr(jsonlist.Child[i].Field['id'].Value); // AddToDebugLog('----> ' + id); name := VarToStr(jsonlist.Child[i].Field['name'].Value); value := jsonlist.Child[i].Field['new_value'].Value; except S := S + '"' + id + '"'; if i < jsonlist.Count - 1 then S := S + ','; continue; end; WriteValue(name , value); S := S + '"' + id + '"'; if i < jsonlist.Count - 1 then S := S + ','; end; S := S + ']}'; List.add(s); // AddToDebugLog('*********************'); IdHTTP.POST(FHOST + FCOMMAND_POST + CLIENT_ID, List); end.