You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@bloodhound.apache.org by Mark Abbate <ab...@gmail.com> on 2014/03/20 18:17:25 UTC

xmlrpc ticket.query or report.execute complex query

Hi All

I would like to query for tickets over xmlrpc, but the query needs to 
have multiple parts.

The ticket.query works with one part. It wasn't clear to me if 
ticket.query supports multiple parts using the trac query language syntax.

I tried
<param><string>owner=mabbate&product=mercer</string></param>

but I get this:
ProtocolException: ProtocolException details : <Fault -32700: u'not 
well-formed (invalid token): line 4, column 38'>

It does look like I can create and then execute a report on the fly.

Can ticket.query handle multiple parts? If not, do I need to create and 
execute a report, or are there other ways to make complex queries.

thanks!
Mark Abbate

Re: xmlrpc ticket.query or report.execute complex query

Posted by Mark Abbate <ab...@gmail.com>.
Thanks Ryan!

Turns out I was using Postman in Chrome for my quick tests. I did try 
escaping the & but no luck.

But, I did not try it in java. Of course, I just tried it and it works.

I appreciate the help.
Mark


On 03/20/2014 01:45 PM, Ryan Ollos wrote:
> On Thu, Mar 20, 2014 at 10:17 AM, Mark Abbate <abbatemp@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Hi All
>
>     I would like to query for tickets over xmlrpc, but the query needs
>     to have multiple parts.
>
>     The ticket.query works with one part. It wasn't clear to me if
>     ticket.query supports multiple parts using the trac query language
>     syntax.
>
>     I tried
>     <param><string>owner=mabbate&product=mercer</string></param>
>
>     but I get this:
>     ProtocolException: ProtocolException details : <Fault -32700:
>     u'not well-formed (invalid token): line 4, column 38'>
>
>     It does look like I can create and then execute a report on the fly.
>
>     Can ticket.query handle multiple parts? If not, do I need to
>     create and execute a report, or are there other ways to make
>     complex queries.
>
>     thanks!
>     Mark Abbate
>
>
> The following works for me, so I think XmlRpcPlugin supports multiple 
> parameters in the Query.
>
> I guess maybe you need to escape the "&" in the XML?
>
> #!/usr/bin/env python
> import xmlrpclib
>
> if __name__ == '__main__':
>     server = xmlrpclib.ServerProxy("http://trac-hacks.org/xmlrpc")
>
>     multicall = xmlrpclib.MultiCall(server)
>     count = 0
>     for ticket in 
> server.ticket.query("owner=rjollos&component=PlantUmlMacro&status!=closed"):
>         multicall.ticket.get(ticket)
>         count += 1
>     print map(str, multicall())
>     print "Queried returned ", count, " tickets."
>
>
>


Re: xmlrpc ticket.query or report.execute complex query

Posted by Ryan Ollos <ry...@wandisco.com>.
On Thu, Mar 20, 2014 at 10:17 AM, Mark Abbate <ab...@gmail.com> wrote:

> Hi All
>
> I would like to query for tickets over xmlrpc, but the query needs to have
> multiple parts.
>
> The ticket.query works with one part. It wasn't clear to me if
> ticket.query supports multiple parts using the trac query language syntax.
>
> I tried
> <param><string>owner=mabbate&product=mercer</string></param>
>
> but I get this:
> ProtocolException: ProtocolException details : <Fault -32700: u'not
> well-formed (invalid token): line 4, column 38'>
>
> It does look like I can create and then execute a report on the fly.
>
> Can ticket.query handle multiple parts? If not, do I need to create and
> execute a report, or are there other ways to make complex queries.
>
> thanks!
> Mark Abbate
>

The following works for me, so I think XmlRpcPlugin supports multiple
parameters in the Query.

I guess maybe you need to escape the "&" in the XML?

#!/usr/bin/env python
import xmlrpclib

if __name__ == '__main__':
    server = xmlrpclib.ServerProxy("http://trac-hacks.org/xmlrpc")

    multicall = xmlrpclib.MultiCall(server)
    count = 0
    for ticket in
server.ticket.query("owner=rjollos&component=PlantUmlMacro&status!=closed"):
        multicall.ticket.get(ticket)
        count += 1
    print map(str, multicall())
    print "Queried returned ", count, " tickets."