Dear fellow RTers,
Looking at html/REST/1.0/Forms/ticket/attachments, I realized that one
does not really need to pass the ticket id in order to see a particular
attachment. As it stands right now, however, this is enforced by the
implementation. Let’s look at an example run of ‘rt’ utility
(attached). Since RT::Attachment is an object in its own right, why
not allow it to be accessed as such? Furthermore, ticket-loading code
at the top of html/REST/1.0/Forms/ticket/attachments does not do
anything useful, because it does not check whether a specific
attachment is actually associated with the ticket.
Attached patch moves ticket-loading code to the place where it’s
needed, so one can access any attachment using rt tool by saying
rt show ticket/0/attachments/6
To take things even further, why shouldn’t there be
html/REST/1.0/Forms/attachment? Then we could say things like
rt show attachment/6
Rationale: as I am writing RT::Client::REST, I am trying to make a
uniform framework for creating, editing, and retrieving of any
REST-supported RT object. Attachments, by being unnecessarily (IMO)
tagged onto ticket, don’t fit into my paradigm (you may call it a
fantasy world, though :).
- What do you think? Agree/disagree?
- If the answer to (1) is agree, will you accept a patch?
P.S. RT::Client::REST 0.12 is now up on CPAN. While docs are still
pretty scarce, you can see where I am going with it.
sample-rt-run.txt (1.02 KB)
rt-rest-attachment.patch.txt (1.03 KB)