Assembling Search URLs (reformulated)

Hi,

one of the reasons I am very excited about choosing RT for our
project is its RT’s RESTfulness, because we have other system components
that need to link to various pages of RT. One of those cases is to
assemble links based on a name that will allways produce certain
search results (e.g. all new and open tickets in a queue that have ‘name’
as the value of a custom field).

I have now wrestled with the search related URLs for quite some time
and still make no progress - some hidden magic is in the way.

Can anyone help me with the information how I need to built up
one of those URLs I need? The whole charme of what we are trying
to do on our project sort of depends on this.

Here is an example to explain what I mean:

my $queue_name = “Incidents”;
my $related_part_serial_number = “778-889”;

Assemble the URL that gives me all new and open tickets in queue named

incidents that have the value “778-889” as the name for custom field

“related_part” (the custom field is assigned to the queue, not global!)

my $url = "http://rt.example.de/Search/Listing.html?--WHAT GOES HERE???–

Is that possible at all?

Please help and thanks in advance.

Jan

Jan Algermissen http://www.topicmapping.com
Consultant & Programmer http://www.gooseworks.org

Here is an example to explain what I mean:

my $queue_name = “Incidents”;
my $related_part_serial_number = “778-889”;

Assemble the URL that gives me all new and open tickets in queue named

incidents that have the value “778-889” as the name for custom field

“related_part” (the custom field is assigned to the queue, not global!)

my $url = "http://rt.example.de/Search/Listing.html?--WHAT GOES HERE???–

What about just doing that search in RT’s Web interface? After you hit
“Search”, on the left side of the screen you’ll see the “Bookmarkable” URL
to “this search”. Looking at that url should give you te necessary hints.

Or did I fully miss what your actual problem is?

http://www.StefanSeiz.com
Spamto: bin@imd.net

Stefan Seiz wrote:

Here is an example to explain what I mean:

my $queue_name = “Incidents”;
my $related_part_serial_number = “778-889”;

Assemble the URL that gives me all new and open tickets in queue named

incidents that have the value “778-889” as the name for custom field

“related_part” (the custom field is assigned to the queue, not global!)

my $url = "http://rt.example.de/Search/Listing.html?--WHAT GOES HERE???–

What about just doing that search in RT’s Web interface? After you hit
“Search”, on the left side of the screen you’ll see the “Bookmarkable” URL
to “this search”. Looking at that url should give you te necessary hints.

Yes, that is what I did. I did the seach for the serial number 778_998, recorded
the URL and pasted it into me other application. The I replaced all occurrences
of 778_998 with my variable that holds the serial_number . I expected this to
work, but there seems to be hidden magic, because I don;t get the correct
search results.

Or did I fully miss what your actual problem is?

No, and thanks for the hint and answer.

Right now I seriously wonder if what I want to do is
possible at all.

Jan


http://www.StefanSeiz.com
Spamto: bin@imd.net


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm

Jan Algermissen http://www.topicmapping.com
Consultant & Programmer http://www.gooseworks.org

What about just doing that search in RT’s Web interface? After you hit
“Search”, on the left side of the screen you’ll see the “Bookmarkable” URL
to “this search”. Looking at that url should give you te necessary hints.

Yes, that is what I did. I did the seach for the serial number 778_998,
recorded
the URL and pasted it into me other application. The I replaced all
occurrences
of 778_998 with my variable that holds the serial_number . I expected this to
work, but there seems to be hidden magic, because I don;t get the correct
search results.

Allright, getting closer. So your “other application”, how does it log into
rt? See your browser has an open session when doing the search - some
session-information is stored in a cookie AFAIK, so maybe your other APP
would have to deal with this too?

And you say “I don’t get correct results”, could you elaborate on this?
Showing us what “not correct” means could certainly help. Something like “I
did this”, “expected this” but “go that” (incl. copies of your built urls
etc.) would be realy helpful. Everything else is just plain guesswork and
mind-reading :wink:

http://www.StefanSeiz.com
Spamto: bin@imd.net

What about just doing that search in RT’s Web interface? After you hit
“Search”, on the left side of the screen you’ll see the “Bookmarkable” URL
to “this search”. Looking at that url should give you te necessary hints.

Yes, that is what I did. I did the seach for the serial number
778_998, recorded the URL and pasted it into me other
application. The I replaced all occurrences of 778_998 with my
variable that holds the serial_number . I expected this to work,
but there seems to be hidden magic, because I don;t get the correct
search results.

There isn’t any hidden magic to Search URLs, though the one that the
“Bookmarkable Search” link returns is fairly complex, and it’s easy to
make a mistake when you modify it.

You can get an idea about whether you’ve constructed the URL properly
by looking at the criteria on the left of your resulting search page,
and seeing if it looks the way you expect.

The URL that you get from the “Bookmarkable Search” will have a lot of
things in it that you don’t strictly need, but if you remove
unnecessary things, do so carefully to make sure that you don’t remove
the parts that you do need.

Good luck,
Linda

Jan,

Just to drive the point home, be careful to use the “Bookmarkable URL”,
not just the URL of the initial page result!

-Kevin

Stefan Seiz wrote:

Allright, getting closer. So your “other application”, how does it log into
rt? See your browser has an open session when doing the search - some
session-information is stored in a cookie AFAIK, so maybe your other APP
would have to deal with this too?

The assembled URLs will be used within a browser, so if the cookie is not
set, I expect the login page to be shown and after that be taken to the
appropriate page (with the original (non-modified) URLs this works.)

And you say “I don’t get correct results”, could you elaborate on this?
Showing us what “not correct” means could certainly help. Something like “I
did this”, “expected this” but “go that” (incl. copies of your built urls
etc.) would be realy helpful. Everything else is just plain guesswork and
mind-reading :wink:

Here is what I do:

  1. NewSearch → Search on Queue IS “Incidents”

    (now the custom field “Related_CI” shows up in the search screen since it
    is present on that Queue only).

  2. Refine search by setting Related_CI IS “cs1”

    (I get the expected result (2 tickets)) and this bookmark URL:

http://rt.nec.dkrz.de/Search/Listing.html?Bookmark=FrT%3B%402|%254|%242|10%242|11%258|%2411|DESCRIPTION%245|FIELD%248|OPERATOR%245|VALUE%2417|Queue%20%3D%20Incidents%245|Queue%241|%3D%249|Incidents%2510|%2411|CUSTOMFIELD%2411|DESCRIPTION%245|FIELD%248|OPERATOR%245|VALUE%241|1%2431|CF.Incidents.{Related_CI}%20%3D%20cs1%2425|CF.Incidents.{Related_CI}%241|%3D%243|cs1%242|12&TicketsSortBy=id&TicketsSortOrder=ASC&RowsPerPage=50

Decoded with Perl URI::Escape

http://rt.nec.dkrz.de/Search/Listing.html?Bookmark=FrT;@2|%4|$2|10$2|11%8|$11|DESCRIPTION$5|FIELD$8|OPERATOR$5|VALUE$17|Queue =
Incidents$5|Queue$1|=$9|Incidents%10|$11|CUSTOMFIELD$11|DESCRIPTION$5|FIELD$8|OPERATOR$5|VALUE$1|1$31|CF.Incidents.{Related_CI} =
cs1$25|CF.Incidents.{Related_CI}$1|=$3|cs1$2|12&TicketsSortBy=id&TicketsSortOrder=ASC&RowsPerPage=50

  1. I substitute the two occurrences of cs1 with another CI-identifier but get exactly the original
    result and even the same information in the ‘bookmark menu’ (where one can deselect single
    criteria).

I expected the search to be cached, but since I learned that there is no hidden magic, I have
no idea anymore, what I do wrong.

Hints?

Jan
Jan Algermissen http://www.topicmapping.com
Consultant & Programmer http://www.gooseworks.org

http://rt.nec.dkrz.de/Search/Listing.html?Bookmark=FrT;@2|%4|$2|10$2|11%8|$11|DESCRIPTION$5|FIELD$8|OPERATOR$5|VALUE$17|Queue =
Incidents$5|Queue$1|=$9|Incidents%10|$11|CUSTOMFIELD$11|DESCRIPTION$5|FIELD$8|OPERATOR$5|VALUE$1|1$31|CF.Incidents.{Related_CI} =
cs1$25|CF.Incidents.{Related_CI}$1|=$3|cs1$2|12&TicketsSortBy=id&TicketsSortOrder=ASC&RowsPerPage=50

note that this is encoded with Storable. you might want to try ripping
it apart with storable and reassembling it by hand.

  1. I substitute the two occurrences of cs1 with another CI-identifier but get exactly the original
    result and even the same information in the ‘bookmark menu’ (where one can deselect single
    criteria).

I expected the search to be cached, but since I learned that there is no hidden magic, I have
no idea anymore, what I do wrong.

Hints?

Jan

Jan Algermissen http://www.topicmapping.com
Consultant & Programmer http://www.gooseworks.org


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm

Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.