Apply common settings across Blueprints
Last updated
Last updated
NOTE: This is an advanced instruction for manipulating MyST using the REST APIs. Take a backup of the database before performing any direct manipulations using the API.
If you are looking to set common properties against a Platform Blueprint this guide will show you how. Adding the commands into a parameterized script would allow you to bulk edit the properties and Platform Blueprints.
In this example, we explain how to update a Platform Blueprint using the REST API. At a minimum you will require curl
to be installed on your machine. To make JSON manipulation easier, it is also recommended to install jq
which is downloadable from here.
In order to interact with API, you will first need to retrieve and/or regenerate an API key from MyST Studio. This can be performed as follows: 1. Login to MyST Studio with an administrator account 2. Click on "Administration" then select "Users" 3. Under the MySTAdministrator (API User) click on drop-down and select "Show API Key" 4. Copy the key, we will use this later in our MyST workspace. If you want, you can generate a new key at any time.
The below curl
examples will assume the following are set as environment variables
MYST_TOKEN=<your api key>
MYST_HOST=<your MyST host>
BLUEPRINT_ID=<your blueprint id>
BLUEPRINT_VERSION=<your blueprint version>
NOTE: The BLUEPRINT_ID
and BLUEPRINT_VERSION
can easily be found in your browser URL when selecting the Platform Blueprint.
See a related article How do I use the MyST REST API to see and manipulate Blueprint and Model source files? to get a list of blueprints and their IDs using the REST API.
We are going to download that source to a file called blueprint.json
for our Platform Blueprint.
If you wish to retrieve a specific revision of a platform blueprint version, you can add %5Bpr23%5D to the url as shown below. This will retrieve revision 23.
Note: when accessing a specific revision of a platform blueprint version, the curl url needs to use http
with the appropriate port instead of using https
If you want to change the previously downloaded Blueprint you need to first extract the contents from the data
element and create a new file called new-blueprint.json
.
For example,
should look like
Alternatively, run the following in jq
to create a new-blueprint.json
file from blueprint.json
Now that you have a new-blueprint.json
which is in a format that can be pushed to MyST, you can update the contents as you see fit.
Once you are happy with the change, you can push that to MyST as shown below.
After you have saved your Platform Blueprint change to MyST Studio, it will still be in an uncommitted stage, you can either login to MyST Studio and commit the change using the web console or you can do it using the REST API. Below is an example commit request.
Edit the new.json as desired - e.g. change oracle.base
and myst.agent.home