expose report on api

181 views
Skip to first unread message

kun pakun

unread,
Feb 20, 2021, 11:29:25 AM2/20/21
to Jam.py Users Mailing List
Hi
I am trying to expose report on /ext api interface, but when I post from /ext
["print",1,38,[[7,None,None],"http://localhost:8080/","pdf"],3025]
I do not get report file, but only this:
{'result': {'status': 9, 'data': {'result': {'status': 8, 'data': None, 'modification': 3025}, 'error': None}, 'modification': 3025}, 'error': None}

What am I doing wrong?

... If I do the same post directly to /api from outside I am getting status 5 ... probably not authenticated

Andrew Yushev

unread,
Feb 22, 2021, 2:52:37 PM2/22/21
to kun pakun, Jam.py Users Mailing List
Hi,

Unfortunately, it is not clear what you are doing.
Can you specify? 

Regards,
Andrew Yushev


сб, 20 февр. 2021 г. в 19:29, kun pakun <lost...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/7c14599c-3112-4332-9a70-981fa2a8b79en%40googlegroups.com.

kun pakun

unread,
Feb 22, 2021, 3:02:58 PM2/22/21
to Andrew Yushev, Jam.py Users Mailing List
hi,
I am trying to call report directly as /api POST call, not from gui( problem behind is wrong positioning of pictures after page break ... so I am generating report page by page to bypass that, but it is not so important)
so I am executing same post as framework does to generate report, but report is not generated, returned status is same 9 ... whatever it means .. but report is not executed
...my POST is not exactly same, I am not filling headers... but is this my problem or something else?


From: Andrew Yushev <yush...@gmail.com>
Sent: Monday, February 22, 2021 8:52:25 PM
To: kun pakun <lost...@gmail.com>
Cc: Jam.py Users Mailing List <jam...@googlegroups.com>
Subject: Re: expose report on api
 

Andrew Yushev

unread,
Feb 23, 2021, 2:10:52 PM2/23/21
to kun pakun, Jam.py Users Mailing List
Hi,

You can try to return a link to the report url from the on_ext call and open it then.

Regards,
Andrew Yushev

пн, 22 февр. 2021 г. в 23:02, kun pakun <lost...@gmail.com>:

kun pakun

unread,
Feb 23, 2021, 5:24:54 PM2/23/21
to Andrew Yushev, Jam.py Users Mailing List
hi
sorry, I am not getting you, what should I POST on /api to execute report?
link is for one execution, this can be done from jscript on client with big overhead ofveach opened result window.


From: jam...@googlegroups.com <jam...@googlegroups.com> on behalf of Andrew Yushev <yush...@gmail.com>
Sent: Tuesday, February 23, 2021 8:10:40 PM

Drazen D. Babic

unread,
Feb 23, 2021, 8:42:53 PM2/23/21
to Jam.py Users Mailing List
This:
 "If I do the same post directly to /api from outside I am getting status 5 ... probably not authenticated" - no, there is no auth on /ext
I would like to know more about:
"problem behind is wrong positioning of pictures after page break" - can you show us? Are the pics anchored to a cell?

This might be interesting to everyone...


kun pakun

unread,
Feb 26, 2021, 3:21:30 PM2/26/21
to Drazen D. Babic, Jam.py Users Mailing List
hi,
so what is the problem on /api then with report command?
as for picture, i tried all 3 modes with result shown on first page only or constantly shifted after page breaks not contained in template
seems like positioning of pictures might work accross pagebreaks only when template does not contain vertically merged cells inflicting pagebreak.


From: jam...@googlegroups.com <jam...@googlegroups.com> on behalf of Drazen D. Babic <bab...@gmail.com>
Sent: Wednesday, February 24, 2021 2:42:53 AM
To: Jam.py Users Mailing List <jam...@googlegroups.com>
You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/sb-rkSPwNC0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/5f935285-88d9-41dc-862d-904b0a0225c6n%40googlegroups.com.

Andrew Yushev

unread,
Feb 27, 2021, 3:21:40 PM2/27/21
to kun pakun, Drazen D. Babic, Jam.py Users Mailing List
Hi,

Unfortunately it is not clear what you are doing so it is not possible to help.
Can you send the code you are using?

Regards,
Andrew Yushev

пт, 26 февр. 2021 г. в 23:21, kun pakun <lost...@gmail.com>:

Dražen Babić

unread,
Feb 27, 2021, 8:56:57 PM2/27/21
to Jam.py Users Mailing List
Just remember that /ext in v6 wont be supported...

D.

kun pakun

unread,
Feb 28, 2021, 1:47:32 AM2/28/21
to Dražen Babić, Jam.py Users Mailing List
Thank you for info, so v6 will not be much compatible with v5 on project code level.
btw: I tested my report with image positioning problem also on latest ubuntu libre office. There same template works fine, only on windows positioning follows some other geometry from page 2 onwards


From: jam...@googlegroups.com <jam...@googlegroups.com> on behalf of Dražen Babić <bab...@gmail.com>
Sent: Sunday, February 28, 2021 2:56:44 AM

kun pakun

unread,
Feb 28, 2021, 6:59:57 AM2/28/21
to Jam.py Users Mailing List
Hi
I was doing this:

def get_bill():
    PortalURL = 'http://localhost:8080/api
    import urllib
    from urllib.request import urlopen
    import json
    arg = ["print",1,38,[[15,None,None],"","pdf"],3016]
    a = urlopen(PortalURL , data=str.encode(json.dumps(arg)))
    r = json.loads(a.read().decode())
    return r
values: 38 is report, [15,None,None] is report filter and 3016 is something called modification number ... I simply took values of the call from chrome net debugger

the idea was to generate bill output and save as single pfd for each from selection without redirecting result to http client.

Dražen Babić

unread,
Feb 28, 2021, 9:52:59 AM2/28/21
to Jam.py Users Mailing List
Did u call on ext request though?

Like this:
def on_ext_request(task, request, params):
    reqs = request.split('/')

    if reqs[2] == 'print':
.
.
   do your stuff
.
.


Nothing will work with no on_ext_request...

D.


You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/sb-rkSPwNC0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/0f7b080e-ea43-4573-9249-d8d93d5fd467n%40googlegroups.com.

kun pakun

unread,
Feb 28, 2021, 9:57:51 AM2/28/21
to Dražen Babić, Jam.py Users Mailing List
hi D,
it is vice versa, from outside I called this ext and this ext calls /api and gives result ... contents is in my older messages, only report is not generated


Sent: Sunday, February 28, 2021 3:52:47 PM

Cc: Jam.py Users Mailing List <jam...@googlegroups.com>
Subject: Re: expose report on api

Andrew Yushev

unread,
Feb 28, 2021, 2:13:14 PM2/28/21
to kun pakun, Dražen Babić, Jam.py Users Mailing List
The on_ext_request will be supported, but it will be considered deprecated.




вс, 28 февр. 2021 г. в 17:57, kun pakun <lost...@gmail.com>:

Andrew Yushev

unread,
Mar 1, 2021, 1:57:03 AM3/1/21
to kun pakun, Dražen Babić, Jam.py Users Mailing List
As for report, if it is generated the server should return the following structure

rep.png

вс, 28 февр. 2021 г. в 22:13, Andrew Yushev <yush...@gmail.com>:

Александр Рюмин

unread,
Mar 4, 2021, 10:47:32 AM3/4/21
to Jam.py Users Mailing List
Hi. What will be in v6 instead of  on_ext_request?

понедельник, 1 марта 2021 г. в 00:13:14 UTC+5, yush...@gmail.com:

Andrew Yushev

unread,
Mar 7, 2021, 12:40:32 PM3/7/21
to Александр Рюмин, Jam.py Users Mailing List
Hi,

The main changes in the 6 version are

1. The on_ext_request event is deprecated though it is supported. It is replaced by on_request event.
This event gives full control over requests received by a server and makes it possible to 
implement, for example, saml registration.

2.  The processing of data requests is enhanced. On_before_open and on_after_open, and  
on_before_apply and on_after_apply events are introduced. 

3. The new type of details, based on lookup fields, is introduced.
For example, Invoices  has a customer lookup field from the Customers catalog.
In this case a detail Invoices of master Customers could be created in the App Builder, that  
will display invoices that a customer has.

3. Reports code is rewritten, the image fields can now be printed.

4 The DB support is improved, pyodbc is supported for MSSQL and mysql.connector for MySQL.

Regards,
Andrew Yushev









чт, 4 мар. 2021 г. в 18:47, Александр Рюмин <rum...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages