Join our Community in its new Home - The Datorama Trailblazer Community Group!

It's been an amazing 3 years coming together in this forum to collaborate, innovate, support, and inspire each other about our shared usage of Datorama. While this is not quite a goodbye, we are excited to announce that we are getting a fresh start in our new home within the Salesforce Trailblazer Community. We have a ton of fun new content planned and you may even see the revival of some of our most popular posts from the past few years.

We’ll be keeping this group around for a bit for you to peruse, but as of November 15, we will no longer be allowing new posts or comments. Be sure to join our new group at https://www.salesforce.com/success-datorama to keep the conversation going.

We can’t wait to see you there!

Datorama Platform API (Part 2): Managing Multiple Accounts - Datorama at Scale

Have you ever had to create multiple users with the same permissions or change the settings on multiple data streams?

You will know how time consuming it can be to click through within the Platform UI. This is the perfect opportunity to flex the Platform API’s muscles to maximize your efficiency! You have automated a lot of your previously manual task within Datorama such as pulling data and creating reports - but taking it to the next level of automation is automating the tasks you do within Datorama.

In this post, we are going to look at a number of examples of automating your Datorama tasks at scale and think about how you can push this further to help improve and automate your business processes. If you haven’t used the Platform API before, we will be jumping straight into the use cases here so I would recommend looking back at Part 1 of this series to help you get started.

Developer Portal - Platform API Documentation

Everything you need to get started with the Platform API can be found on the Developer Portal. It contains all the information you require to use the Platform API, but sometimes it can be a little daunting knowing where to start with the Platform API documentation - so lets have a tour...

Each platform entity, such as: data stream, account or user, has it’s own documentation of endpoints which are related to the different tasks you might want to perform.

For example, in the above screenshot, you can find the endpoint for creating, updating and deleting users within the platform.

For each task, you can then find all the elements required for your HTTP request:
  1. Endpoint
  2. Method
  3. Headers
  4. Successful Response example
These concepts are covered in more detail in part 1 of this blog series - which can be found here.


So now we have looked at where to find all the information we need to make use of the Platform API - let’s think about some potential use cases:

Implementation of Datorama at Scale:
When you are implementing Datorama at Scale - you can find yourself creating lots of very similar entities within the platform - for example, many users with the same permissions or multiple data streams for different profiles within the same account. With the Platform API, you can create these different elements programmatically and at scale.

Update Existing Platform Elements at Bulk:
Sometimes things change and you need to make lots of changes to your platform setup at once. Opening each entity in turn and changing the settings can end up time consuming, but with the Platform API you can update the settings at once. For example - if you have a list of expected user permissions in an external source, you can use the Platform API to support user management and have a single source of truth.

Extract Information from the Platform:
With Datorama as your primary tool for marketing intelligence, you may want to extract information about your account - for example, which data sources and profiles you have as data streams or which users have access to your account. This can enable you to perform an account audit in a much more efficient way.

To turn this from theory to reality - we will take the example of adding a new user group to a user’s profile. With the ability to add multiple user groups to a user, this is a great way to control access and user permissions. As in the first blog, let’s think about the stages we would need to complete this example:
  1. Get the user’s current settings including user groups
  2. Get the settings for the user group
  3. Update the settings for the user to include the new user group
For each stage, we will write a Python function to perform the HTTP request:

Stage 1: Get the user’s current settings including user groups
def get_user_settings(user_id, header):<br>    user_settings = requests.get('https://app.datorama.com/v1/users/{}'.format(user_id), headers=header).json()<br>    return user_settings
Stage 2: Get the settings for the user group (called Permission Set within the Platform API)
def get_permission_set_properties(permission_set_id, header):
permission_set_properties = requests.get('https://app.datorama.com/v1/permission-sets/{}'.format(permission_set_id),
headers=header).json()
return permission_set_properties
Stage 3: Update the settings for the user to include the new user group
def add_permission_set_to_user(user_id, permission_set_id, header):
user_settings = get_user_settings(user_id, headerStr)
permission_set_settings = get_permission_set_properties(permission_set_id, headerStr)
user_settings['permissionSetIds'] = [permission_set_id]
user_settings['permissionSets'] = [permission_set_settings]
response = requests.put('https://app.datorama.com/v1/users/{}'.format(user_id), json=user_settings, headers=header)
return response.reason
Note this example adds a user group to a user which does not already have a user group assigned. If they user already has a user group, you would need to append the new user group to the settings that exist.

I hope that this blog post will inspire you to think about how you could use the Platform API within your account, please use the comments to ask questions and discuss other ideas of use cases for the Platform API.
Sign In or Register to comment.