Application Programming Interface Guide > Built-in Procedures > Procedures Reference > MoveResource
 
MoveResource
Move the specified resource into a folder using a new name.
Note: This procedure is different from the web services operation of the same name, which is in the resource tree under /services/webservices/system/admin/resource/operations/.
Location
/lib/resource/
Inputs
path: The path to the resource to move.
type: The type of the source resource to move.
newPath: The path of the target container to move the resource into.
newName: The new name to call the moved resource.
overwrite: If a resource exists in the target container with the same name and type as the target resource, and overwrite is TRUE, the resource within the target container is overwritten. If overwrite is FALSE, DuplicateNameException is generated and the resource is not moved.
Outputs
N/A
Exceptions
DuplicateNameException: If a resource in the target container exists with the same name and type as the source, and overwrite is FALSE.
IllegalArgumentException: If any of the given paths or types are malformed.
IllegalStateException: If the source resource is not allowed to be moved. Resources in /services/databases/system, /services/webservices/system, or within any physical data source may not be moved.
NotAllowedException: If the source resource is not allowed to exist within the target container. Resources cannot be moved into a physical data source. A LINK resource can only be moved into a RELATIONAL_DATA_SOURCE, SCHEMA, or PORT under /services. Non-LINK resources cannot be moved into any location under /services.
NotFoundException: If the source resource or any portion of the path to the target container does not exist.
SecurityException: If the user does not have READ access on all items in the source path.
SecurityException: If the user does not have READ access on the items in the newPath other than the last item.
SecurityException: If the user does not have WRITE access to the last item in newPath.
SecurityException: If the user does not have WRITE access to a resource that is to be overwritten.