Post Reply
awasu.user
Posts: 88
Joined: Fri Jan 06, 2017 12:50 pm

How create report by API?

Post by awasu.user » Thu Jul 27, 2017 6:36 pm

Calling API:

http://localhost:2604/reports/create?fo ... &token=xxx

I try create report, but I get

Code: Select all

"errorMsg": "Missing request data." 
In doc is http://awasu.com/help/3.1/For%20develop ... portConfig:

Code: Select all

<dataSource type="channelFolders" markItemsAsRead="yes" groupByChannel="yes" includeItems="all" includeSubFolders="no">
    <channelFolder id="..."> ... </channelFolder>
</dataSource>
but how pass it by post in URL? I know how make post in python, but I can't how it should be look in URL?
datasource@type=channelFolder&datasource@markitemsread=yes ?

User avatar
support
Site Admin
Posts: 3033
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Re: How create report by API?

Post by support » Thu Jul 27, 2017 10:40 pm

You have to send an HTTP POST request; if you embed the parameters in the URL, it will be sent as an HTTP GET.

For example:

Code: Select all

import urllib.request

data = b"""<channelReport>
    <name> My New Report </name>
    <dataSource type="channelFilter">
        <channelFilterName> All </channelFilterName>
    </dataSource>
</channelReport>"""

url = "http://localhost:2604/reports/create"
req = urllib.request.urlopen( url , data=data )
print( req.read() )

Post Reply

Return to “Awasu - Extensions”