gavincornwell

v1 REST API - Part 12 - Discovery

Blog Post created by gavincornwell Employee on Apr 28, 2017

Our journey through the v1 REST APIs in 5.2 is nearly at an end, last time we looked at the trashcan API, in this part we're going to look at arguably one of the most important APIs, the discovery API.

 

As there is only one GET endpoint in this API there is no Postman collection for this post as you can follow along with this post using just a browser.

 

The discovery API is available at http://localhost:8080/alfresco/api/discovery and as the name suggests it provides information on the repository, such as version number, feature status and which modules are installed.

 

We recommend that clients call this API as early as possible in their lifecycle so that it's features can be sensitive to the repository's capabilities. A good example is the ability the manage shared links, this feature can be disabled on the server, in this scenario the /shared-links endpoints will return a 501 status code, if this is not handled by the UI it does not provide a very good user experience!

 

Calling this API on my repository (installed using the Community installer) returns the following response:

{
  "entry": {
    "repository": {
      "edition": "Community",
      "version": {
        "major": "5",
        "minor": "2",
        "patch": "0",
        "hotfix": "0",
        "schema": 10005,
        "label": "r135134-b14",
        "display": "5.2.0.0 (r135134-b14) schema 10005"
      },
      "status": {
        "isReadOnly": false,
        "isAuditEnabled": true,
        "isQuickShareEnabled": true,
        "isThumbnailGenerationEnabled": true
      },
      "modules": [
        {
          "id": "alfresco-aos-module",
          "title": "Alfresco Office Services Module",
          "description": "Allows applications that can talk to a SharePoint server to talk to your Alfresco installation",
          "version": "1.1.5",
          "installDate": "2017-02-20T10:52:26.618+0000",
          "installState": "INSTALLED",
          "versionMin": "5.1",
          "versionMax": "999"
        },
        {
          "id": "org.alfresco.integrations.google.docs",
          "title": "Alfresco / Google Docs Integration",
          "description": "The Repository side artifacts of the Alfresco / Google Docs Integration.",
          "version": "3.0.3",
          "installDate": "2017-02-20T10:52:27.288+0000",
          "installState": "INSTALLED",
          "versionMin": "5.0.0",
          "versionMax": "5.99.99"
        },
        {
          "id": "alfresco-share-services",
          "title": "Alfresco Share Services AMP",
          "description": "Module to be applied to alfresco.war, containing APIs for Alfresco Share",
          "version": "5.2.0",
          "installDate": "2017-02-20T10:52:27.779+0000",
          "installState": "INSTALLED",
          "versionMin": "5.1",
          "versionMax": "999"
        },
        {
          "id": "alfresco-trashcan-cleaner",
          "title": "alfresco-trashcan-cleaner project",
          "description": "The Alfresco Trash Can Cleaner (Alfresco Module)",
          "version": "2.2",
          "installState": "UNKNOWN",
          "versionMin": "0",
          "versionMax": "999"
        },
        {
          "id": "fdk-custom-model-module",
          "title": "FDK Custom Model Module",
          "description": "Packages the FDK custom model as a simple module",
          "version": "1.0-SNAPSHOT",
          "installState": "UNKNOWN",
          "versionMin": "0",
          "versionMax": "999"
        }
      ]
    }
  }
}

 

Although this has been the shortest post in this series so far, hopefully you can see the value and importance of this small, simple API.

 

There is one final post in this series to come where we'll cover some topics that apply to all APIs and highlight some capabilities of the API you might not have known were there!

Outcomes