*    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *    *
*
*    *    *    *    *    *    *    *    *    *    *    *      #> ver. 2018-12-10 <#       *    *    *    *    *    *    *    *    *    *    *    *    *

#DEFINE PAGESIZE "22"

HTTP_READ_ONLY_MODE = .T.

*susp
DO (LOWER(JUSTPATH(sys(16))) + "\http_ppgm_test") WITH "admin:admin@canteen-adient-backend.alto-production.mine.nu/"
*DO (LOWER(JUSTPATH(sys(16))) + "\http_ppgm_test") WITH "https://admin:admin@canteen-adient-backend.alto-production.mine.nu/"

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

ACTIVATE SCREEN 
_screen.Cls
oznam_hotovo()

RETURN 

zacatek_prace = SECONDS()
? "clients " + PAGESIZE + " "
FOR page_no = 1 TO 3
    json = http_get( "kredit/crud/clients?page_size=" + PAGESIZE + "&page=" + ALLTRIM(STR(m.page_no)))
    next_page = get_string_item (m.json, "next")
    ? m.page_no
    FOR ii = 1 TO VAL(PAGESIZE)+3
	   id          = get_integer_item (m.json, "id"     , ii)
	   surname     = get_string_item  (m.json, "surname", ii)
    ENDFOR 

    IF ISNULL(m.next_page)
        EXIT 
    ENDIF 
ENDFOR 
?? STR(SECONDS() - m.zacatek_prace) + "sec"

oznam_hotovo()
