Skip to content

CMB API Guide

Note

Using the Groovy DSL service, you can perform request and response exchanges with built-in Platform 6 services.

Here are the services which expose an API through the common message bus:

All Platform 6 Services expose the common API here:

Services running outside the Platform 6 JVM can use the Platform Manager API:

Note

No specific user permissions are required to perform a request to a service.

Parameters

Each request has a header and carries the information of the request. In order to audit the user performing the action, two parameters are added to every request:

Headers of the request

Header’s key Description Value
platform6.request.user The user performing the action String
platform6.request.user.permissions The permissions of the user performing the action String or null

The user performing the action can be:

  • Anonymous:

    • platform6.request.user => “anonymous@amalto.com
    • platform6.request.user.permissions => empty string
  • Authenticated:

    • platform6.request.user => “email@client.com
    • platform6.request.user.permissions => “permissions string”

    Note

    If the platform6.request.user.permissions header is null it means we have not managed to retrieve the permissions.

Info

More information about permissions can be found in the Scopes & Permissions section.

Example

If the application key is null, it will return the whole list of bundled resources.

def cm = [ headers: [ 'platform6.request.action': 'list.ids' ] ]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.value']
[
   {
      "appKey": "ondiflo",
      "name": "Bundled resource #1"
   },
   {
      "appKey": "",
      "name": "Email template"
   }
]

If the application key is empty, it will return the Platform 6 bundled resources.

def cm = [ 
    headers: [ 
        'platform6.request.action': 'list.ids',
        'appKey': '' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.value']
[
   {
      "appKey": "",
      "name": "Email template"
   }
]

If the application key is not empty, it will return the bundled resources associated to the application key.

def cm = [ 
    headers: [ 
        'platform6.request.action': 'list.ids',
        'appKey': 'ondiflo' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.value']
[
   {
      "appKey": "",
      "name": "Email template"
   }
]