@@ -872,6 +872,36 @@ def create_item(self, parent, item):
872872 return None
873873 return Item (api_resource = parse_json (self .create_dso (url , params = params , data = item .as_dict ())))
874874
875+ def create_item_version (self , item_uuid , summary = None ):
876+ """
877+ Create a new version of an existing item.
878+ @param item_uuid: UUID of the item to version
879+ @param summary: Optional summary text for the new version
880+ @return: JSON response containing the new version information or None if an error occurs
881+ """
882+ url = f"{ self .API_ENDPOINT } /versioning/versions"
883+ params = {}
884+ if summary is not None :
885+ params ["summary" ] = summary
886+
887+ # Construct the item URI
888+ item_uri = f"{ self .API_ENDPOINT } /core/items/{ item_uuid } "
889+
890+ # Send the POST request with Content-Type:text/uri-list
891+ response = self .api_post_uri (url , params = params , uri_list = item_uri )
892+
893+ if response .status_code == 201 :
894+ # 201 Created - Success
895+ new_version = parse_json (response )
896+ logging .info (f"Created new version for item { item_uuid } " )
897+ return new_version
898+ else :
899+ logging .error (
900+ f"Error creating item version: { response .status_code } { response .text } "
901+ )
902+
903+ return None
904+
875905 def update_item (self , item ):
876906 """
877907 Update item. The Item passed to this method contains all the data, identifiers, links necessary to
0 commit comments