Ein kurzer Blick auf die Trac-XMLRPC API

Veröffentlicht von am Jul 11, 2009 in Drupal | Ein Kommentar

In meinem vorgerigen Weblog-Eintrag habe ich ja meinen Wunsch nach einer Trac-Schnittstelle für Drupals project.module kund getan. Wir können diese Schnittstelle gut brauchen, um Drupal auch als Ticketsystem für unsere Eclipse-zentriete (Eclipse, die IDE) Arbeit nutzen zu können.

Nun habe ich mir mal die Trac-XMLRPC API angesehen. man bekommt si, wenn man an einem Trac-server die URL xmlrpc oder login/xmlrpc im Browser aufruft und bekommt eine übersichtliche Liste. Die habe ich ein wenig bereinigt und hier kommen die Funktionen, die für die Trac-Schnittstelle des project.module implementiert werden müssen.

Sieht erstmal nicht sooo schwer aus…

Hier die API (relevante Untermenge):

ticket.milestone – Interface to ticket milestone objects.

FunctionDescriptionPermission required
array ticket.milestone.getAll() Get a list of all ticket milestone names. TICKET_VIEW
struct ticket.milestone.get(string name) Get a ticket milestone. TICKET_VIEW

ticket.severity – Interface to ticket severity.

FunctionDescriptionPermission required
array ticket.severity.getAll() Get a list of all ticket severity names. TICKET_VIEW
string ticket.severity.get(string name) Get a ticket severity. TICKET_VIEW

ticket.type – Interface to ticket type.

FunctionDescriptionPermission required
array ticket.type.getAll() Get a list of all ticket type names. TICKET_VIEW
string ticket.type.get(string name) Get a ticket type. TICKET_VIEW

system – Core of the XML-RPC system.

FunctionDescriptionPermission required
array system.multicall(array signatures) Takes an array of XML-RPC calls encoded as structs of the form (in a Pythonish notation here): {‘methodName’: string, ‘params’: array} XML_RPC
array system.listMethods() This method returns a list of strings, one for each (non-system) method supported by the XML-RPC server. XML_RPC
string system.methodHelp(string method) This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns a documentation string describing the use of that method. If no such string is available, an empty string is returned. The documentation string may contain HTML markup. XML_RPC
array system.methodSignature(string method) This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns an array of possible signatures for this method. A signature is an array of types. The first of these types is the return type of the method, the rest are parameters. XML_RPC
array system.getAPIVersion() Returns a list with two elements. First element is the major version number, second is the minor. Changes to the major version indicate API breaking changes, while minor version changes are simple additions, bug fixes, etc. XML_RPC

ticket.resolution – Interface to ticket resolution.

FunctionDescriptionPermission required
array ticket.resolution.getAll() Get a list of all ticket resolution names. TICKET_VIEW
string ticket.resolution.get(string name) Get a ticket resolution. TICKET_VIEW

ticket.priority – Interface to ticket priority.

FunctionDescriptionPermission required
array ticket.priority.getAll() Get a list of all ticket priority names. TICKET_VIEW
string ticket.priority.get(string name) Get a ticket priority. TICKET_VIEW

ticket.component – Interface to ticket component objects.

FunctionDescriptionPermission required
array ticket.component.getAll() Get a list of all ticket component names. TICKET_VIEW
struct ticket.component.get(string name) Get a ticket component. TICKET_VIEW

ticket.version – Interface to ticket version objects.

FunctionDescriptionPermission required
array ticket.version.getAll() Get a list of all ticket version names. TICKET_VIEW
struct ticket.version.get(string name) Get a ticket version. TICKET_VIEW

ticket.status – Interface to ticket status.

FunctionDescriptionPermission required
array ticket.status.getAll() Get a list of all ticket status names. TICKET_VIEW
string ticket.status.get(string name) Get a ticket status. TICKET_VIEW

ticket – An interface to Trac’s ticketing system.

FunctionDescriptionPermission required
array ticket.query(string qstr=“status!=closed”) Perform a ticket query, returning a list of ticket ID’s. TICKET_VIEW
array ticket.getRecentChanges(dateTime.iso8601 since) Returns a list of IDs of tickets that have changed since timestamp. TICKET_VIEW
array ticket.getAvailableActions(int id) Returns the actions that can be performed on the ticket. TICKET_VIEW
array ticket.get(int id) Fetch a ticket. Returns [id, time_created, time_changed, attributes]. TICKET_VIEW
int ticket.create(string summary,  string description,  struct attributes={},  boolean notify=False) Create a new ticket, returning the ticket ID. TICKET_CREATE
array ticket.update(int id,  string comment,  struct attributes={},  boolean notify=False) Update a ticket, returning the new ticket in the same form as getTicket(). TICKET_APPEND
struct ticket.changeLog(int id, int when=0) Return the changelog as a list of tuples of the form (time, author, field, oldvalue, newvalue, permanent). While the other tuple elements are quite self-explanatory, the permanent flag is used to distinguish collateral changes that are not yet immutable (like attachments, currently). TICKET_VIEW
array ticket.listAttachments(int ticket) Lists attachments for a given ticket. Returns (filename, description, size, time, author) for each attachment. TICKET_VIEW
base64 ticket.getAttachment(int ticket,  string filename) returns the content of an attachment. TICKET_VIEW
string ticket.putAttachment(int ticket,
string filename, string description,  base64 data,  boolean replace=True)
Add an attachment, optionally (and defaulting to) overwriting an existing one. Returns filename. TICKET_APPEND
array ticket.getTicketFields() Return a list of all ticket fields fields. TICKET_VIEW

Nun ran an die Implementierung. :)

flattr this!

1 Kommentar

  1. Jawwad
    24. August 2010

    Hallo, kennst du die Methodenname, die für das Abholen von Tickets benutzt wird, wenn man auf dem RSS-Link am Ende der Report-Seite klickt?? Danke

    Antworten

Hinterlasse eine Antwort