You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -6,6 +6,144 @@ For specific instructions on how to use Split Admin REST API refer to our [offic
6
6
7
7
Full documentation on this Python wrapper is available in [this link](https://help.split.io/hc/en-us/articles/4412331052685-Python-PyPi-library-for-Split-REST-Admin-API).
8
8
9
+
## Using in Harness Mode
10
+
11
+
Starting with version 3.5.0, the Split API client supports operating in "harness mode" to interact with both Split and Harness Feature Flags APIs. This is required for usage in environments that have been migrated to Harness and want to use the new features. Existing API keys will continue to work with the non-deprecated endpoints after migration, but new Harness Tokens will be required for Harness mode.
12
+
13
+
For detailed information about Harness API endpoints, please refer to the [official Harness API documentation](https://apidocs.harness.io/).
14
+
15
+
### Authentication in Harness Mode
16
+
17
+
The client supports multiple authentication scenarios:
18
+
19
+
1. Harness-specific endpoints always use the 'x-api-key' header format
20
+
2. Split endpoints will use the 'x-api-key' header when using the harness_token
21
+
3. Split endpoints will use the normal 'Authorization' header when using the apikey
22
+
4. If both harness_token and apikey are provided, the client will use the harness_token for Harness endpoints and the apikey for Split endpoints
23
+
24
+
### Base URLs and Endpoints
25
+
26
+
- Existing, non-deprecated Split endpoints continue to use the Split base URLs
27
+
- New Harness-specific endpoints use the Harness base URL (https://app.harness.io/)
28
+
29
+
### Deprecated Endpoints
30
+
31
+
The following Split endpoints are deprecated and cannot be used in harness mode:
32
+
-`/workspaces`: POST, PATCH, DELETE, PUT verbs are deprecated
33
+
-`/apiKeys`: POST verb for apiKeyType == 'admin' is deprecated
34
+
-`/users`: all verbs are deprecated
35
+
-`/groups`: all verbs are deprecated
36
+
-`/restrictions`: all verbs are deprecated
37
+
38
+
Non-deprecated endpoints will continue to function as they did before the migration.
39
+
40
+
### Basic Usage
41
+
42
+
To use the client in harness mode:
43
+
44
+
```python
45
+
from splitapiclient.main import get_client
46
+
47
+
# Option 1: Use harness_token for Harness endpoints and apikey for Split endpoints
48
+
client = get_client({
49
+
'harness_mode': True,
50
+
'harness_token': 'YOUR_HARNESS_TOKEN', # Used for Harness-specific endpoints
51
+
'apikey': 'YOUR_SPLIT_API_KEY', # Used for existing Split endpoints
52
+
'account_identifier': 'YOUR_HARNESS_ACCOUNT_ID'# Required for Harness operations
53
+
})
54
+
55
+
# Option 2: Use harness_token for all operations (if apikey is not provided)
56
+
client = get_client({
57
+
'harness_mode': True,
58
+
'harness_token': 'YOUR_HARNESS_TOKEN', # Used for both Harness and Split endpoints
59
+
'account_identifier': 'YOUR_HARNESS_ACCOUNT_ID'
60
+
})
61
+
```
62
+
63
+
### Working with Split Resources in Harness Mode
64
+
65
+
You can still access standard Split resources with some restrictions:
66
+
67
+
```python
68
+
# List workspaces (read-only in harness mode)
69
+
for ws in client.workspaces.list():
70
+
print(f"Workspace: {ws.name}, Id: {ws.id}")
71
+
72
+
# Find a specific workspace
73
+
ws = client.workspaces.find("Default")
74
+
75
+
# List environments in a workspace
76
+
for env in client.environments.list(ws.id):
77
+
print(f"Environment: {env.name}, Id: {env.id}")
78
+
```
79
+
80
+
### Working with Harness-specific Resources
81
+
82
+
Harness mode provides access to several Harness-specific resources through dedicated microclients:
83
+
84
+
- token
85
+
- harness_apikey
86
+
- service_account
87
+
- harness_user
88
+
- harness_group
89
+
- role
90
+
- resource_group
91
+
- role_assignment
92
+
- harness_project
93
+
94
+
Basic example:
95
+
96
+
```python
97
+
# Account identifier is required for all Harness operations
Starting with version 3.5.0, the Split API client supports operating in "harness mode" to interact with both Split and Harness Feature Flags APIs.
237
-
238
-
For detailed information about Harness Feature Flags API endpoints, please refer to the [official Harness API documentation](https://apidocs.harness.io/).
239
-
240
-
### Authentication in Harness Mode
241
-
242
-
The client supports multiple authentication scenarios:
243
-
244
-
1. Harness-specific endpoints always use the 'x-api-key' header format
245
-
2. Split endpoints will use the 'x-api-key' header when using the harness_token
246
-
3. Split endpoints will use the normal 'Authorization' header when using the apikey
247
-
4. If both harness_token and apikey are provided, the client will use the harness_token for Harness endpoints and the apikey for Split endpoints
248
-
249
-
### Base URLs and Endpoints
250
-
251
-
- Existing, non-deprecated Split endpoints continue to use the Split base URLs
252
-
- New Harness-specific endpoints use the Harness base URL (https://app.harness.io/)
253
-
254
-
### Deprecated Endpoints
255
-
256
-
The following Split endpoints are deprecated and cannot be used in harness mode:
257
-
-`/workspaces`: POST, PATCH, DELETE, PUT verbs are deprecated
258
-
-`/apiKeys`: POST verb for apiKeyType == 'admin' is deprecated
259
-
-`/users`: all verbs are deprecated
260
-
-`/groups`: all verbs are deprecated
261
-
-`/restrictions`: all verbs are deprecated
262
-
263
-
### Basic Usage
264
-
265
-
To use the client in harness mode:
266
-
267
-
```python
268
-
from splitapiclient.main import get_client
269
-
270
-
# Option 1: Use harness_token for Harness endpoints and apikey for Split endpoints
271
-
client = get_client({
272
-
'harness_mode': True,
273
-
'harness_token': 'YOUR_HARNESS_TOKEN', # Used for Harness-specific endpoints
274
-
'apikey': 'YOUR_SPLIT_API_KEY', # Used for existing Split endpoints
275
-
'account_identifier': 'YOUR_HARNESS_ACCOUNT_ID'# Required for Harness operations
276
-
})
277
-
278
-
# Option 2: Use harness_token for all operations (if apikey is not provided)
279
-
client = get_client({
280
-
'harness_mode': True,
281
-
'harness_token': 'YOUR_HARNESS_TOKEN', # Used for both Harness and Split endpoints
282
-
'account_identifier': 'YOUR_HARNESS_ACCOUNT_ID'
283
-
})
284
-
```
285
-
286
-
### Working with Split Resources in Harness Mode
287
-
288
-
You can still access standard Split resources with some restrictions:
289
-
290
-
```python
291
-
# List workspaces (read-only in harness mode)
292
-
for ws in client.workspaces.list():
293
-
print(f"Workspace: {ws.name}, Id: {ws.id}")
294
-
295
-
# Find a specific workspace
296
-
ws = client.workspaces.find("Default")
297
-
298
-
# List environments in a workspace
299
-
for env in client.environments.list(ws.id):
300
-
print(f"Environment: {env.name}, Id: {env.id}")
301
-
```
302
-
303
-
### Working with Harness-specific Resources
304
-
305
-
Harness mode provides access to several Harness-specific resources through dedicated microclients:
306
-
307
-
- token
308
-
- harness_apikey
309
-
- service_account
310
-
- harness_user
311
-
- harness_group
312
-
- role
313
-
- resource_group
314
-
- role_assignment
315
-
- harness_project
316
-
317
-
Basic example:
318
-
319
-
```python
320
-
# Account identifier is required for all Harness operations
0 commit comments