omni.OmniApiClient
Class for interacting with the Omni REST API. There are low level functions for making direct requests to the API (get, post, put, delete). These methods take a "path" arg that is equivalent to the path given in the Omni API docs. The client also includes convenience methods for common tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
organization_name |
str | None
|
Omni organization name. OMNI_ORGANIZATION_NAME environment variable will be used as a fallback. |
None
|
api_key |
str | None
|
Omni API key. OMNI_API_KEY environment variable will be used as a fallback. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
base_url |
Omni REST API base URL that paths will be appended to. |
|
api_key |
Omni API key. |
Source code in src/omni/client.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
delete(path)
Makes a DELETE request to the Omni REST API.
Returns:
Type | Description |
---|---|
dict
|
JSON response from the Omni REST API. |
Source code in src/omni/client.py
85 86 87 88 89 90 91 |
|
get(path, params=None)
Makes a GET request to the Omni REST API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path in the Omni REST API to make a GET request. |
required |
params |
dict | None
|
Query string parameters to use in the GET request. |
None
|
Returns:
Type | Description |
---|---|
dict
|
JSON response from the Omni REST API. |
Source code in src/omni/client.py
49 50 51 52 53 54 55 56 57 58 59 |
|
post(path, json_data=None)
Makes a POST request to the Omni REST API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path in the Omni REST API to make a POST request. |
required |
json_data |
dict | None
|
Query string parameters to use in the POST request. |
None
|
Returns:
Type | Description |
---|---|
dict
|
JSON response from the Omni REST API. |
Source code in src/omni/client.py
61 62 63 64 65 66 67 68 69 70 71 |
|
put(path, json_data=None)
Makes a PUT request to the Omni REST API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path in the Omni REST API to make a PUT request. |
required |
json_data |
dict | None
|
Query string parameters to use in the PUT request. |
None
|
Returns:
Type | Description |
---|---|
dict
|
JSON response from the Omni REST API. |
Source code in src/omni/client.py
73 74 75 76 77 78 79 80 81 82 83 |
|
refresh_model(model_id)
Refreshes this model to reflect the latest structures (schemas, views, fields) from the data source. This will remove any structures that are no longer present in the source, but will not remove anything created by users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
str
|
The ID of the Omni model to refresh. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful. |
Source code in src/omni/client.py
35 36 37 38 39 40 41 42 43 44 45 46 47 |
|