Apply common settings across Blueprints
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.
Retrieving your API key
Setting up your environment
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.
Getting a list of available Blueprints
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.
Download the source file for a given Platform Blueprint
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
Manipulate the local Platform Blueprint source file and update MyST
Manually extract data element
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
Using jq to extract data element
Alternatively, run the following in jq
to create a new-blueprint.json
file from blueprint.json
Manually update the request payload
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.
Using jq to update the request payload
Once you are happy with the change, you can push that to MyST as shown below.
Commit the Platform Blueprint
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.
Last updated