[Rt-commit] [svn] r808 - in rt: . branches/rt-3.3/docs/design_docs branches/rt-3.3/html/REST/2.0 branches/rt-3.3/html/REST/2.0/Add branches/rt-3.3/html/REST/2.0/Create branches/rt-3.3/html/REST/2.0/Delete branches/rt-3.3/html/REST/2.0/Remove branches/rt-3.3/lib/RT

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Sun May 2 20:21:30 EDT 2004


Author: autrijus
Date: Sun May  2 20:21:29 2004
New Revision: 808

Added:
   rt/branches/rt-3.3/html/REST/2.0/Add/
   rt/branches/rt-3.3/html/REST/2.0/Add/index
   rt/branches/rt-3.3/html/REST/2.0/Remove/
   rt/branches/rt-3.3/html/REST/2.0/Remove/index
Removed:
   rt/branches/rt-3.3/html/REST/2.0/Create/
   rt/branches/rt-3.3/html/REST/2.0/Delete/
Modified:
   rt/   (props changed)
   rt/branches/rt-3.3/docs/design_docs/atom-api.txt
   rt/branches/rt-3.3/html/REST/2.0/dhandler
   rt/branches/rt-3.3/lib/RT/CurrentUser.pm
   rt/branches/rt-3.3/lib/RT/Date.pm
Log:
 ----------------------------------------------------------------------
 r4385 at not:  autrijus | 2004-05-02T21:16:04.349680Z
 
 * Correct POD for W3CDTF
 ----------------------------------------------------------------------
 r4388 at not:  autrijus | 2004-05-03T00:17:22.934822Z
 
 * massive redesign based on discussion with obra.
 ----------------------------------------------------------------------
 r4389 at not:  autrijus | 2004-05-03T00:21:25.960300Z
 
 * Rename "Create" to "Add"; "Delete" to "Remove".
 
 ----------------------------------------------------------------------


Modified: rt/branches/rt-3.3/docs/design_docs/atom-api.txt
==============================================================================
--- rt/branches/rt-3.3/docs/design_docs/atom-api.txt	(original)
+++ rt/branches/rt-3.3/docs/design_docs/atom-api.txt	Sun May  2 20:21:29 2004
@@ -1,4 +1,4 @@
-RT/REST API 2.0
+RT/Atom 0.3 API
 ===============
 This implementation is based on Atom 0.3.
 
@@ -11,57 +11,121 @@
 Request methods and response status codes are specified here:
     http://www.w3.org/Protocols/rfc2616/rfc2616.html
 
-Some example URIs are:
+Some example canonical URIs are:
+
+    /Atom/0.3					# FeedURI
+    /Atom/0.3/RT-Tickets			# FeedURI
+    /Atom/0.3/RT-Tickets!add			# PostURI (Container)
+    /Atom/0.3/RT-Tickets/15			# EditURI (Object)
+    /Atom/0.3/RT-Tickets/15.Subject		# EditURI (Property)
+    /Atom/0.3/RT-Tickets/15!update		# PostURI (Object)
+    /Atom/0.3/RT-Tickets/15!comment		# PostURI (Object)
+    /Atom/0.3/RT-Tickets/15!correspond		# PostURI (Object)
+    /Atom/0.3/RT-Tickets/15,16,17!update	# PostURI (ResultSet)
+    /Atom/0.3/RT-Tickets/15/Transactions	# FeedURI
+
+An example exchange: Create an 'autrijus' user, then add it to all groups
+that has 'root' as member.
+
+First, the RT::Client code:
+
+    my $user = $rt->Users->add(
+	Name => 'autrijus',
+	EmailAddress => 'autrijus at example.com',
+    );
+
+    $rt->Groups->search("HasMember='root'")->update(
+	Members => { add => $user },
+    );
+
+And now the actual interactions (OPTIONS can also be replaced by GET):
+
+    OPTIONS /Atom/0.3/Users!add
+
+	200 OK
+	...schema data...
+
+    POST /Atom/0.3/Users!add
+    ...<Name>autrijus</Name>...
+    ...<EmailAddress>autrijus at example.com</EmailAddress>...
+
+	303 See Other
+	Location: /Atom/0.3/RT-Users/20
+
+    GET /Atom/0.3/RT-Users/20
+
+	200 OK
+	...<atom:id>rt-fsck.com://some-id</atom:id>...
+
+    HEAD /Atom/0.3/Groups?query=HasMember%3D'root'&rows=all
+
+	200 OK
+	Location: /Atom/0.3/RT-Groups/(1,2,3,5,8,13)
+
+    OPTIONS /Atom/0.3/RT-Groups/(1,2,3,5,8,13)!update
+
+	200 OK
+	...schema data...
+
+    POST /Atom/0.3/RT-Groups/(1,2,3,5,8,13)!update
+    ...<Members><add href="rt-fsck.com://some-id"/></Members>...
+	
+	207 Multiple Status
+	...<status><code>200</code><description>Member Added</description>...
+
+Here is a list of all verbs supported by this API:
+
+    [Search] - GET FeedURI
+
+    Search for objects within an container.
+    Possible query parameters: rows, page, query.
+    200: Success.  Body is the result serialized as an AtomFeed.
+	It entries are found, the 'Location:' header is set to a ResultSet.
+    400: Request failed.  Body is error message in text/plain.
+    404: There is no container matching the specified URI.
+
+    [Get] - GET EditURI
+
+    Retrieve a representation of an object or property.
+    Possible query parameters: expand
+    200: Success.  Body is the serialized item.
+    400: Request failed.  Body is error message in text/plain.
+    404: There is no object matching the specified URI.
+
+    [Put] - PUT EditURI
+
+    Modifies an object or property with the serialization in the request body.
+    200: Success.  Body is the serialized item again.
+    400: Request failed.  Body is error message in text/plain.
+    404: There is no object matching the specified URI.
+
+    [Remove] - DELETE EditURI
+
+    Remove the specified object.
+    200: Successfully deleted.  Body is success message in text/plain.
+    400: Request failed.  Body is error message in text/plain.
+    404: There is no object matching the specified URI.
+
+    [Describe] - OPTIONS PostURI | GET PostURI
+
+    On a container, returns the schema of objects acceptable by this container.
+    On an object, returns the schema acceptable by the specified 'adverb'.
+    200: Success.  Body is schema in a format determined by content negotiation.
+    400: Request failed.  Body is error message in text/plain.
+    404: There is no container matching the specified URI.
+
+    [Add] - POST PostURI (Container)
+
+    Create a new object from the AtomEntry in the request's body.
+    303: Created.  The 'Location:' header is set to the new object's EditURI
+	(for subsequent Get/Update).  Body is success message in text/plain.
+    400: Request failed.  Body is error message in text/plain.
+    404: There is no container matching the specified URI.
+
+    [Update] - POST PostURI (Object)
+
+    Updates an object, using an 'adverb' acceptable to that object's class.
+    207: Updated.  Body is the status code and messages for each updated item.
+    400: Request failed.  Body is error message in text/plain.
+    404: The specific object does not exist, or does not support this adverb.
 
-    /REST/2.0/				# FeedURI
-    /REST/2.0/tickets			# FeedURI
-    /REST/2.0/tickets-new		# PostURI (Container)
-    /REST/2.0/tickets/15		# EditURI
-    /REST/2.0/tickets/15-comment	# PostURI (Object)
-    /REST/2.0/tickets/15-correspond	# PostURI (Object)
-    /REST/2.0/tickets/15/transactions	# FeedURI
-
-[GET FeedURI]
-Search for objects within an container.
-Possible query parameters: rows, page, query.
-200: Success.  Body is the result, serialized as an AtomFeed.
-400: Request failed.  Body is error message in text/plain.
-404: There is no container matching the specified URI.
-
-[GET EditURI]
-Get a representation of an object.
-200: Success.  Body is the object, serialized as an AtomEntry.
-400: Request failed.  Body is error message in text/plain.
-404: There is no object matching the specified URI.
-
-[PUT EditURI]
-Modifies an object with the AtomEntry in the request body.
-200: Success.  Body is the object, serialized as an AtomEntry.
-400: Request failed.  Body is error message in text/plain.
-404: There is no object matching the specified URI.
-
-[DELETE EditURI]
-Delete an object.
-200: Successfully deleted.  Body is success message in text/plain.
-400: Request failed.  Body is error message in text/plain.
-404: There is no object matching the specified URI.
-
-[OPTIONS PostURI], [GET PostURI]
-On a container, returns the schema of objects acceptable by this container.
-On an object, returns the schema acceptable by the specified 'adverb'.
-200: Success.  Body is schema in a format determined by content negotiation.
-400: Request failed.  Body is error message in text/plain.
-404: There is no container matching the specified URI.
-
-[POST PostURI] (Container)
-Create a new object from the AtomEntry in the request's body.
-303: Created.  The 'Location:' header is set to the new object's EditURI
-     (for subsequent Get/Update).  Body is success message in text/plain.
-400: Request failed.  Body is error message in text/plain.
-404: There is no container matching the specified URI.
-
-[POST PostURI] (Object)
-Updates an object, using an 'adverb' acceptable to that object's class.
-200: Success.  Body is the object, serialized as an AtomEntry.
-400: Request failed.  Body is error message in text/plain.
-404: The specific object does not exist, or does not support this adverb.

Added: rt/branches/rt-3.3/html/REST/2.0/Add/index
==============================================================================
--- (empty file)
+++ rt/branches/rt-3.3/html/REST/2.0/Add/index	Sun May  2 20:21:29 2004
@@ -0,0 +1,6 @@
+%# [POST PostURI] (Container)
+%# Create a new object from the AtomEntry in the request's body.
+%# 303: Created.  The 'Location:' header is set to the new object's EditURI
+%#      (for subsequent Get/Update).  Body is success message in text/plain.
+%# 400: Request failed.  Body is error message in text/plain.
+%# 404: There is no container matching the specified URI.

Added: rt/branches/rt-3.3/html/REST/2.0/Remove/index
==============================================================================
--- (empty file)
+++ rt/branches/rt-3.3/html/REST/2.0/Remove/index	Sun May  2 20:21:29 2004
@@ -0,0 +1,5 @@
+%# [DELETE EditURI]
+%# Delete an object.
+%# 200: Successfully deleted.  Body is success message in text/plain.
+%# 400: Request failed.  Body is error message in text/plain.
+%# 404: There is no object matching the specified URI.

Modified: rt/branches/rt-3.3/html/REST/2.0/dhandler
==============================================================================
--- rt/branches/rt-3.3/html/REST/2.0/dhandler	(original)
+++ rt/branches/rt-3.3/html/REST/2.0/dhandler	Sun May  2 20:21:29 2004
@@ -136,12 +136,15 @@
 my $verb = {
     GET	    => 'Get',
     HEAD    => 'Get',
-    POST    => 'Create',
+    POST    => 'Add',
     PUT	    => 'Put',
-    DELETE  => 'Delete',
+    DELETE  => 'Remove',
     OPTIONS => 'Describe',
 }->{$r->method} or return $m->comp('Elements/Error', Status => 405);
 
+require YAML;
+die YAML::Dump(\%ENV);
+
 my $path = $m->dhandler_arg;
 my ($type, @parts) = grep length, split('/', $path);
 
@@ -156,7 +159,7 @@
     $adverb = $1;
     $verb = 'Describe' if $verb eq 'Get';
     $m->comp('Elements/Error', Status => 405)
-        unless $verb =~ /Create|Describe/;
+        unless $verb =~ /Add|Describe/;
 }
 
 if ((@parts % 2) == 0) {
@@ -165,7 +168,7 @@
 }
 elsif ($adverb) {
     # PostURI on object
-    $verb = 'Update' if $verb eq 'Create';
+    $verb = 'Update' if $verb eq 'Add';
 }
 
 my $map = $m->comp('Elements/Introspect', Want => 'CollectionToClass');

Modified: rt/branches/rt-3.3/lib/RT/CurrentUser.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/CurrentUser.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/CurrentUser.pm	Sun May  2 20:21:29 2004
@@ -425,6 +425,7 @@
 sub Authenticate { 
     my ($self, $password, $created, $nonce, $realm) = @_;
 
+    require Digest::MD5;
     require Digest::SHA1;
     require MIME::Base64;
 
@@ -433,7 +434,7 @@
     my $auth_digest = MIME::Base64::encode_base64(Digest::SHA1::sha1(
 	$nonce .
 	$created .
-	Digest::SHA1::sha1_hex("$username:$realm:$server_pass")
+	Digest::MD5::md5_hex("$username:$realm:$server_pass")
     ));
 
     chomp($password);

Modified: rt/branches/rt-3.3/lib/RT/Date.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Date.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Date.pm	Sun May  2 20:21:29 2004
@@ -529,9 +529,9 @@
 
 # }}}
 
-# {{{ sub ISO
+# {{{ sub W3CDTF
 
-=head2 ISO
+=head2 W3CDTF
 
 Takes nothing
 


More information about the Rt-commit mailing list