Skip to content

Commit 079f2fd

Browse files
author
osimloeff
committed
Added PI Web API Batch
1 parent c11c5d1 commit 079f2fd

27 files changed

+319
-1729
lines changed

.gitignore

Lines changed: 90 additions & 313 deletions
Large diffs are not rendered by default.

.idea/PI-Web-API-Client-Python.iml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/workspace.xml

Lines changed: 0 additions & 1346 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

DOCUMENTATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Class | Method | HTTP request | Description
140140
*AttributeTemplateApi* | [**get_categories**](docs/api/AttributeTemplateApi.md#get_categories) | **GET** /attributetemplates/{webId}/categories | Get an attribute template's categories.
141141
*AttributeTraitApi* | [**get_by_category**](docs/api/AttributeTraitApi.md#get_by_category) | **GET** /attributetraits | Retrieve all attribute traits of the specified category/categories.
142142
*AttributeTraitApi* | [**get**](docs/api/AttributeTraitApi.md#get) | **GET** /attributetraits/{name} | Retrieve an attribute trait.
143+
*BatchApi* | [**execute**](docs/api/BatchApi.md#execute) | **POST** /batch | Execute a batch of requests against the service. As shown in the Sample Request, the input is a dictionary with IDs as keys and request objects as values. Each request object specifies the HTTP method and the resource and, optionally, the content and a list of parent IDs. The list of parent IDs specifies which other requests must complete before the given request will be executed. The example first creates an element, then gets the element by the response's Location header, then creates an attribute for the element. Note that the resource can be an absolute URL or a JsonPath that references the response to the parent request. The batch's response is a dictionary uses keys corresponding those provided in the request, with response objects containing a status code, response headers, and the response body. A request can alternatively specify a request template in place of a resource. In this case, a single JsonPath may select multiple tokens, and a separate subrequest will be made from the template for each token. The responses of these subrequests will returned as the content of a single outer response.
143144
*CalculationApi* | [**get_at_intervals**](docs/api/CalculationApi.md#get_at_intervals) | **GET** /calculation/intervals | Returns results of evaluating the expression over the time range from the start time to the end time at a defined interval.
144145
*CalculationApi* | [**get_at_recorded**](docs/api/CalculationApi.md#get_at_recorded) | **GET** /calculation/recorded | Returns the result of evaluating the expression at each point in time over the time range from the start time to the end time where a recorded value exists for a member of the expression.
145146
*CalculationApi* | [**get_summary**](docs/api/CalculationApi.md#get_summary) | **GET** /calculation/summary | Returns the result of evaluating the expression over the time range from the start time to the end time. The time range is first divided into a number of summary intervals. Then the calculation is performed for the specified summaries over each interval.

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,33 @@ The path from the methods above should start with "pi:" (if your stream is a PI
186186
response = client.streamSet.update_values_ad_hoc_with_http_info(streamValues)
187187
```
188188

189+
### PI Web API Batch
190+
191+
```python
192+
req1 = PIRequest()
193+
req2 = PIRequest()
194+
req3 = PIRequest()
195+
req1.method = "GET"
196+
req1.resource = "https://localhost/piwebapi/points?path=\\\\MARC-PI2016\\sinusoid"
197+
req2.method = "GET"
198+
req2.resource = "https://localhost/piwebapi/points?path=\\\\MARC-PI2016\\cdt158"
199+
req3.method = "GET"
200+
req3.resource = "https://localhost/piwebapi/streamsets/value?webid={0}&webid={1}"
201+
req3.parameters = ["$.1.Content.WebId", "$.2.Content.WebId"]
202+
req3.parent_ids = ["1", "2"]
203+
204+
batch = {
205+
"1": req1,
206+
"2": req2,
207+
"3": req3
208+
}
209+
210+
batchResponse = client.batch.execute(batch)
211+
point1 = client.api_client.deserialize_object(batchResponse["1"].content, 'PIPoint')
212+
point2 = client.api_client.deserialize_object(batchResponse["2"].content, 'PIPoint')
213+
itemsStreamValue = client.api_client.deserialize_object(batchResponse["3"].content, 'PIItemsStreamValue')
214+
```
215+
189216

190217
### Get an element and an attribute by path
191218

docs/PIWebApiClient.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PIWebApiClient
22

33
## **Constructor**
4-
> PIWebApiClient(str baseUrl, bool useKerberos = True, str username = None, str password = None, bool verifySsl = True)
4+
> PIWebApiClient(String baseUrl, bool String username, String password, Boolean verifySsl, Boolean debug)
55
66
Creates an instance of the PI Web API client top level object. Currently, only Basic authentication can be used. Do not try to use Kerberos Authentication.
77

@@ -10,10 +10,10 @@ Creates an instance of the PI Web API client top level object. Currently, only B
1010
Name | Type | Description | Notes
1111
------------- | ------------- | ------------- | -------------
1212
**baseUrl** | **str**| PI Web API base service url. | [required]
13-
**useKerberos** | **bool**| Select True for Kerberos auth or False for Basic auth. | [optional]
14-
**username** | **str**| The username for basic authentication to authenticate against PI Web API. | [optional]
15-
**password** | **str**| The password for basic authentication to authenticate against PI Web API. | [optional]
16-
**verifySsl** | **bool**| Verify SSL certificate.| [optional]
13+
**useKerberos** | **bool**| Select True for Kerberos auth or False for Basic auth. | [required]
14+
**username** | **str**| The username for basic authentication to authenticate against PI Web API. | [required]
15+
**password** | **str**| The password for basic authentication to authenticate against PI Web API. | [required]
16+
**verifySsl** | **bool**| Verify SSL certificate.| [required]
1717

1818
## **Properties**
1919

@@ -31,6 +31,7 @@ Property | Controller
3131
**attribute** | [**AttributeApi**](/docs/api/AttributeApi.md)
3232
**attributeTemplate** | [**AttributeTemplateApi**](/docs/api/AttributeTemplateApi.md)
3333
**attributeTrait** | [**AttributeTraitApi**](/docs/api/AttributeTraitApi.md)
34+
**batch** | [**BatchApi**](/docs/api/BatchApi.md)
3435
**calculation** | [**CalculationApi**](/docs/api/CalculationApi.md)
3536
**channel** | [**ChannelApi**](/docs/api/ChannelApi.md)
3637
**data** | [**DataApi**](/docs/api/DataApi.md)

0 commit comments

Comments
 (0)