Skip to content

Branch_Create#


Description#

This function creates a new branch with the provided name and color, based on an existing branch specified by its ID. The response contains details of the newly created branch, including its ID, name, color, and preview URL.

Requirements#

Miva version 10.00.00 or later.

Request Body Parameters#

Parameter
Type Description
parent_branch_id Number The ID of the branch you want to copy from. You can load all branches using BranchList_Load_Query to get the correct branch ID.
name String Name of the new branch.
color String Hex value of the color chip associated with the branch, including #. Cannot be blank. Default color is #20c171.

Response Parameters#

Parameter
Type Description
success Number 1 indicating a successful request.
0 indicating an unsuccessful request.
id Number ID of the newly created branch.
immutable Boolean Boolean flag for immutable. Every store has a branch which cannot be deleted and is immutable.
branchkey String Unique identifier for the branch. Used to generate a preview link.
name String Name of the branch.
color String Hex value for the branch color chip. Used as a visual identifier in the Miva admin.
preview_url String Preview URL for this specific branch.

Example Request#

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "Branch_Create",
    "Parent_Branch_ID": "1",
    "Name": "My Custom Branch",
    "Color": "#20c171"
}

Example Response#

{
    "success": 1,
    "data": {
        "id": 8,
        "immutable": false,
        "branchkey": "fd0c6c383d61c288f087f111596c07a7",
        "name": "My Custom Branch",
        "color": "#20c171",
        "preview_url": "https://mivadevtest.com/storefront.html?BranchKey=fd0c6c383d61c288f087f111596c07a7"
    }
}