setBranchFlag
Requires a customer (portal or buyer app) session.
flag/un-flag an existing same-partner address as a branch (CUSTOMER_ADMIN only). Flagging requires a unique label (BRANCH_LABEL_REQUIRED / BRANCH_LABEL_CONFLICT); un-flagging runs the in-use guard and nulls the order limit.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation SetBranchFlag($addressId: ID!, $isBranch: Boolean!) {
setBranchFlag(addressId: $addressId, isBranch: $isBranch) {
id
approverCount
isActive
isBranch
label
memberCount
approvers {
firstName
lastName
email
role
userId
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation SetBranchFlag($addressId: ID!, $isBranch: Boolean!) {\n setBranchFlag(addressId: $addressId, isBranch: $isBranch) {\n id\n approverCount\n isActive\n isBranch\n label\n memberCount\n approvers {\n firstName\n lastName\n email\n role\n userId\n }\n }\n}",
"variables": {
"addressId": "id",
"isBranch": true
}
}
EOF
Variables:
{
"addressId": "id",
"isBranch": true
}
Response:
{
"data": {
"setBranchFlag": {
"id": "id",
"approverCount": 0,
"isActive": true,
"isBranch": true,
"label": "string",
"memberCount": 0,
"approvers": [
{
"firstName": "string",
"lastName": "string",
"email": "string",
"role": "string",
"userId": "id"
}
]
}
}
}
setBranchFlag(
addressId: ID!
isBranch: Boolean!
): CustomerBranch!
Arguments
setBranchFlag.addressId ● ID! non-null scalar
The ID of the address.
setBranchFlag.isBranch ● Boolean! non-null scalar
True to mark the address as a branch, false to unmark it.
Type
CustomerBranch object
a partner sales branch — an Address with isBranch = true. The label is the branch name; pendingApprovalCount feeds the deactivation warning (EDGE #4).