QueryApp: add the REST API for members_of
authorRichard Levitte <richard@levitte.org>
Tue, 30 May 2017 13:21:23 +0000 (15:21 +0200)
committerRichard Levitte <richard@levitte.org>
Tue, 30 May 2017 13:21:23 +0000 (15:21 +0200)
RESTAPI.txt
bin/query.psgi

index fcffabd0da9aa8fec99e17338be14d1fcf2323c9..abe268657f5021bd39e8cd709723ae36e4e22e83 100644 (file)
@@ -32,6 +32,10 @@ Version 0 API:
 
     Fetches the identity under which :name has a CLA, if any.
 
+/0/Group/:group/Members
+
+    Fetches the list of identities belonging to the group :group.
+
 /0/HasCLA/:id
 
     Checks if there is a CLA under the precise identity :id.  This
index 704aec797fdbdce2d415be608e066fef0d22cdef..cf7218e1cec75e2ced6da698e97d7bd619137d46 100644 (file)
@@ -115,6 +115,15 @@ get '/Person/:name/HasCLA' => sub {
   send_error('Not found', HTTP_NO_CONTENT);
 };
 
+get '/Group/:group/Members' => sub {
+  my $query = OpenSSL::Query->new(bureau => config->{bureau}, REST => 0);
+  my $group = uri_decode(route_parameters->get('group'));
+  my @response = $query->members_of($group);
+
+  return [ @response ] if @response;
+  send_error('Not found', HTTP_NO_CONTENT);
+};
+
 get '/HasCLA/:id' => sub {
   my $query = OpenSSL::Query->new(bureau => config->{bureau}, REST => 0);
   my $id = uri_decode(route_parameters->get('id'));