
#DEFINE ODD          ";"
#DEFINE CRLF         CHR(13)+CHR(10)

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@btr.psp.cz/"                             && parlament

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@hajek-backend.production-a.asrv.cz/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@scania-backend.production-b.asrv.cz/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@kbelsky-pivovar-backend.production-c.asrv.cz/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH  "https://alto:1991.Altopraha@rez-backend.production-d.asrv.cz/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH  "http://alto:1991.Altopraha@stravovani-b.elfetex.net/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH  "https://alto:1991.Altopraha@sas-backend.production-b.asrv.cz/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@ceskatelevize-backend.production-c.asrv.cz/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH  "https://alto:1991.Altopraha@grosseto-backend.production-a.asrv.cz"
 
*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH  "http://admin:admin@testing.asrv.cz:8888/"

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH  "https://alto:1991.Altopraha@d01-backend.production-d.asrv.cz/"
 
*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH  "https://alto:1991.Altopraha@d02-backend.production-d.asrv.cz/"                   && velim

* DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@d03-backend.production-d.asrv.cz/"            && plzen-nyrany

*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://admin:admin@sokolovna-backend.production-b.asrv.cz/"


*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@bezdecin-backend.production-c.asrv.cz/"            && bezdecin officefood


*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@c03-backend.production-c.asrv.cz/"            && jidlovice
*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@jidlovice-backend.production-c.asrv.cz/"            && jidlovice

DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_http") WITH "https://alto:1991.Altopraha@magna-nymburk-backend.production-d.asrv.cz/"            && magna nymburk


http_get('settings/crud/settings')

http_request( 'settings/crud/settings', "POST", '{"key":"canteen.menu.confirmation","value":{"style":"global"}}' )
http_request( 'settings/crud/settings', "POST", '{"key":"auth.login.terminal_login","value":{"enabled":true}  }' )
http_request( 'settings/crud/settings', "POST", '{"key":"canteen.menu","value":{"number_of_days":15, "show_days_wo_meals":false}}' )


http_get('settings/crud/settings')


RETURN     &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
RETURN     &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
RETURN     &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&



**retez = '{"is_superuser":true, "username":"adminackee", "password":"Ahntpr.Jidblo.548"}'
**http_request("auth/crud/users/5", "PATCH", m.retez)

**http_request("auth/crud/users/1", "PATCH", '{"password":"SQL.1991.Nadclovek"}')


use \poslanci

retez = '{ "limit_var":1001 }'
SCAN
    http_request("kredit/crud/client_infos/" + nx(id_infos), "PATCH", m.retez)
ENDSCAN 


http_request("canteen/crud/courses", "POST", '{"name":"lunch_pre" ,"group":"lunch","display_name":"Předkrmy"     ,"order_number":5,"served_at":"12:00:00","is_additional":false}')
http_request("canteen/crud/courses", "POST", '{"name":"lunch_main","group":"lunch","display_name":"Hlavní jídla" ,"order_number":6,"served_at":"12:00:00","is_additional":false}')
http_request("canteen/crud/courses", "POST", '{"name":"lunch_side","group":"lunch","display_name":"Přílohy"      ,"order_number":7,"served_at":"12:00:00","is_additional":true }')

http_request("canteen/crud/courses/", "POST", '{"name":"lunch_pre" ,"group":"lunch","display_name":"Polévky a saláty","order_number":5,"is_additional":false}')
http_request("canteen/crud/courses/", "POST", '{"name":"lunch_main","group":"lunch","display_name":"Hlavní jídla"    ,"order_number":6,"is_additional":false}')
http_request("canteen/crud/courses/", "POST", '{"name":"lunch_side","group":"lunch","display_name":"Prílohy"         ,"order_number":7,"is_additional":true}')



FOR id = 3 TO 1555
    retez = '{"password":"9ngs/cru%)^_#&ngs/ATCH9"}'
    http_request("auth/crud/users/" + ALLTRIM(STR(id)), "PATCH", m.retez)
ENDFOR 

*USE \hesla
*SCAN

 *   retez = '{"password":"' + ALLTRIM(heslo) + '"}'
  *  http_request("auth/crud/users/" + ALLTRIM(STR(usr_id)), "PATCH", m.retez)

*ENDSCAN 

http_request("auth/crud/users/798", "PATCH", '{"password":"1036698"}')
retez = '{"id":5,"username":"2310","first_name":"Jana","last_name":"JuklovŠ","email":"juklova@psp.cz","is_active":false,"is_staff":false,"is_superuser":false,"groups":["clients","diners"],"client":9,"pin":null}'
http_request('auth/crud/users/5', "PATCH", m.retez)
http_get ("auth/crud/users/99886")





http_request("kredit/crud/client_infos/9" , "PATCH", '{ "sl_limit":800 }')


FOR id = 1 TO 1111

    retez = '{ "max_den_odber":1, "c_hlad":1,"pl_c_hlad":1,"typ_slevy":2,"pl_typ_slevy":2 }'
    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(id)), "PATCH", m.retez)

ENDFOR 


USE i:\hajek
SCAN 
    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(id_infos)), "DELETE", "")
    http_request("kredit/crud/clients/"      + ALLTRIM(STR(id      )), "DELETE", "")
ENDSCAN 




retez = '{"client":1659,"balance":"0.00","kind":"KC","transacted_at":"2023-01-31T23:00:00Z","description":"VYUCT","display_description":"Vyuctovani KC"}'

http_request('kredit/crud/historic_transactions', "POST", m.retez)

USE i:\elf
SCAN 
     http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(id)), "DELETE", '')
ENDSCAN 

USE i:\poi
SCAN 
     retez = '{ "kind":"POI"}'
     http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(id)), "PATCH", m.retez)
ENDSCAN 

http_get('kredit/crud/historic_transactions/2213901')
USE i:\trans25
SCAN 
     retez = '{ "amount":-32}'
     http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(id)), "PATCH", m.retez)
ENDSCAN 

http_get("kredit/crud/transactions?filter{transacted_at.gte}=2021-12-01T00:00:00Z&filter{client}=3979&page_size=9999")

retez = '{"amount":"-125.00"}'
http_request('kredit/crud/historic_transactions/2066612', "PATCH", m.retez)

retez = '{"transacted_at":"2019-12-31T15:55:55.555555Z","description":"0107633"}'
http_request('kredit/crud/historic_transactions/92914', "PATCH", m.retez)

retez = '{"client":194,"balance":"0.00","kind":"KC","transacted_at":"2019-08-30T23:55:55","description":"VYUCT","display_description":"Vyuctovani KC"}'
http_request('kredit/crud/historic_transactions', "POST", m.retez)

FOR id = 1 TO 588
     ? ALLTRIM(STR(m.id))
     retez = '{ "client":' + ALLTRIM(STR(m.id)) + ', "kind":"POI", "transacted_at":"2019-03-29T00:00:01", "balance":0, "description":"VYUCT", "display_description":"Vyuctovani POI"}'
*     http_request('kredit/crud/historic_transactions', "POST", m.retez)
ENDFOR 


*!*    http://btr.psp.cz/kredit/crud/historic_transactions (0.26sec)
*!*        BODY>>> { "client":2, "kind":"KC", "transacted_at":"2019-03-29T00:00:00", "balance":0, "description":"VYUCT", "display_description":"Vyuctovani"} <<<BODY 


http_request('kredit/crud/historic_transactions/37608', "PATCH", '{"transacted_at":"2019-03-30T12:12:12Z"}')


FOR id = 21511 TO -32999
     ? ALLTRIM(STR(m.id))
      http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(id)), "PATCH", '{"kind":"POI"}')
ENDFOR 

FOR id = 1 TO 566
     ? ALLTRIM(STR(m.id))
     retez = '{ "client":' + ALLTRIM(STR(m.id)) + ', "kind":"POI", "transacted_at":"2019-03-29T00:00:01", "balance":0, "description":"VYUCT", "display_description":"Vyuctovani POI"}'
     http_request('kredit/crud/historic_transactions', "POST", m.retez)
ENDFOR 





retez = '{"canteen":1,"course":"lunch_main","name":"smazak s bramborem, tatarka","date":"2023-01-02","number":32767,"stock_card_number":609,"additional_course_default_number":32767}'

http_request('canteen/crud/meals/', "POST", m.retez)


FOR id = 2090 TO 2199
*     http_request('canteen/crud/meals/' + ALLTRIM(STR(id)), "PATCH", '{ "show_on_web":true }')
ENDFOR 

FOR iii = 2799 TO 3500

    http_request( 'canteen/crud/meals/' + ALLTRIM(STR(m.iii)), "PATCH", '{"description":""}' )
    ?? "."
    
ENDFOR 

 
*HTTP_READ_ONLY_MODE = .T.



**{"id":1981,"canteen":1,"course":"dinner","additional_course":"lunch_side","name":"M1 - Mexický vepřový guláš, houskový knedlík","description":"mexický vepř.guláš, hk     por","date":"2022-11-29","number":1,"show_on_web":true,"stock_card_number":5970,"additional_course_default_number":5}}
*http_request( 'canteen/crud/meals', "POST", '{ "canteen":1,"course":"dinner", "name":"M1 - Mexický vepřový guláš, houskový knedlík", "additional_course":null,"show_on_web":true, ,"date":"2023-01-02","number":1}' )

USE i:\firmy
SCAN 
    retez = '{ "company":{"dic":"","ico":"1","name":"HPP"} }'
    http_request('kredit/crud/clients/' + ALLTRIM(STR(id)), "PATCH", m.retez)
ENDSCAN 


*     retez = '{ "personal":{} }'
*     http_request('kredit/crud/clients/213', "PATCH", m.retez)

*2022-12-07T11:45  PATCH http://stravovani-b.elfetex.net/kredit/crud/clients/213 (0,05sec)    5
*    BODY>>> {"firstname":"Jaroslavaa", "surname":"VyskoŤilovŠ", "client_id":"8100", "card_id":"8100", "chip_id":"0000C96F80FF", "email":"8100@fejk.cz", "company":{"dic":"","ico":"2","name":"14-Logistika"}, "status":"A", "expiration_date":"2055-05-05"} <<<BODY 
*{ "http_status":"200 OK", "client":
*{"id":213,"info":213,"user":214,"status":"A","client_id":"8100","card_id":"8100","chip_id":"0000C96F80FF","email":"8100@fejk.cz","
*firstname":"Jaroslavaa","surname":"VyskoŤilovŠ","comment":"IMPORTED (Elfetex)","news":false,"daily_menu":false,"expiration_date":"2055-05-05","personal":{"sex":"F","birth_date":"Invalid date","birth_date_updated_at":"2022-12-06"},"company":{"dic":"","ico":"2","name":"14-Logistika"},"address":{},"address2":{},"created_at":"2022-11-30T09:06:50.367660Z","updated_at":"2022-12-07T10:45:18.067862Z"}}





retez = '{ "typ":"1", "limit":-3333, "limit_var":0, "limit_den":0, "sl_limit":0, "sl_limit_mes":0, "c_hlad":2, "pl_c_hlad":2, "typ_slevy":2, "pl_typ_slevy":2, "sl_koef":"0.00", "pl_sl_koef":"0.00", "max_den_odber":1 }'

FOR iii = 1 TO 244
    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(m.iii)), "PATCH", m.retez)
ENDFOR 






**{"id":1981,"canteen":1,"course":"dinner","additional_course":"lunch_side","name":"M1 - Mexický vepřový guláš, houskový knedlík","description":"mexický vepř.guláš, hk     por","date":"2022-11-29","number":1,"show_on_web":true,"stock_card_number":5970,"additional_course_default_number":5}}
*http_request( 'canteen/crud/meals/1981', "PATCH", '{"additional_course_default_number":5, "additional_course":null,"show_on_web":true}' )





http_get('settings/crud/settings')

*!*    theresia:
*!*    {"id":1,"key":"canteen.menu.confirmation","value":{"style":"global"}},
*!*    {"id":2,"key":"auth.login.terminal_login","value":{"enabled":true}},
*!*    {"id":3,"key":"canteen.menu","value":{"number_of_days":11,"show_days_wo_meals":false}}


*!*    elfetex:
*!*    {"id":2,"key":"auth.login.terminal_login","value":{"enabled":true}},
*!*    {"id":3,"key":"canteen.menu.confirmation","value":{"style":"global"}}]}}

http_request( 'settings/crud/settings', "POST", '{"key":"canteen.menu.confirmation","value":{"style":"global"}}' )


*{ "http_status":"200 OK", "count":3,"next":null,"previous":null,"results":{"settings":[
*{"id":1,"key":"canteen.menu.confirmation","value":{"style":"global"},"created_at":"2022-09-01T12:19:12.916138Z","updated_at":"2022-09-01T12:19:12.916168Z"},
*{"id":2,"key":"auth.login.terminal_login","value":{"enabled":true},"created_at":"2022-10-12T15:46:57.385877Z","updated_at":"2022-10-12T15:46:57.385928Z"},
*{"id":3,"key":"canteen.menu","value":{"number_of_days":11,"show_days_wo_meals":false},"created_at":"2022-10-20T15:47:53.255799Z","updated_at":"2022-10-31T09:47:22.123793Z"}]}}


http_request( 'settings/crud/settings'  , "POST",  '{"key":"canteen.menu","value":{"number_of_days":11, "show_days_wo_meals":false}}' )
http_request( 'settings/crud/settings/3', "PATCH", '{"key":"canteen.menu","value":{"number_of_days":11, "show_days_wo_meals":false}}' )

http_request( 'settings/crud/settings/3', "PATCH", '{"id":3,"key":"canteen.menu","value":{"number_of_days":25,"show_days_wo_meals":false}}' )
http_request( 'settings/crud/settings/3', "PATCH", '{"key":"canteen.menu","value":{"number_of_days":17, "show_days_wo_meals":false}}' )







FOR iii = 1 TO 500
*    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(m.iii)), "PATCH", '{ "c_hlad":1,"pl_c_hlad":1 }')
ENDFOR 






*http_request("canteen/crud/course_groups/breakfast", "PATCH", '{  "lock_before":"00:00:33"  }')
*http_request("canteen/crud/course_groups/dinner"   , "PATCH", '{  "lock_before":"00:00:33"  }')
*http_request("canteen/crud/course_groups/lunch"    , "PATCH", '{  "lock_before":"00:00:33"  }')
 
http_get('canteen/crud/course_groups')
http_get('canteen/crud/courses')
http_get('canteen/crud/orders')
http_get('canteen/crud/meals')
http_get('auth/crud/users')
http_get('settings/crud/settings')



*GET canteen/crud/course_groups (0,09sec)
*course_groups":[{"name":"breakfast","display_name":"breakfast","served_at":"08:00:00","lock_before":"00:00:00","order_number":1},{"name":"dinner","display_name":"dinner","served_at":"18:00:00","lock_before":"00:00:00","order_number":3},{"name":"lunch","display_name":"lunch","served_at":"12:00:00","lock_before":"00:00:00","order_number":2}]}}







*http_request("canteen/crud/orders/562602", "DELETE", '')



                                                                
*HTTP_READ_ONLY_MODE = .T.






*http_request("kredit/crud/clients/1061", "PATCH", '{"expiration_date":"1888-12-12"}')
*http_request("kredit/crud/clients/1062", "PATCH", '{"expiration_date":"1888-12-12"}')


*retez = '{ "status":"A","client_id":"000015","card_id":"000015","chip_id":"80512ACA6F7B04","email":"000015@ceskatelevize.cz","firstname":"6","surname":"Vnitrní služby stravování","comment":"","company":{"dic":"","ico":"","name":"Vnitrní slu"}}'
*http_request("kredit/crud/clients/4099", "PATCH", m.retez)


retez = '{"expiration_date":"2055-05-05"}'
http_request("kredit/crud/clients/4099", "PATCH", m.retez)



*retez = '{"typ":"1","limit":-9999,"limit_var":0,"limit_den":0,"sl_limit":0,"sl_limit_mes":0,"c_hlad":6,"pl_c_hlad":6,"typ_slevy":2,"pl_typ_slevy":2,"sl_koef":"0.00","pl_sl_koef":"0.00","omez_platba":false,"k_vyplate":false,"rod_cis":""'
*retez = m. retez + ',"id_vlastnik":"","pr_pozice":"","st_autor":null,"rezerva":"","profil":"","max_den_odber":0,"akt_den_odber":0,"id_omezeni":0,"posl_poh_nul":0,"posl_poh_arc":0,"id_firmy":0,"id_zuct":null,"sl_min_cast":0}'
*http_request('kredit/crud/client_infos/4099', "PATCH", m.retez)





retez = '{"id":9,"info":8,"user":5,"status":"N","client_id":"2310","card_id":"2310","chip_id":"048056BA5E3F80","email":"juklova@psp.cz","firstname":"Jana","surname":"JuklovŠ","expiration_date":"2055-05-25","company":{"dic":"","ico":"3","name":"HPP"}}'
http_request('kredit/crud/clients/9', "PATCH", m.retez)


retez = '{"id":8,"client":9,"typ":"1","limit":0,"limit_var":500,"limit_den":0,"sl_limit":0,"sl_limit_mes":0,"c_hlad":3,"pl_c_hlad":1,"typ_slevy":2,"pl_typ_slevy":1,"sl_koef":"0.00","pl_sl_koef":"0.00","max_den_odber":1}'
http_request('kredit/crud/client_infos/8', "PATCH", m.retez)





USE i:\kratkykody
SCAN 
     retez = '{ "chip_id":"' + ALLTRIM(chip_id) + '"}'
     http_request('kredit/crud/clients/' + ALLTRIM(STR(id)), "PATCH", m.retez)
ENDSCAN 







HTTP_READ_ONLY_MODE = .T.

FOR iii = 1 TO 555
    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(m.iii)), "PATCH", '{"typ":"C",  "typ_slevy":14, pl_typ_slevy=1, pl_c_hlad="1"}')
ENDFOR 


*http_get ("auth/crud/users")
http_get ("kredit/crud/clients")
*http_get ("kredit/crud/client_infos")
*http_get ("kredit/crud/transactions?page=1&page_size=9999")
*http_get ("kredit/crud/transactions?page=2&page_size=9999")
*http_get ("kredit/crud/transactions?page=3&page_size=9999")
*http_get ("kredit/crud/transactions?page=4&page_size=9999")

http_get ("kredit/get_balances?client_id=88&at=2020-12-31T23:59")


* smazani jidel a objednavek

USE i:\meals_to_delete
SCAN 
    ? id, date, name
    http_request("canteen/crud/meals/" + ALLTRIM(STR(meals_to_delete.id)), "DELETE", '')
ENDSCAN 

USE i:\orders_to_delete
SCAN 
    ? id, date, name, clientname
    http_request("canteen/crud/orders/" + ALLTRIM(STR(orders_to_delete.id)), "DELETE", '')
ENDSCAN 




*http_get ("kredit/crud/clients?filter{firstname.icontains}=ondra")





FOR iii = 1 TO 9

   http_get ("kredit/crud/transactions?page=" + ALLTRIM(STR(m.iii))+ "&page_size=9999&filter{transacted_at.startswith}=2020-10-15&filter{description.icontains}=TEST")

ENDFOR 

http_get("sk/crud/bill_payments")
http_get("sk/crud/bill_items")
http_get("sk/crud/bill_headers")
http_get("food/crud/products")





USE i:\orders_to_delete
SCAN 
    ? id, date, name, clientname
    http_request("canteen/crud/orders/" + ALLTRIM(STR(orders_to_delete.id)), "DELETE", '')
ENDSCAN 


*http_request('canteen/crud/meals/35137', "PATCH", '{"stock_card_number":1641,"name":"bramborový salát s majonézou 10,3,9","description":"brambor.salat s majonezou 200g"}')
*{"id":35137,"name":"brambor.salat s majonezou 200g","description":"bramborova kase","stock_card_number":67,"additional_course_default_number":null}}


USE i:\zrouti
SCAN FOR .not. EMPTY(heslo)
     retez = '{"client_id":"' + ALLTRIM(heslo) + '", "card_id":"' + ALLTRIM(heslo) + '"}'
     http_request('kredit/crud/clients/' + ALLTRIM(STR(id)), "PATCH", m.retez)
ENDSCAN 




http_get ("kredit/crud/transactions")
*http_get ("kredit/crud/clients")



http_get("kredit/crud/transactions?filter{client}=194&page_size=9999")




HTTP_READ_ONLY_MODE = .T.


for  iii = 1 TO 588
    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(m.iii)), "PATCH", '{"limit_var":500}')

ENDFOR 



*http_request('canteen/crud/orders/8901', "PATCH", '{"client":385,"meal":4908,"ordered":1,"eaten":1}')



json = http_get("kredit/crud/transactions?page_size=99999&page=1&filter{transacted_at.gt}=2019-07-30")



*json = http_get("rezervace/crud/events?filter{start_at.gte}=2017-11-01")

*json = http_get("rezervace/crud/registrations?filter{event}=775&filter{confirmed}=true")
*json = http_get("rezervace/crud/registrations?filter{confirmed}=true")

*json = http_get("rezervace/crud/products")

*c_karty = 132600
*json = http_get("rezervace/crud/products?filter{card_number}=" + ALLTRIM(STR(m.c_karty,13)))

*json = http_get("kredit/crud/clients")

*/kredit/crud/clients?filter{chip_id}=123456 

json = http_get("kredit/crud/client_infos?filter{client}=356")


*json = http_get("kredit/crud/client_infos")
*json = http_get("kredit/crud/clients")
*json = http_get('kredit/crud/clients?filter{personal.icontains}="F"')
*STRTOFILE(beautify_json(m.json), ".\json_clients.txt")
*json = http_get("bakare/crud/vouchers")
*json = http_get("kredit/crud/transactions")
*json = http_get("bakare/crud/actions")
*? beautify_json(json)

*? http_request("bakare/crud/vouchers/28", "PATCH", '{"sent_to":"pepanovak@seznam.cz", "bill_number":"", "spent_at":null, "spent_value":0.00}')
*? http_request("bakare/crud/vouchers/29", "PATCH", '{"sent_to":"jananovak@seznam.cz", "bill_number":"CD54711", "spent_at":"2017-11-05T03:12", "spent_value":360.00}')

*? http_request("kredit/crud/clients/5", "PATCH", '{"personal":{"sex":"M","phone":123456789,"phone2":null,"birth_date":"1969-11-11"} }')
*? http_request("kredit/crud/clients/5", "PATCH", '{"email":"sx@sex.cz"} ')
*? http_request("kredit/crud/clients",   "POST", '{"client_id":"119", "card_id":"119"} ')


? beautify_json(json)
STRTOFILE(beautify_json(m.json), ".\json.txt")

*!*       radek = '{"client": "' + '4' + '", "kind": "' + "POI" + '", "amount": ' + "45" + ', "balance": ' + "203.45" +  + ', "transacted_at": "' + "2017-05-19T12:13:16" + '", "description": "' + "zkouska 1" + '"}'
*!*       ? m.radek
*!*       json = http_request("kredit/crud/transactions", "POST", m.radek)
*!*    ? beautify_json(json)

*!*    ? http_request("kredit/crud/transactions", "POST", '{"client": "' + '2' + '", "kind": "' + "POI" + '", "amount": ' + "-45" + ', "balance": ' + "-353.45" +  + ', "transacted_at": "' + "2017-04-13T12:13:16" + '", "description": "' + "zkouska 1" + '"}')
*!*    ? http_request("kredit/crud/transactions", "POST", '{"client": "' + '2' + '", "kind": "' + "POI" + '", "amount": ' + "-15" + ', "balance": ' + "-353.45" +  + ', "transacted_at": "' + "2017-07-13T12:13:16" + '", "description": "' + "zkouska 1" + '"}')

*json = http_get("kredit/crud/transactions")
*STRTOFILE(beautify_json(m.json), ".\json_trans.txt")
*? beautify_json(json)


*json = http_get("kredit/clients/with_transaction_sums?kind=POI&start=2016-04-04T00:00&end=2017-09-21T12:33&min_sum=9")
*? beautify_json(json)


*json = http_get("kredit/clients/with_transaction_sums?kind=POI&start=2016-04-04T00:00&end=2017-09-21T12:33&max_sum=2000")
*? beautify_json(json)


*json = http_get("kredit/crud/client_info")
*json = http_get("kredit/crud/clients?filter{status}=A")
*? beautify_json(json)

*? http_request("kredit/crud/clients/7", "PATCH", '{"personal":{"sex":"M","phone":null,"phone2":null,"birth_date":"1969-09-02"} }')

*? http_request("kredit/crud/client_infos", "POST", '{"client":7, "typ": "C" }')
*? http_request("kredit/crud/client_infos", "POST", '{"client":8, "typ": "J" }')

*json = http_get("kredit/crud/clients?include[]=info.*")
*json = http_get("kredit/crud/clients?filter{updated_at.gt}=2017-10-09")
*json = http_get("kredit/crud/client_infos")
*? beautify_json(json)
*natahni_klienty()

*json = http_get("kredit/crud/vouchers")
? m.json
*oznam_hotovo()


*-------------------------------------------
*-------------------------------------------


*http_request('food/crud/product_ranges', "POST", '{"name":"Jidla"}')  
*http_request('food/crud/product_ranges', "POST", '{"name":"Napoje"}')  


http_request('food/crud/products', "POST", '{"range":1, "name":"KnedloVeproZelo", "description":"Knedle, flaxa, zele", "stock_card_number":654321, "price":"95.00", "price2":"78.00", "tax_rate":"15.00", "tax_rate2":"15.00" }')  
http_request('food/crud/products', "POST", '{"range":2, "name":"Vodka s dzusem", "description":"", "stock_card_number":6521, "price":"145.00", "price2":"80.00", "tax_rate":"21.00", "tax_rate2":"21.00" }')  

http_get    ("food/crud/product_ranges")
http_get    ("food/crud/products")


for  iii = 1 TO 588
    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(m.iii)), "PATCH", '{"pl_c_hlad":1}')
ENDFOR 


DO (LOWER(JUSTPATH(sys(16))) + "\http_ppgm") WITH "https://alto:1991.Altopraha@btr.psp.cz/"

http_request('canteen/crud/orders/74739', "PATCH", '{"ordered":1,"eaten":1}')  





*     http_request('kredit/crud/client_infos/' + ALLTRIM(STR(id)), 'PATCH', '{"limit":0}')

*       http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(id)), "DELETE", "")




*DO (LOWER(JUSTPATH(sys(16))) + "\ppgm_klienti") &&WITH "loguj"

*http_get    ("kredit/crud/historic_transactions")


FOR iii = 400 to 555
*        http_request('kredit/crud/client_infos/' + ALLTRIM(STR(m.iii)), "PATCH", '{"max_den_odber":1}')
*        http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(m.iii)), "DELETE", "")

    http_request("kredit/crud/client_infos/" + ALLTRIM(STR(m.iii)), "PATCH", '{"limit":-9992}')


ENDFOR


*http_request('canteen/crud/orders/8901', "PATCH", '{"client":385,"meal":4908,"ordered":1,"eaten":1}')


*{"id":8901,"client":157,"meal":4908,"ordered":1,"eaten":1,"created_at":"2019-01-03T17:45:48.333047Z","updated_at":"2019-01-03T17:45:48.333110Z"}}



*http_request('canteen/crud/orders/7714', "DELETE" )


#DEFINE CLIENT_ID_OLD   14
#DEFINE CLIENT_ID_NEW  368

*json = http_request("canteen/crud/orders/6060", "PATCH", '{"client":' + ALLTRIM(STR(CLIENT_ID_NEW)) + '}')


*        http_request('kredit/crud/historic_transactions/1436', "DELETE")



*USE (m.gcdat_path + "transactions")
*INDEX on id TO qwew DESCENDING 
*SCAN FOR displ_desc = "Zavodka                                     "
*        http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(transactions.id)), "DELETE")
*ENDSCAN 

FOR iii = 1400 to 744 STEP -1
*        http_request('kredit/crud/historic_transactions/' + ALLTRIM(STR(m.iii)), "DELETE")
ENDFOR

*json = http_get("kredit/crud/transactions?page_size=9999")


*http_get(     'canteen/crud/orders?filter{client}=14&page_size=9999' )
*http_request('canteen/crud/orders/5695', "DELETE" )

*{"id":5695,"client":14,"meal":3916,"ordered":1,"eaten":0,"created_at":"2018-12-12T09:15:17.287276Z","updated_at":"2018-12-12T09:15:17.287321Z"},

FOR iii = 1 to 11
*    http_request("kredit/crud/clients/" + ALLTRIM(STR(m.iii)), "PATCH", '{"company":{"dic":"","ico":"3","name":"HPP"}}')
ENDFOR


*{"id":10,"info":9,"user":13,"status":"A","client_id":"1137","card_id":"1137","chip_id":"047526D25A4E80","email":"formanovan@psp.cz","firstname":"NaÔa","surname":"FormanovŠ","comment":"","news":true,"daily_menu":true,"expiration_date":"2000-05-05","personal":{"sex":"M"},"company":{"dic":"","ico":"","name":""}},

*req = '{"expiration_date":"2044-04-04", "company":{"name":"HPP"}}'
*= http_request("kredit/crud/clients/10", "PATCH", m.req)


*!*    USE (m.gcpri_path + "orders")
*!*    SCAN FOR client = CLIENT_ID_OLD
*!*        json = http_get    ("canteen/crud/orders/" + ALLTRIM(STR(id)))
*!*        json = http_request("canteen/crud/orders/" + ALLTRIM(STR(id)), "PATCH", '{"client":' + ALLTRIM(STR(CLIENT_ID_NEW)) + '}')
*!*    ENDSCAN 


*!*    USE (m.gcpri_path + "transactions")
*!*    SCAN FOR client = CLIENT_ID_OLD
*!*        json = http_get    ("kredit/crud/transactions/" + ALLTRIM(STR(id)))
*!*        json = http_request("kredit/crud/transactions/" + ALLTRIM(STR(id)), "PATCH", '{"client":' + ALLTRIM(STR(CLIENT_ID_NEW)) + '}')
*!*    ENDSCAN 



*req = '{"id":8,"info":7,"status":"A","user":375,"client_id":"3516","card_id":"3516","chip_id":"043822BA5E3F80","email":"strbar@psp.cz","firstname":"Richard","surname":"’trba","comment":"","news":false,"daily_menu":false,"expiration_date":"2055-05-26"}'
*req = '{"surname":"ätrba"}'
*= http_request("kredit/crud/clients/8", "PATCH", m.req)


http_get(     'canteen/crud/orders?filter{client}=14&page_size=9999' )
http_get(     'canteen/crud/orders?filter{client}=371&page_size=9999' )

http_get("kredit/crud/transactions?filter{client}=14&page_size=9999")
http_get("kredit/crud/transactions?filter{client}=371&page_size=9999")


