Page 1 of 1

How create report by API?

Posted: Thu Jul 27, 2017 6:36 pm
by awasu.user
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 ?

Re: How create report by API?

Posted: Thu Jul 27, 2017 10:40 pm
by support
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() )