|
9 | 9 |
|
10 | 10 | # Configure connection to SystemLink server |
11 | 11 | server_configuration = HttpConfiguration( |
12 | | - server_uri="https://yourserver.yourcompany.com", |
13 | | - api_key="YourAPIKeyGeneratedFromSystemLink", |
| 12 | + server_uri="https://test-api.lifecyclesolutions.ni.com/", |
| 13 | + api_key="9voCglXGPBxU6-ZIQyFEwmIAymkdn_ynqOO7t52q2v", |
14 | 14 | ) |
15 | 15 |
|
16 | 16 | client = FileClient(configuration=server_configuration) |
|
100 | 100 | custom_metadata = UpdateMetadataRequest( |
101 | 101 | replace_existing=False, |
102 | 102 | properties={ |
103 | | - "Department": "Engineering", |
104 | | - "Project": "TestAutomation", |
105 | | - "Status": "Active", |
106 | | - "Version": "1.0", |
| 103 | + "TestProperty1": "TestValue1", |
| 104 | + "TestProperty2": "TestValue2", |
107 | 105 | }, |
108 | 106 | ) |
109 | 107 | client.update_metadata(metadata=custom_metadata, id=file_id_2) |
|
114 | 112 |
|
115 | 113 | # Search by multiple custom properties using AND operator |
116 | 114 | search_request = models.SearchFilesRequest( |
117 | | - filter='(properties.Department:"Engineering") AND (properties.Project:"TestAutomation")', |
| 115 | + filter='(properties.TestProperty1:"TestValue1") AND (properties.TestProperty2:"TestValue2")', |
118 | 116 | skip=0, |
119 | 117 | take=10, |
120 | 118 | ) |
121 | 119 |
|
122 | 120 | response = client.search_files(search_request) |
123 | 121 | print( |
124 | 122 | f"Found {response.total_count.value if response.total_count else 0} file(s) with " |
125 | | - "Department=Engineering AND Project=TestAutomation" |
| 123 | + "TestProperty1=TestValue1 AND TestProperty2=TestValue2" |
126 | 124 | ) |
127 | 125 | if response.available_files: |
128 | 126 | for file in response.available_files: |
129 | 127 | if file.properties: |
130 | 128 | print(f"- {file.properties.get('Name')}") |
131 | | - print(f" Department: {file.properties.get('Department')}") |
132 | | - print(f" Project: {file.properties.get('Project')}") |
133 | | - print(f" Status: {file.properties.get('Status')}") |
| 129 | + print(f" TestProperty1: {file.properties.get('TestProperty1')}") |
| 130 | + print(f" TestProperty2: {file.properties.get('TestProperty2')}") |
134 | 131 |
|
135 | 132 | # Clean up: delete both test files |
136 | 133 | print("\nCleaning up...") |
|
0 commit comments