Move an Account Hierarchy
/bcws/webresources/v1.0/accounts/hierarchy/move/{id}
- Move a parent account and all its children to a new parent. Set only the path id and primaryParentId.
- Move a parent account to a new parent and move all its children to a different parent. Set the path id, primaryParentId, childrenParentId, and list all of the children in the request body. The account specified in the path is moved to primaryParentId and the children are moved to childrenParentId.
- Move a parent account and some of its children to a new parent, and move some of its children to a different parent. Set the path id, primaryParentId, childrenParentId, and list the children to move to the new parent in the request body. The children listed in the body are moved to childrenParentId, and the account specified in the path is moved with any remaining children to primaryParentId.
- Move specified children to a different parent, leaving the original parent and any unspecified children behind. Set the path id and primaryParentId, set moveChildren to true, and list the children to move to the new parent in the request body. The account specified in the path and any of its children not listed in the body are left as-is. The children listed in the body are moved to primaryParentId.
The request body is ignored unless childrenParentId is set or moveChildren is set to true. When moveChildren is set to true, a body is required and childrenParentId is ignored. If moveChildren isn't set, the default of false is used.
Request
-
id(required): string
The ID of the primary account of the hierarchy to move to a new hierarchy.
-
childrenParentId: string
The ID of the account to move the primary account's children to. This can be any account.
If you specify this, a request body is required.
This parameter is ignored when moveChildren is set to true.
-
moveChildren: boolean
Whether only the children are moved (true) or the children and the parent are moved (false).
If you set this to true, a request body is required and only the children listed in the request body are moved to the account specified in primaryParentId. The account specified in the path and any of its children not listed in the request body remain in place. childrenParentId is ignored.
If you set this to false or do not set it, the account specified in the path and all its children are moved according to primaryParentId and childrenParentId.
-
primaryParentId: string
The ID of the account to move the hiearchy to. If moveChildren is unset or set to false, this will be the new parent of the primary account specified in the path. If moveChildren is set to true, this will be the new parent of the children listed in the request body.
- application/xml
- application/json
Response
200 Response
500 Response
Examples
This example shows how to move accounts to new parents in organization hierarchies by submitting a POST request on the REST resource using cURL. For more information about cURL, see "Use cURL".
cURL Command
curl -X POST 'http://hostname:port/bcws/webresources/v1.0/accounts/hierarchy/move/0.0.0.1+-account+123346?primaryParentId=0.0.0.1+-account+81329&childrenParentId=0.0.0.1+-account+56789 -d @childAccounts.json'
where:
- hostname is the URL for the Billing Care REST server.
- port is the port for the Billing Care REST server.
- version is the version of the API you're using, such as v1.0.
- childAccounts.json is the JSON file containing the list of child accounts to transfer.
In this example:
- 0.0.0.1+-account+123346 is the existing parent account.
- Because the moveChildren query parameter is unspecified, the default of false is assumed. The existing parent account and all of its child accounts are moved into new hierarchies.
- primaryParentId=0.0.0.1+-account+81329 specifies the new parent for the existing parent account.
- childrenParentId=0.0.0.1+-account+56789 specifies the new parent for the child accounts listed in the body.
- Any child accounts not listed in the body remain under the existing parent account in its new hierarchy.
Example of Request Body
This example shows the contents of the childAccounts.json file sent as the request body. These accounts will be moved under the account specified in childrenParentId. Any not listed here remain under their existing parent.
[
"0.0.0.1+-account+81329",
"0.0.0.1+-account+85712",
"0.0.0.1+-account+123346"
]
Example of Response Body
If successful, a 200 response code is returned with no response body. You can confirm the new hierarchies by submitting requests at the "Get the Organization Hierarchy for an Account" endpoint.