Changes between Initial Version and Version 1 of Ticket #11340


Ignore:
Timestamp:
Oct 4, 2013 5:28:05 PM (12 months ago)
Author:
osimons
Comment:

When updating a ticket, all you have to do is pass whatever _ts value you get from the server. The timestamp is a marker for the server to make sure that updates are performed based on latest values, and not on stale values. So, in order to do ticket.update you first have to do ticket.get.

What this value is exactly has changed with Trac. In earlier Trac versions (pre-0.12) timestamped based on seconds since epoch. However, with 0.12 this changed so that Trac now timestamps based on microseconds. So dividing by 1.000.000 will get you the seconds since epoch. The plugin works with both versions.

However, all this is implementation details you should not be concerned with. _ts is really just a token used to ensure valid updates.

As for available fields, that also depends on your server. If you have defined custom fields they will also appear as available fields for creation and updating. All fields are returned by the ticket.getTicketFields call. However, as you noticed, the plugin does not know anything about types, expected inputs, validation rules or similar. You may even have validation/manipulator plugins installed the plugin cannot know about. The plugin takes the data as if entered through web, and makes Trac perform validation of input - applying changes if all is correct, or returning all the warnings if problems are found. With fields as if entered through web, all ticket attributes should be passed as plain strings.

If you have specific suggestions for more correct documentation, then by all means add patch or suggestions to this ticket.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11340 – Description

    initial v1  
    33I cannot find any documentation with properties and their types to provide to ticket_create and ticket_update. Documentation http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 linked from http://trac-hacks.org/wiki/XmlRpcPlugin doesn't work. 
    44 
    5 Can you please provide more complex example how to use timestamps when calling ticket_update? I cannot get it work. I would expect that I should provide timestamp of type int32 in _ts field? But when I call _trac.ticket_get(id) I obtain very long number ["_ts"] = "1380897120346000" which seem not be be int32 unix timestamp. 
     5Can you please provide more complex example how to use timestamps when calling ticket_update? I cannot get it work. I would expect that I should provide timestamp of type int32 in _ts field? But when I call _trac.ticket_get(id) I obtain very long number `["_ts"] = "1380897120346000"` which seem not be be int32 unix timestamp. 
    66 
    77I probably use wrong type beause of "Server returned a fault exception: [1] 'unsupported type for timedelta microseconds component: unicode' while executing 'ticket.update()'". 
    88  
    99My code C# code is: 
    10  
     10{{{ 
     11#!cs 
    1112  public XmlRpcStruct GetProperties() 
    1213        {            
     
    3738            return (int)((dateTime - epoch.ToLocalTime()).TotalSeconds); 
    3839        } 
     40}}}