Skip navigation
All Places > Alfresco Content Services (ECM) > Blog > Authors gmelahn
CMIS 1.1



Content Management Interoperability Services (CMIS) 1.1 was recently approved as a standard by OASIS.   As a member of the CMIS Technical Committee from the beginning, I’ve always had a strong interest in this standard. And since joining Alfresco last year to provide technical leadership for our ecosystem of API’s, my interest is even keener. So I was glad to see the OASIS press release this morning, highlighting the strong support this standard is already receiving in the industry. And in particular, it was great to see that the press release included a quote from our own John Newton affirming Alfresco’s commitment to open standards and CMIS.



Unlike a lot of standards that get more complex over time, CMIS is moving in the direction of simplicity. For example, with the introduction in CMIS 1.1 of a Browser Binding, now even casual developers with some HTML and JSON skills can use CMIS to integrate content with their sites and applications. Richard Esplin’s recent post about the “Beauty of CMIS”  reminded me about the analogy between CMIS and the advent of SQL which simplified the lives of developers needing to access relational databases.   In a similar way, CMIS again simplifies our lives by making it possible to access content management data without needing to learn a new API.



If you want to learn more about the new features of CMIS 1.1, Jeff Potts provides a nice summary in his blog.   You may notice that a number of the CMIS 1.1 improvements Jeff mentions are just standardizations of patterns and API’s that Alfresco introduced years ago.   For example, the introduction of ‘Secondary Object-Types’ in CMIS 1.1 is a standardization of Alfresco’s ‘aspect ‘ modeling pattern.   That’s just another illustration of how Alfresco leads the way in content management standards. And if you want to start exploring CMIS yourself, you can see lots of examples in Jeff’s latest book, “CMIS and Apache Chemistry in Action”



I’m glad to see us making steady progress in the standardization of content API’s. Stay tuned to learn more about how Alfresco will leverage CMIS 1.1.
Request to join



Yesterday, I posted about the new Alfresco Favorites API.   As I mentioned, that was the first of a set of API improvements we've introduced.   Another new API is one that makes it possible to request membership in an Alfresco Site.  Let me tell more about it.



The Site Membership Request API



Using Alfresco Share, it's possible to join a public Site or request membership in a moderated Site.     The new Site Membership Request API now makes it possible to do that from a custom app.   



Requesting to Join a Site



Like with all RESTful API's, an HTTP POST request is made to create a new instance, in this case a new instance of a Site Membership Request.   The only thing you need to provide in the POST is a JSON object that contains the id of the site.   For example, suppose there was a moderated site you wanted to join with an id of 'the-secret-site' (nothing gets people more interested in joining than saying it's secret).    To request membership in the site, just POST a JSON object to your site-membership-requests collection, like this... 

  HTTP POST /people/-me-/site-membership-requests

     {

         'id' : 'the-secret-site'

      }


You get back an HTTP status code of 201 (Created) telling that the request worked, and you also get back a JSON object telling you more about the Site Membership Request.   At this point, because this is a moderated site, the request awaits approval from the Site Manager who can approve it using the Share UI (In other words this API is just a new way of creating the request and does not bypass the existing Alfresco request approval workflow). 

 

{                                           

'entry' : {                                

  'id' : 'the-secret-site',

  'createdAt' : '2012-07-20T21:46:09.659+0000',

  'modifiedAt' : '2012-07-20T21:46:09.659+0000',

   'site' : {

    'id' : 'the-secret-site',

    'guid' : '8ac18731-601b-4bb4-be1a-cd5d252cce3f',

    'title' : 'The Company’s Secret Site',

    'visibility' : 'MODERATED',

    'description' : 'The Company’s Secret Site'              

   }

}

}


Suppose that site was public instead of moderated. In that case, the request would be implicitly approved and, as soon as the request completes, you would be a member of that public site.



Getting a list of Site Membership Requests



Suppose you have a number of Site Membership Requests outstanding and you wanted to get that list so you can follow up directly with the Site Manager. Getting a list of pending Site Membership Requests is just a matter of issuing an HTTP GET request on your site-membership-requests collection. Here is an example. 

 

HTTP GET /people/-me-/site-membership-requests


and the result s an HTTP Status Code of 200 (OK) and an Alfresco list that looks like this ... 

 

   'list' : {

     'pagination' : {

       'count' : 2,

       'hasMoreItems' : false,

       'totalItems' : 2,

       'skipCount' : 0,

       'maxItems' : 100

     },

     'entries' : [ {

       'entry' : {

         'site' : {

           'guid' : '8ac18731-601b-4bb4-be1a-cd5d252cce3f',

           'id' : 'the-secret-site',

           'title' : 'The Company’s Secret Site',

           'visibility' : 'MODERATED',

           'description' : 'The Company’s Secret Site'

         },

         'id' : 'the-secret-site',

         'createdAt' : '2012-07-20T21:46:09.659+0000'

       }

     }, {

       'entry' : {

         'site' : {

           'guid' : 'f1833491-24ee-439f-ac4c-e3358e5e4c99',

           'id' : 'Marketing',

           'title' : 'The Marketing Site Site',

           'visibility' : 'MODERATED'

         },

         'id' : 'Marketing',

         'createdAt' : '2013-04-10T18:51:28.000+0000'

       }

     } ]

   }

}


The format of the list object that comes back from this request should look familiar if you've already using the Alfresco API. We've standardized the list format to provide a consistent structure that can be easily processed in JavaScript.



Deleting a Site Membership Request

Suppose you just want to cancel a pending request. That can be done using a HTTP DELETE request, as in this example.

  HTTP DELETE /people/-me-/site-membership-requests/the-secret-site


And the response is an HTTP Status Code of 204 (No Content).



Summary

This was just a brief introduction to this new API.



I hope you're interested in becoming an Alfresco API user. Just register for a free developer key and download the Reference Guide to get started.




Favorite



You'll recall that in October of 2012, Alfresco announced the availability of the public Alfresco API.    This simple RESTful API makes it possible for developers to build exciting custom applications with your choice of programming language and tools.



But that was just the beginning.   Over the weekend, the Alfresco team was busy deploying some new extensions to the API set.   One of these, my new favourite, is the Favorites API.



 

The Favorites API



We all have our favorite Sites, Files and Folders.   And wouldn't it be nice to have an easy way in your code to get a list of your Favorites as well as add and remove Favorites?    Now there is!   



Getting a List of Favorites



In the spirit of REST, getting a list of your Favorites is just a matter of performing an HTTP GET of the favorites collection like this ...

HTTP GET /people/-me-/favorites




and what comes back is a list of your favorites, like this...




{

  'list' : {

    'pagination' : {

'count' : 3,

'hasMoreItems' : false,

'totalItems' : 3,

'skipCount' : 0,

'maxItems' : 100

  },

     'entries' : [ {

'entry' : {

  'targetGuid' : '1e365051-34af-4379-8a86-0b9bddc4ca9b',

  'target' : {

   'file' : {

    'name' : 'Beach.jpg',

    'title' : 'My Favorite Beach',

    'guid' : '1e365051-34af-4379-8a86-0b9bddc4ca9b',

    'createdAt' : '2013-01-15T23:17:30.636+0000',

    'modifiedAt' : '2013-01-15T23:20:40.841+0000',

    'createdBy' : 'greg.melahn@alfresco.com',

    'modifiedBy' : 'greg.melahn@alfresco.com',

    'mimeType' : 'image/jpeg',

    'sizeInBytes' : 12205,

    'versionLabel' : '1.2',

    'id' : '1e365051-34af-4379-8a86-0b9bddc4ca9b'

   }

  }

}

  }, {

'entry' : {

  'targetGuid' : '690745a5-094a-4a97-bf40-434f9751c2c9',

  'target' : {

   'folder' : {

    'name' : 'Attachments',

    'guid' : '690745a5-094a-4a97-bf40-434f9751c2c9',

    'createdAt' : '2013-01-21T23:45:56.933+0000',

    'modifiedAt' : '2013-01-21T23:45:56.933+0000',

    'createdBy' : 'greg.melahn@alfresco.com',

    'modifiedBy' : 'greg.melahn@alfresco.com',

    'id' : '690745a5-094a-4a97-bf40-434f9751c2c9'

   }

  }

}

  }, {

'entry' : {

  'createdAt' : '2013-04-09T21:22:21.767+0000',

  'targetGuid' : 'df40f96c-c874-4540-a7f2-8b1a58b14832',

  'target' : {

   'site' : {

    'id' : 'pie',

    'guid' : 'df40f96c-c874-4540-a7f2-8b1a58b14832',

    'title' : 'PIE',

    'description' : 'PIE team',

    'visibility' : 'PUBLIC',

              'role' : 'SiteManager'

    }

   }

  }

}

    ]

}


Notice in the list you see an instance of a Site, a Folder and a File along with useful information about each entity.   For example, in the case of the Site object, you see your role in that Site.  That extra information saves you the trouble of making another request to get more information (avoiding that trip back to the server is particularly important for mobile apps).  Also, notice the list is in the same standard format we introduced when the Alfresco Public API was published last year.



And because it's just a JSON object, you can easily consume the list with a few lines of JavaScript like this...

   function saveFavorites(favReq) { 

      var myFavorites = JSON.parse(favReq.responseText);

      $.each(myFavorites.list.entries, function(index, value) {   

         favorites.push(value.entry.target.site.id);

         }

      );

   }


Adding a New Favorite



Now what if you want to add a new Favorite?    Easy.   Just perform an HTTP POST to the favorites collection like this ...

HTTP POST /people/-me-/favorites 

     {

       'target': {

          'site' : {

             'guid' : '8ac18731-601b-4bb4-be1a-cd5d252cce3f'

           }  

        }

     }


The result is an HTTP Status of 201 which means the object is now a Favorite, and a JSON object is returned with useful information about the new Favorite.

   

{

       'entry' : {  

          'targetGuid' : '8ac18731-601b-4bb4-be1a-cd5d252cce3f',

          'createdAt' : '2012-07-20T21:46:09.659+0000',    

          'target': {    

             'site' : {      

                'id' : 'foo',

                'guid' : '8ac18731-601b-4bb4-be1a-cd5d252cce3f',

                'title' : 'A Few of My Favorite Things',

                'visibility' : 'PRIVATE',

                'description' : 'The Favorite Site',

                'role' : 'SiteManager”

              }

           }

        } 

     }


Removing a Favorite



Should you decide that something is no longer a Favorite, just perform an HTTP DELETE on the entry in the favorites collection, like this ...

   

HTTP DELETE /people/-me-/favorites/8ac18731-601b-4bb4-be1a-cd5d252cce3f


and the result is an HTTP Status Code of 204 (No Content).   Note this does not delete the object itself (the Site in this example), just the fact that it is a Favorite.

Summary



That's just a brief introduction, but hopefully I've given you a taste of the new API.



If you want to start using the Alfresco API, just register for a free developer key and download the Reference Guide.



And there's more, so stay tuned!   Look for a post about another new API that allows you to request access to Sites.



Filter Blog

By date: By tag: