Getting a list of tickets with FogBugz API
Asked Answered
U

2

8

I have a .NET web app that utilizes the FogBugz API to write problem tickets to our FB server... it uses the new command and... among all the other attributes... uses the sCustomerEmail argument to send the user's e-mail with the ticket.

My question is this: Is there a way that I can get a list (via the API, of course) of all tickets assigned to this e-mail? We're wanting to write another page that is a report of what tickets are currently assigned to this e-mail. We don't want to have to create FB accounts for every user out there.

I maybe see hints in the API docs but nothing concrete.

Thanks for any suggestions

Unisexual answered 19/3, 2009 at 18:35 Comment(0)
S
11

Yes, you need to send a custom search to the API, passing in the email address as the correspondent axis.

So, once you've got a logon token:

https://example.fogbugz.com/api.asp?cmd=logon&[email protected]&password=SecretPwd

You can then do the search:

https://example.fogbugz.com/api.asp?cmd=search&q=correspondent:[email protected]&cols=ixBug,correspondent,sTicket,sTitle,dtOpened&token=cc83o7ri9c49t4vfvm3bn252ljvp23

Here I passed in a "q" parameter to the search command to set the search axis as "correspondent:[email protected]".

I also specified a number of columns I want to get back, such as the case number (ixBug), the correspondent's email address (I like to verify things like this), the ticket id the customer got as a response (sTicket, I wasn't sure whether this was what you wanted or the case number), the title (sTitle) and the date the case was opened (dtOpened).

Technically you don't need to ever ask for the ixBug column as it's always available as an attribute of each case element returned in the xml, but sometimes it's easier to have these things as an element.

There are lots of different search axis you can use, and many columns you can return.

Check out the search reference and the sample xml payloads at the botom of the API reference.

Songsongbird answered 20/3, 2009 at 13:50 Comment(2)
Excellent. I've seen the correspondent:... thing before but didn't know how to work it into an API query. Kudos for showing me how to get only the columns I needed... I can use that in some other parts of my program now.Unisexual
Check blog.fogbugz.com for my tutorial on the API.Funny
M
0

Probably might be better asking this directly to FB support or on their forums...

Mesentery answered 19/3, 2009 at 18:35 Comment(2)
Yeah, probably right. Just thought I'd try here first. Thought it might be quicker.Unisexual
You'll get an answer either place. Fog Creek staff frequent both. Since this is more program-y, it probably does more good to have it here.Funny

© 2022 - 2024 — McMap. All rights reserved.