Create and Edit a Configuration - Programatically

Create and Edit a Configuration - Programatically

Specific use case:

  • Double all the formation strength UCS

Recommended work flow:

  • Create a scratch configuration in the web client to use as a data template to edit.
  • Get the configuration data from this scratch configuration via our API. For this case, we will use python alongside the openlab module.
  • Programatically edit/make the desired changes to this configuration data.
  • Push the edited data to the API


For the final code, jump to the bottom section

Create a scratch configuration

Go to and login into your account.

Click the "New configuration" button on the homepage and a dialog box should appear. Choose the template that is most closely related to your configurtaion and name it. You will delete this configuration later.

Take note of the configuration id.

Retrieve configuration data

import openlab

# Auto-generated credentials from

session = openlab.http_client()

Get the data and print it out to inspect it.

# Copy and paste this id from the web client url endpoint
config_id = ""

data = session.get_configuration_data(config_id)


This outputs an un-navigable chunk of text, so we inspect the dictionaries keys to give us a clue and help navigate to where UCS might be.


output -> ['Rig', 'Fluids', 'GeoThermal', 'Trajectory', 'DrillString', 'GeoPressure', 'Architecture', 'FormationStrength']

Upon further investigation, we see that FormationStrength is a list of dictionaries, with each dictionary element consisting of a UCS key:value pair.

Let's print out the last element's UCS

# Get the last elements UCS
fs_last = data["FormationStrength"][-1]
ucs_last = fs_last["UCS"]


Edit the data

Now that we have found the data we want to make changes to, we can update it. We will assign the original scratch config data a new value (double the original value).

# Double each UCS
for fs in data["FormationStrength"]:
    fs["UCS"] *= 2

Push the new configuration data

Finally, we create the new configuration by calling the create_configuration(name, data) method, passing in the newly manipulated configuration data.

# Create a new configuration with the edited data
name = "Doubled UCS"
session.create_configuration(name, data)

Now, we have created a new configuration which has double the UCS as the default template. You can verify this by going to the web client and viewing the new configuration.

Final Code

import openlab

# Initialize an openlab session
session = openlab.http_client()

# Get an existing configuration
config_id = "aee5eb03-f550-4c27-81d9-5673cd9b5876"
data = session.configuration_data(config_id)

# Double each UCS
for fs in data["FormationStrength"]:
    fs["UCS"] *= 2

# Create a new configuraition with the edited data
session.create_configuration("New Configuration", data)

Who is using OpenLab:

  • University of Stavanger
  • NTNU
  • Aker BP
  • Maersk Drilling
  • Equinor
  • University of Calgary