Skip to content

Changeset_Create#


Description#

This function is used to create a new changeset in Miva. A changeset consists of 5 objects: Templates, CSS, JavaScript, Managed Properties (Theme components), and Resource Group Assignments. Not all objects are required to be passed. Only the objects which have changed should be included in the new Changeset request.

Request Body Parameters#

Parameter
Type Description
Branch_Name String The name of the branch you want to create the changeset on
Notes String Changeset Notes. These are displayed in the Branch History when viewing the changeset as well as at the individual template level
Tags Array Optional. An Array of tags associated with this changeset
Template_Changes Object An array of individual template changes. Each template change should include a Template_Filename, Source, and Settings value. If Source or Settings are omitted, the latest version from the Head of the branch will be used
CSSResource_Changes Object An array of individual CSS Resource changes
JavaScriptResource_Changes Object An array of individual JavaScript Resource changes
Property_Changes Object An array of individual Managed Property changes

Template_Changes Object#

Parameter
Type Description
Template_Filename String The filename of the file you wish to update
Source String The template source contents. If this field is not passed, the latest template from the head of the branch will be used
Settings String JSON object of any settings associated with this template. Not all templates will have settings. If this field is not passed, the latest settings from the head of the branch will be used

CSSResource_Changes Object#

Parameter
Type Description
CSSResource_Code String The code of the CSS Resource you want to update
Source String CSS Resource Source Template. This can be passed as standard JSON (with new line \n) or as a base64 encoded JSON
Global Boolean true/false whether the resource is a global resource (output on all pages)
Active Boolean true/false whether the resource is Active
File_Path String Optional File Path used when CSS file is a local file. Should be relative path.
Attributes Object Array of any attributes associated with the CSS file. These will be listed as name/value pairs

JavaScriptResource_Changes Object#

Parameter
Type Description
JavaScriptResource_Code String The code of the JS Resource you want to update
Source String JavaScript Resource Source Template. This can be passed as standard JSON (with new line \n) or as a base64 encoded JSON
Global Boolean true/false whether the resource is a global resource (output on all pages)
Active Boolean true/false whether the resource is Active
File_Path String Optional File Path used when JS file is a local file. Should be relative path.
Attributes Object Array of any attributes associated with the JS file. These will be listed as name/value pairs

Property_Changes Object#

Parameter
Type Description
Property_Type String The Type of the managed property. One of: cssui_button, readytheme_lookandfeel, readytheme_banner, readytheme_contentsection, readytheme_image, readytheme_nagivationset, readytheme_productlisting, header, footer
Property_Code String This is the theme component Property Code
Settings Object JSON object of property settings. Settings will be different depending on property type

Response Parameters#

Parameter
Type Description
id Number Changeset ID
branch_id Number Branch ID or the Branch new changeset was created on
user_id String ID of the admin user who created the changeset. Changesets created via the API will not have a user id
dtstamp Unix Timestamp Date/Timestamp
notes String Notes Associated with the changeset
tags Array Array of any tags associated with the changeset
formatted_tags String List of all tags including #

Example Request#

{
    "Store_code": "beta",
    "Function": "Changeset_Create",
    "Branch_Name": "Dev Branch - Brennan",
    "Notes": "My First Changeset created via the JSON API",
    "Tags": ["laborday2020", "holiday_Updates"],
    "Template_Changes": [
        {
            "Template_Filename": "abus-header.mvc",
            "Source": "Hello World",
            "Settings": ""
        }
    ],
    "CSSResource_Changes": [
        {
            "CSSResource_Code": "mivatest",
            "Source": "#payment-fields .paypalcp-cc-name-field,\n#payment-fields .paypalcp-cc-number-field,\n#payment-fields .paypalcp-cc-exp-field,\n#payment-fields .paypalcp-cc-cvv-field {\n\tdisplay: block;\n\twidth: 100%;\n",
            "Attributes": [
                {
                    "name": "type",
                    "value": "text/css"
                },
                {
                    "name": "media",
                    "value": "all"
                },
                {
                    "name": "rel",
                    "value": "stylesheet"
                }
            ],
            "Global": true,
            "Active": false,
            "File_Path": ""
        }
    ],
    "JavaScriptResource_Changes": [
        {
            "JavaScriptResource_Code": "sample-js",
            "Source": "alert(\"Hello World Test!\");",
            "Attributes": [
                {
                    "name": "type",
                    "value": "text/javascript"
                }
            ],
            "Global": true,
            "Active": true,
            "File_Path": ""
        }
    ],
    "Property_Changes": [
        {
            "Property_Type": "readytheme_navigationset",
            "Property_Code": "support_navigation",
            "Settings": {
                "items": [
                    {
                        "active": 1,
                        "id": "c0fa0895ebb9f41f6bb235090f506ec5",
                        "link": "About Us</a>",
                        "link_dest": "ABUS",
                        "link_targ": "_self",
                        "link_type": "G",
                        "name": "About Us",
                        "url": "https://mivadevtest.com/about-us.html"
                    },
                    {
                        "active": 1,
                        "id": "73fb038ebdef1aa5cf49f5593e2c0a87",
                        "link": "Contact Us</a>",
                        "link_dest": "CTUS",
                        "link_targ": "_self",
                        "link_type": "G",
                        "name": "Contact Us",
                        "url": "https://mivadevtest.com/contact-us.html"
                    },
                    {
                        "active": 1,
                        "id": "a36b8809cd3b50f7f917d6e12ce97ac4",
                        "link": "Frequent Questions</a>",
                        "link_dest": "FAQS",
                        "link_targ": "_self",
                        "link_type": "G",
                        "name": "Frequent Questions - TEST",
                        "url": "https://mivadevtest.com/frequently-asked-questions.html"
                    },
                    {
                        "active": 1,
                        "link": "Frequent Questions</a>",
                        "link_dest": "FAQS",
                        "link_targ": "_self",
                        "link_type": "G",
                        "name": "NEW NAV ITEM",
                        "url": "https://mivadevtest.com/frequently-asked-questions.html"
                    }
                ],
                "layout": "S",
                "name": "Support Pages Navigation"
            }
        }
    ],
    "ResourceGroup_Changes": []
}

Example Response#

{
    "success": 1,
    "data": {
        "id": 99,
        "branch_id": 5,
        "user_id": 0,
        "dtstamp": 1597162698,
        "notes": "My First Changeset created via the JSON API",
        "tags": ["laborday2020", "holiday_Updates"],
        "formatted_tags": "#laborday2020,holiday_Updates"
    }
}