[rt-users] Perl help
Tom Lahti
toml at bitstatement.net
Tue May 26 17:33:16 EDT 2009
> I need to know how to take an email address (directly from an email
> header) and get the actual UserId/PrincipalId from RT. I have the
> address split out and now I just need an ID. I'm assuming that the
> PrincipalId is the same thing as the Name field from the USERS Table. In
> other words, I do NOT want to add an entire email address as a Ticket
> watcher, I want the Name field from the USers Table (ie. instead of
> KFCrocker at lbl.gov I want KFCrocker or whatever name correlates to
> KFCrocker at lbl.gov). Thank you in advance.
Going into the database schema directly is a bad idea. Future upgrades can
(and will) change the schema, breaking your customization. Use the REST
interface instead. See http://wiki.bestpractical.com/view/REST
Then, an HTTP GET of the URI '/REST/1.0/user/KFCrocker/show' should get you
something like:
id: user/217
Name: KFCrocker
Password: ********
EmailAddress: KFCrocker at lbl.gov
RealName: Ken Crocker
Lang: en
Privileged: 1
Disabled: 0
However, here you are querying by name, not by email address, so hopefully
they all match. If they don't you aren't going to be able to do it reliably
in a future-proof way without doing something you really don't want to do.
Though really, I'm not sure why you'd want to do this in the first place.
RT is quite happy to look up based on email address internally, you don't
have to supply the ID when creating tickets and such, just an email address.
--
-- ============================
Tom Lahti
BIT Statement LLC
(425)251-0833 x 117
http://www.bitstatement.net/
-- ============================
More information about the rt-users
mailing list