pyxecm 3.9.3__tar.gz → 3.9.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {pyxecm-3.9.3 → pyxecm-3.9.4}/PKG-INFO +1 -1
  2. {pyxecm-3.9.3 → pyxecm-3.9.4}/pyproject.toml +1 -1
  3. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/helper/data.py +49 -9
  4. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otcs.py +73 -5
  5. {pyxecm-3.9.3 → pyxecm-3.9.4}/.gitignore +0 -0
  6. {pyxecm-3.9.3 → pyxecm-3.9.4}/README.md +0 -0
  7. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/__init__.py +0 -0
  8. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/avts.py +0 -0
  9. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/coreshare.py +0 -0
  10. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/errors.py +0 -0
  11. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/helper/__init__.py +0 -0
  12. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/helper/assoc.py +0 -0
  13. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/helper/logadapter.py +0 -0
  14. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/helper/web.py +0 -0
  15. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/helper/xml.py +0 -0
  16. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otac.py +0 -0
  17. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otawp.py +0 -0
  18. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otca.py +0 -0
  19. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otds.py +0 -0
  20. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otiv.py +0 -0
  21. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otkd.py +0 -0
  22. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otmm.py +0 -0
  23. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/otpd.py +0 -0
  24. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm/py.typed +0 -0
  25. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/__init__.py +0 -0
  26. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/__main__.py +0 -0
  27. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/app.py +0 -0
  28. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/auth/__init__.py +0 -0
  29. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/auth/functions.py +0 -0
  30. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/auth/models.py +0 -0
  31. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/auth/router.py +0 -0
  32. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/common/__init__.py +0 -0
  33. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/common/functions.py +0 -0
  34. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/common/metrics.py +0 -0
  35. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/common/models.py +0 -0
  36. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/common/router.py +0 -0
  37. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/config/__init__.py +0 -0
  38. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/config/functions.py +0 -0
  39. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/config/models.py +0 -0
  40. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/config/router.py +0 -0
  41. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/pods/__init__.py +0 -0
  42. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/pods/functions.py +0 -0
  43. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/pods/log_spool.py +0 -0
  44. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/pods/models.py +0 -0
  45. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/pods/router.py +0 -0
  46. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/settings.py +0 -0
  47. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/terminal/__init__.py +0 -0
  48. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/terminal/router.py +0 -0
  49. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_maintenance/__init__.py +0 -0
  50. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_maintenance/functions.py +0 -0
  51. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_maintenance/models.py +0 -0
  52. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_maintenance/router.py +0 -0
  53. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_otcs/__init__.py +0 -0
  54. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_otcs/functions.py +0 -0
  55. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_otcs/router.py +0 -0
  56. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_payload/__init__.py +0 -0
  57. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_payload/functions.py +0 -0
  58. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_payload/log_reader.py +0 -0
  59. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_payload/models.py +0 -0
  60. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_api/v1_payload/router.py +0 -0
  61. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/__init__.py +0 -0
  62. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/__main__.py +0 -0
  63. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/browser_automation.py +0 -0
  64. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/customizer.py +0 -0
  65. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/exceptions.py +0 -0
  66. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/guidewire.py +0 -0
  67. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/k8s.py +0 -0
  68. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/log.py +0 -0
  69. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/m365.py +0 -0
  70. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/manager_push.py +0 -0
  71. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/payload.py +0 -0
  72. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/payload_list.py +0 -0
  73. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/salesforce.py +0 -0
  74. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/sap.py +0 -0
  75. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/sap_forms.py +0 -0
  76. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/sap_metadata.py +0 -0
  77. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/sap_models.py +0 -0
  78. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/servicenow.py +0 -0
  79. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/settings.py +0 -0
  80. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/successfactors.py +0 -0
  81. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/translate.py +0 -0
  82. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_customizer/version.py +0 -0
  83. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_maintenance_page/__init__.py +0 -0
  84. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_maintenance_page/__main__.py +0 -0
  85. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_maintenance_page/app.py +0 -0
  86. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_maintenance_page/settings.py +0 -0
  87. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_maintenance_page/static/favicon.avif +0 -0
  88. {pyxecm-3.9.3 → pyxecm-3.9.4}/src/pyxecm_maintenance_page/templates/maintenance.html +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyxecm
3
- Version: 3.9.3
3
+ Version: 3.9.4
4
4
  Summary: A Python library to interact with Opentext Content Management Rest API
5
5
  Project-URL: Homepage, https://github.com/opentext/pyxecm
6
6
  Author-email: Kai Gatzweiler <kgatzweiler@opentext.com>, "Dr. Marc Diefenbruch" <mdiefenb@opentext.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyxecm"
3
- version = "3.9.3"
3
+ version = "3.9.4"
4
4
  description = 'A Python library to interact with Opentext Content Management Rest API'
5
5
  keywords = [
6
6
  'opentext',
@@ -705,18 +705,30 @@ class Data:
705
705
  convert_dates: bool = False,
706
706
  index_column: str | None = None,
707
707
  compression: str | None = None,
708
+ replace: bool = False,
708
709
  ) -> bool:
709
710
  """Load JSON data into a Pandas data frame.
710
711
 
712
+ Without a schema (no `dtypes` given when the Data object was created), pandas infers the
713
+ data types.
714
+
715
+ With a schema, the JSON file is loaded with the schema (e.g. data saved with save_json_data()):
716
+ pandas does not infer the data types (it would e.g. turn the string "1e3" into the number
717
+ 1000.0), and the schema is applied after loading (see apply_schema()): the columns of the
718
+ schema with their data types (also datetimes, if saved in ISO format) and the index
719
+ (`index_columns`). If the schema cannot be applied, the data frame is left unchanged.
720
+
711
721
  Args:
712
722
  json_path (str):
713
723
  The path to the JSON file.
714
724
  convert_dates (bool, optional):
715
725
  Defines whether or not dates should be converted.
716
- The default is False = dates are NOT converted.
726
+ The default is False = dates are NOT converted. With a schema, the datetime
727
+ columns of the schema are converted anyway.
717
728
  index_column (str | None, optional):
718
729
  The Name of the column (i.e. JSON data field) that should
719
730
  become the index in the loaded data frame. Defaults to None.
731
+ Not to be combined with a schema - its index (`index_columns`) is applied.
720
732
  compression (str | None, optional):
721
733
  The compression of the JSON file that is to be decompressed:
722
734
  * gzip (.gz)
@@ -725,6 +737,9 @@ class Data:
725
737
  * xz (.xz)
726
738
  The value for compression should not include the dot.
727
739
  Default is None = no compression.
740
+ replace (bool, optional):
741
+ If True, the loaded data replaces the content of the data frame. If False (default),
742
+ it is appended to the data frame (with a new row index).
728
743
 
729
744
  Returns:
730
745
  bool: False in case an error occurred, True otherwise.
@@ -758,6 +773,8 @@ class Data:
758
773
  path_or_buf=json_path,
759
774
  convert_dates=convert_dates,
760
775
  compression=compression,
776
+ # With a schema the data types are defined by it - pandas must not infer them:
777
+ dtype=not self._schema,
761
778
  )
762
779
 
763
780
  if index_column and index_column not in df.columns:
@@ -769,10 +786,18 @@ class Data:
769
786
 
770
787
  if index_column:
771
788
  df = df.set_index(keys=index_column)
772
- if self._df is None:
789
+ previous_df = self._df
790
+ if replace or self._df is None:
773
791
  self._df = df
774
792
  else:
775
793
  self._df = pd.concat([self._df, df], ignore_index=True)
794
+ if self._schema:
795
+ try:
796
+ self.apply_schema()
797
+ except Exception:
798
+ # apply_schema() has logged the error - keep the data frame as it was:
799
+ self._df = previous_df
800
+ raise
776
801
  self.logger.info(
777
802
  "After loading JSON file -> '%s', the data frame has %s row(s) and %s column(s)",
778
803
  json_path,
@@ -824,9 +849,14 @@ class Data:
824
849
  preserve_index: bool = False,
825
850
  index_column: str = "index",
826
851
  compression: str | None = None,
852
+ indent: int | None = 2,
827
853
  ) -> bool:
828
854
  """Save JSON data from data frame to file.
829
855
 
856
+ Datetimes are saved in ISO format (with millisecond precision). A data frame saved with
857
+ `orient="records"` is loaded again with its data types by load_json_data() of a Data object
858
+ with the same schema.
859
+
830
860
  Args:
831
861
  json_path (str):
832
862
  The path to where the JSON file should be saved.
@@ -851,6 +881,9 @@ class Data:
851
881
  * zip (.zip)
852
882
  * xz (.xz)
853
883
  Default is None = no compression.
884
+ indent (int | None, optional):
885
+ The number of spaces to indent the JSON. None writes compact JSON (smaller files).
886
+ Defaults to 2.
854
887
 
855
888
  Returns:
856
889
  bool:
@@ -874,8 +907,10 @@ class Data:
874
907
  # Save data to JSON file
875
908
  try:
876
909
  if self._df is not None:
877
- if not os.path.exists(os.path.dirname(json_path)):
878
- os.makedirs(os.path.dirname(json_path), exist_ok=True)
910
+ # A file name without directory is saved in the current directory:
911
+ json_directory = os.path.dirname(json_path)
912
+ if json_directory:
913
+ os.makedirs(json_directory, exist_ok=True)
879
914
 
880
915
  # index parameter is only allowed if orient has one of the following values:
881
916
  if orient in ("columns", "index", "table", "split"):
@@ -883,7 +918,7 @@ class Data:
883
918
  path_or_buf=json_path,
884
919
  index=preserve_index,
885
920
  orient=orient,
886
- indent=2,
921
+ indent=indent,
887
922
  compression=compression,
888
923
  date_format="iso",
889
924
  )
@@ -899,7 +934,7 @@ class Data:
899
934
  df_with_index.to_json(
900
935
  path_or_buf=json_path,
901
936
  orient=orient,
902
- indent=2,
937
+ indent=indent,
903
938
  compression=compression,
904
939
  date_format="iso",
905
940
  )
@@ -907,7 +942,7 @@ class Data:
907
942
  self._df.to_json(
908
943
  path_or_buf=json_path,
909
944
  orient=orient,
910
- indent=2,
945
+ indent=indent,
911
946
  compression=compression,
912
947
  date_format="iso",
913
948
  )
@@ -1819,6 +1854,9 @@ class Data:
1819
1854
  def deduplicate(self, unique_fields: list, inplace: bool = True) -> pd.DataFrame:
1820
1855
  """Remove duplicate rows that have all fields in unique_fields in common.
1821
1856
 
1857
+ The index defined for this Data object (`index_columns`) is kept - its rows are selected by it (e.g.
1858
+ with `loc[]`). Without one, the rows are numbered again (0, 1, 2, ...).
1859
+
1822
1860
  Args:
1823
1861
  unique_fields (list):
1824
1862
  Defines the fields for which we want a unique combination for.
@@ -1834,11 +1872,13 @@ class Data:
1834
1872
 
1835
1873
  if inplace:
1836
1874
  self._df.drop_duplicates(subset=unique_fields, inplace=True)
1837
- self._df.reset_index(drop=True, inplace=True)
1875
+ if not self._index_columns:
1876
+ self._df.reset_index(drop=True, inplace=True)
1838
1877
  return self._df
1839
1878
  else:
1840
1879
  df = self._df.drop_duplicates(subset=unique_fields, inplace=False)
1841
- df = df.reset_index(drop=True, inplace=False)
1880
+ if not self._index_columns:
1881
+ df = df.reset_index(drop=True, inplace=False)
1842
1882
  return df
1843
1883
 
1844
1884
  # end method definition
@@ -6661,6 +6661,10 @@ class OTCS:
6661
6661
  ) -> dict | None:
6662
6662
  """Get a node based on the node ID.
6663
6663
 
6664
+ Workspace type (verified with OTCM 26.4): for a business workspace the properties have the
6665
+ workspace type name ("wksp_type_name"), but no workspace type ID - and this REST API does not
6666
+ support business properties. Use get_workspace() with "business_properties" for the ID.
6667
+
6664
6668
  Args:
6665
6669
  node_id (int):
6666
6670
  The ID of the node to retrieve.
@@ -7370,6 +7374,12 @@ class OTCS:
7370
7374
  ) -> dict | None:
7371
7375
  """Get the subnodes of a given parent node ID.
7372
7376
 
7377
+ Workspace type (verified with OTCM 26.4): business workspaces in the subnodes have the workspace
7378
+ type name ("wksp_type_name") in their properties, but no workspace type ID - not even if requested
7379
+ with "properties{wnf_wksp_type_id}". Use get_workspace() with "business_properties" for the ID.
7380
+
7381
+ REST API endpoint: GET /api/v1/nodes/{parent_node_id}/subnodes
7382
+
7373
7383
  Args:
7374
7384
  parent_node_id (int):
7375
7385
  The ID of the parent node.
@@ -15089,7 +15099,18 @@ class OTCS:
15089
15099
  ) -> dict | None:
15090
15100
  """Get a workspace based on the node ID.
15091
15101
 
15092
- REST endpoint: /v2/businessworkspaces
15102
+ REST endpoint: /v2/businessworkspaces/{node_id}
15103
+
15104
+ Workspace type (verified with OTCM 26.4): the properties have the workspace type NAME
15105
+ ("wksp_type_name"), but never the workspace type ID - not even if requested with
15106
+ "properties{wnf_wksp_type_id}" (unlike get_workspace_by_type_and_name() and
15107
+ get_workspace_relationships()). The ID is only in the business properties
15108
+ ("business_properties" -> "workspace_type_id"). They are delivered for all workspaces (also
15109
+ for workspaces without business objects) if "business_properties" is in `fields` (it can be
15110
+ narrowed, e.g. "business_properties{workspace_type_id}") or if `fields` is empty. So the default
15111
+ `fields="properties"` delivers no type ID. NOTE: the "workspace_type_name" of the business
15112
+ properties is not always the name of the workspace type (e.g. "Project" for the workspace type
15113
+ "SAP PPM Project") - use "wksp_type_name" of the properties for the name.
15093
15114
 
15094
15115
  Args:
15095
15116
  node_id (int):
@@ -15103,6 +15124,8 @@ class OTCS:
15103
15124
  - "business_properties" (all the information for the business object and the external system)
15104
15125
  NOTE: this delivers only one business object per workspace. If there are multiple business objects connected to the workspace
15105
15126
  only the first one will be returned. Use "workspace_references" to get all connected business objects.
15127
+ It is also the only place where this REST API delivers the workspace type ID ("workspace_type_id",
15128
+ see above).
15106
15129
  - "categories" (the category data of the workspace item)
15107
15130
  - "workspace_references" (a list with the references to business objects in external systems)
15108
15131
  - "display_urls" (a list with the URLs to external business systems)
@@ -15407,6 +15430,11 @@ class OTCS:
15407
15430
  Returning a generator avoids loading a large number of workspace instances
15408
15431
  at once. Instead you can iterate over the potential large list of subnodes.
15409
15432
 
15433
+ Workspace type (verified with OTCM 26.4): each workspace instance has the workspace type ID in
15434
+ its properties ("wnf_wksp_type_id") - with narrowed `fields` only if they include it, e.g.
15435
+ "properties{id,name,wnf_wksp_type_id}". It has no workspace type name ("wksp_type_name"). See
15436
+ get_workspace_by_type_and_name() for the details.
15437
+
15410
15438
  Example usage:
15411
15439
  ```python
15412
15440
  workspace_instances = otcs_object.get_workspace_instances_iterator(type_id=2)
@@ -15600,11 +15628,21 @@ class OTCS:
15600
15628
  either as the type ID or the type name.
15601
15629
 
15602
15630
  The REST API endpoint of this method is /v2/businessworkspaces
15631
+
15603
15632
  This API is behaving different from normal node / workspace API.
15604
15633
  Especially the fields and metadata deliver a non-standard format.
15605
15634
  fields=categories seems to not deliver the actual category data.
15606
15635
  If you want category data you should use get_workspace() method instead.
15607
15636
 
15637
+ Workspace type (verified with OTCM 26.4): each workspace has the workspace type ID in its
15638
+ properties ("wnf_wksp_type_id") - with narrowed `fields` only if they include it, e.g.
15639
+ "properties{id,name,wnf_wksp_type_id}" (with `fields` this method requests only the given
15640
+ properties - `action=properties-`; without it OTCS would ignore the narrowing and deliver all
15641
+ properties). The properties have NO workspace type name: "wksp_type_name" is not delivered, and
15642
+ "wnf_wksp_type_formatted" is not always the name of the workspace type (e.g. "Project" for the
15643
+ workspace type "SAP PPM Project") - resolve the name from the ID, e.g. with
15644
+ get_workspace_type_name(). This REST API does not deliver business properties.
15645
+
15608
15646
  Args:
15609
15647
  type_name (str, optional):
15610
15648
  The name of the workspace type.
@@ -16785,6 +16823,15 @@ class OTCS:
16785
16823
 
16786
16824
  REST API endpoint of this method is /v2/businessworkspaces/{id}/relateditems
16787
16825
 
16826
+ Workspace type (verified with OTCM 26.4): each related workspace has the workspace type ID in its
16827
+ properties ("wnf_wksp_type_id") - with narrowed `fields` only if they include it, e.g.
16828
+ "properties{id,wnf_wksp_type_id,rel_type}" (with `fields` this method requests only the given
16829
+ properties - `action=properties-`; without it OTCS would ignore the narrowing and deliver all
16830
+ properties). The properties have NO workspace type name: "wksp_type_name" is not delivered, and
16831
+ "wnf_wksp_type_formatted" is not always the name of the workspace type (e.g. "Project" for the
16832
+ workspace type "SAP PPM Project") - resolve the name from the ID, e.g. with
16833
+ get_workspace_type_name(). This REST API does not deliver business properties.
16834
+
16788
16835
  Args:
16789
16836
  workspace_id (int):
16790
16837
  The ID of the workspace.
@@ -17019,6 +17066,11 @@ class OTCS:
17019
17066
  Using a generator avoids loading a large number of nodes into memory at once.
17020
17067
  Instead you can iterate over the potential large list of related workspaces.
17021
17068
 
17069
+ Workspace type (verified with OTCM 26.4): each related workspace has the workspace type ID in its
17070
+ properties ("wnf_wksp_type_id") - with narrowed `fields` only if they include it, e.g.
17071
+ "properties{id,wnf_wksp_type_id,rel_type}". It has no workspace type name ("wksp_type_name").
17072
+ See get_workspace_relationships() for the details.
17073
+
17022
17074
  Example usage:
17023
17075
  ```python
17024
17076
  related_workspaces = otcs_object.get_workspace_relationships_iterator(workspace_id=15838)
@@ -25719,14 +25771,30 @@ class OTCS:
25719
25771
  workspace_node_id = self.get_result_value(response=workspace_node, key="id")
25720
25772
  elif isinstance(workspace_node, int):
25721
25773
  workspace_node_id = workspace_node
25722
- workspace_node = self.get_workspace(node_id=workspace_node_id, fields=fields, metadata=metadata)
25774
+ # Unlike the workspace instances and related workspaces, get_workspace() has the workspace type ID
25775
+ # only in the business properties (see get_workspace()) - so they are requested as well. Without
25776
+ # fields, get_workspace() delivers all field groups (including the business properties):
25777
+ workspace_node = self.get_workspace(
25778
+ node_id=workspace_node_id,
25779
+ fields=[*(fields if isinstance(fields, list) else [fields]), "business_properties{workspace_type_id}"]
25780
+ if fields
25781
+ else fields,
25782
+ metadata=metadata,
25783
+ )
25723
25784
  else:
25724
25785
  self.logger.error("Illegal type of workspace node parameter. Expect 'int' or 'dict'!")
25725
25786
  return {"processed": processed, "traversed": traversed}
25726
25787
 
25727
25788
  workspace_name = self.get_result_value(response=workspace_node, key="name")
25728
- workspace_type_id = self.get_result_value(response=workspace_node, key="wnf_wksp_type_id")
25729
- workspace_type_name = self.get_workspace_type_name(type_id=workspace_type_id)
25789
+ workspace_type_id = self.get_result_value(response=workspace_node, key="wnf_wksp_type_id", show_error=False)
25790
+ if workspace_type_id is None:
25791
+ # If we don't get the workspace type ID from the standard field, try the business properties:
25792
+ workspace_type_id = self.get_result_value(
25793
+ response=workspace_node, key="workspace_type_id", property_name="business_properties", show_error=False
25794
+ )
25795
+ workspace_type_name = (
25796
+ self.get_workspace_type_name(type_id=workspace_type_id) if workspace_type_id is not None else None
25797
+ )
25730
25798
 
25731
25799
  if workspace_node_id in processed_workspaces:
25732
25800
  self.logger.info(
@@ -25741,7 +25809,7 @@ class OTCS:
25741
25809
  processed_workspaces[workspace_node_id] = workspace_name
25742
25810
 
25743
25811
  self.logger.info(
25744
- "Processing workspace -> '%s' (%s) of type -> '%s' (%d) in depth -> %d",
25812
+ "Processing workspace -> '%s' (%s) of type -> '%s' (%s) in depth -> %d",
25745
25813
  workspace_name,
25746
25814
  workspace_node_id,
25747
25815
  workspace_type_name,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes