This function creates a new branch with the provided name and color, based on an existing branch specified by its ID.
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 | Required | Description |
|---|---|---|---|
parent_branch_id |
Number | Yes | 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 | Yes | Name of the new branch. |
color |
String | No | Hex value of the color chip associated with the branch, including #. Must be a 7 character hex color. Default color is #f7394a. |
Changeset_ID |
Number | Yes | Optional. ID of a changeset on the parent branch to create the new branch from. Must belong to parent_branch_id. |
Branch_Create_Session_ID |
String | Yes | Optional. The branch_create_session_id returned when a previous call responded with completed: false. Send it to continue creating the branch; the other parameters are not read when it is present. |
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"
}
}