Skip navigation
All Places > PI Developers Club > Blog > 2018 > January
2018

I am happy to announce that the client libraries below were updated using the new PI Web API swagger specification (2017 R2). All the new methods from PI Web API 2017 R2 are available for you to use on the client side! The X-Requested-With header was also added to work with CSRF defences.

 

 

If you have questions, please don't hesitate to ask!

Web ID 2.0 Specification

 

These tables will help you encode and decode a PI Web API 2.0 Web ID so that you can both compose and deconstruct a Web ID yourself.   Visit How to Optimize your Applications for Web ID 2.0 to learn how the encoding works and how you can use Web ID to optimize your web application with PI Web API.

 

Web ID 2.0 first became available in PI Web API 2017 R2 (1.10 and later).   You can check your installed version by browsing to your PI Web API System endpoint  {yourwebapiserver}/piwebapi/system .

 

AFAnalysis

The Web ID for an AFAnalysis consists of the following data:

Full Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘F’

1

None

Version

‘1’

1

None

Marker

“Xs”

2

None

System ID

analysis.PISystem.ID

22

Urlencoded Guid

Analysis ID

analysis.ID

22

Urlencoded Guid

Name Payload

analysis.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

var

Urlencoded UTF8 String

 

ID Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘I’

1

None

Version

‘1’

1

None

Marker

“Xs”

2

None

System ID

analysis.PISystem.ID

22

Urlencoded Guid

Analysis ID

analysis.ID

22

Urlencoded Guid

 

Path Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘P’

1

None

Version

‘1’

1

None

Marker

“Xs”

2

None

Name Payload

analysis.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

var

Urlencoded UTF8 String

 

Local ID Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘L’

1

None

Version

‘1’

1

None

Marker

“Xs”

2

None

Analysis ID

analysis.ID

22

Urlencoded Guid

 

Default ID Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘D’

1

None

Version

‘1’

1

None

Marker

“Xs”

2

None

Analysis ID

analysis.ID

22

Urlencoded Guid

 

 

AFCategory for Analysis

The Web ID for an AFCategory, whose Identity is CategoryAnalysis, consists of the following data:

Full Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘F’

1

None

Version

‘1’

1

None

Marker

“XC”

2

None

System ID

category.PISystem.ID

22

Urlencoded Guid

Analysis Template

ID

category.ID

22

Urlencoded Guid

Name Payloadcategory.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘I’

1

None

Version

‘1’

1

None

Marker

“XC”

2

None

System ID

category.PISystem.ID

22

Urlencoded Guid

Analysis Template

ID

category.ID

22

Urlencoded Guid

 

Path Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘P’

1

None

Version

‘1’

1

None

Marker

“XC”

2

None

Name Payload

category.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

var

Urlencoded UTF8 String

 

Local ID Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘L’

1

None

Version

‘1’

1

None

Marker

“XC”

2

None

Analysis Template

ID

category.ID

22

Urlencoded Guid

 

Default ID Only Type

Field Name

Value

Encoded Width

Encoding Method

Type

‘D’

1

None

Version

‘1’

1

None

Marker

“XC”

2

None

Analysis Template

ID

category.ID

22

Urlencoded Guid

 

 

AFAnalysisTemplate

The Web ID for an AFAnalysisTemplate consists of the following data:

 

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“XT”2None
System ID

template.PISystem.ID

22Urlencoded Guid
Analysis TemplateID

template.ID

22Urlencoded Guid
Name Payload

template.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“XT”2None
System ID

template.PISystem.ID

22Urlencoded Guid
Analysis TemplateID

template.ID

22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“XT”2None
Name Payload

template.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“XT”2None
Analysis TemplateID

template.ID

22Urlencoded Guid
  1. 5.   Default ID Only Type
Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“XT”2None
Analysis TemplateIDtemplate.ID22Urlencoded Guid

 

AFAnalysisRule

The Web ID for an AFAnalysisRule consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“XR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
System IDanalysisRule.PISystem.ID22Urlencoded Guid
Owner IDanalysisRule.Analysis.ID or analysisRule.AnalysisTemplate.ID22Urlencoded Guid
Analysis Rule IDanalysisRule.ID22Urlencoded Guid
Name PayloadanalysisRule.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“XR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
System IDanalysisRule.PISystem.ID22Urlencoded Guid
Owner IDanalysisRule.Analysis.ID or analysisRule.AnalysisTemplate.ID22Urlencoded Guid
Analysis Rule IDanalysisRule.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“XR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
Name PayloadanalysisRule.GetPath(AFEncodeType.Name,null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“XR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
Owner IDanalysisRule.Analysis.ID oranalysisRule.AnalysisTemplate.ID22Urlencoded Guid
Analysis Rule IDanalysisRule.ID22Urlencoded Guid

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“XR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
Owner IDanalysisRule.Analysis.ID oranalysisRule.AnalysisTemplate.ID22Urlencoded Guid
Analysis Rule IDanalysisRule.ID22Urlencoded Guid

 

AFPlugIn for Analysis Rule

The Web ID for an AFPlugIn, whose Identity is PlugInAnalysisRule, consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“XP”2None
System IDanalysisRulePlugIn.PISystem.ID22Urlencoded Guid
Event Frame IDanalysisRulePlugIn.ID22Urlencoded Guid
Name PayloadanalysisRulePlugIn.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“XP”2None
System IDanalysisRulePlugIn.PISystem.ID22Urlencoded Guid
Event Frame IDanalysisRulePlugIn.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“XP”2None
Name PayloadanalysisRulePlugIn.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“XP”2None
Event Frame IDanalysisRulePlugIn.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“XP”2None
Event Frame IDanalysisRulePlugIn.ID22Urlencoded Guid

 

AFAttribute

The Web ID for an AFAttribute consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“Ab”2None
Base ElementMarker‘E’ if attr.Element is AFElement‘F’ if attr.Element is AFEventFrame‘N’ if attr.Element is AFNotification1None
System IDattr.PISystem.ID22Urlencoded Guid
Element IDattr.Element.ID22Urlencoded Guid
Attribute IDattr.ID22Urlencoded Guid
Name Payloadattr.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“Ab”2None
Base ElementMarker‘E’ if attr.Element is AFElement‘F’ if attr.Element is AFEventFrame‘N’ if attr.Element is AFNotification1None
System IDattr.PISystem.ID22Urlencoded Guid
Element IDattr.Element.ID22Urlencoded Guid
Attribute IDattr.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“Ab”2None
Base ElementMarker‘E’ if attr.Element is AFElement‘F’ if attr.Element is AFEventFrame‘N’ if attr.Element is AFNotification1None
Name Payloadattr.GetPath(AFEncodeType.Name,null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“Ab”2None
Base ElementMarker‘E’ if attr.Element is AFElement‘F’ if attr.Element is AFEventFrame‘N’ if attr.Element is AFNotification1None
Element IDattr.Element.ID22Urlencoded Guid
Attribute IDattr.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“Ab”2None
Base ElementMarker‘E’ if attr.Element is AFElement‘F’ if attr.Element is AFEventFrame‘N’ if attr.Element is AFNotification1None
Element IDattr.Element.ID22Urlencoded Guid
Attribute IDattr.ID22Urlencoded Guid

 

AFCategory for Attribute

The Web ID for an AFCategory, whose Identity is CategoryAttribute, consists of the following data: 

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“AC”2None
System IDcategory.PISystem.ID22Urlencoded Guid
Category IDcategory.ID22Urlencoded Guid
Name Payloadcategory.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“AC”2None
System IDcategory.PISystem.ID22Urlencoded Guid
Category IDcategory.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“AC”2None
Name Payloadcategory.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“AC”2None
Category IDcategory.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“AC”2None
Category IDcategory.ID22Urlencoded Guid

 

AFAttributeTemplate

The Web ID for an AFAttributeTemplate consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“AT”2None
ElementTemplate Marker‘E’Preserved here for legacy purposes1None
System IDattrTempl.PISystem.ID22Urlencoded Guid
ElementTemplate IDattrTempl.ElementTemplate.ID22Urlencoded Guid
AttributeTemplate IDattrTempl.ID22Urlencoded Guid
Name PayloadattrTempl.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“AT”2None
ElementTemplate Marker‘E’Preserved here for legacy purposes1None
System IDattrTempl.PISystem.ID22Urlencoded Guid
ElementTemplate IDattrTempl.ElementTemplate.ID22Urlencoded Guid
AttributeTemplate IDattrTempl.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“AT”2None
ElementTemplate Marker‘E’Preserved here for legacy purposes1None
Name Payload

attrTempl.GetPath(AFEncodeType.Name,null)

.Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“AT”2None
ElementTemplate Marker‘E’Preserved here for legacy purposes1None
ElementTemplate IDattrTempl.ElementTemplate.ID22Urlencoded Guid
AttributeTemplate IDattrTempl.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“AT”2None
ElementTemplate Marker‘E’Preserved here for legacy purposes1None
ElementTemplate IDattrTempl.ElementTemplate.ID22Urlencoded Guid
AttributeTemplate IDattrTempl.ID22Urlencoded Guid

 

AFDatabase

The Web ID for an AFDatabase consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“RD”2None
System IDdatabase.PISystem.ID22Urlencoded Guid
Database IDdatabase.ID22Urlencoded Guid
Name Payloaddatabase.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“RD”2None
System IDdatabase.PISystem.ID22Urlencoded Guid
Database IDdatabase.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“RD”2None
Name Payloaddatabase.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“RD”2None
Database IDdatabase.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“RD”2None
Database IDdatabase.ID22Urlencoded Guid

 
AFElement

The Web ID for an AFElement consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“Em”2None
System IDelement.PISystem.ID22Urlencoded Guid
Element IDelement.ID22Urlencoded Guid
Name Payloadelement.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“Em”2None
System IDelement.PISystem.ID22Urlencoded Guid
Element IDelement.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“Em”2None
Name Payloadelement.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“Em”2None
Element IDelement.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“Em”2None
Element IDelement.ID22Urlencoded Guid

 

AFCategory for Element

The Web ID for an AFCategory, whose Identity is CategoryElement, consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“EC”2None
System IDcategory.PISystem.ID22Urlencoded Guid
Category IDcategory.ID22Urlencoded Guid
Name Payloadcategory.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“EC”2None
System IDcategory.PISystem.ID22Urlencoded Guid
Category IDcategory.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“EC”2None
Name Payloadcategory.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“EC”2None
Category IDcategory.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“EC”2None
Category IDcategory.ID22Urlencoded Guid

 

AFElementTemplate

The Web ID for an AFElementTemplate consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“ET”2None
System IDtemplate.PISystem.ID22Urlencoded Guid
ElementTemplate IDtemplate.ID22Urlencoded Guid
Name Payloadtemplate.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 
   ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“ET”2None
System IDtemplate.PISystem.ID22Urlencoded Guid
ElementTemplate IDtemplate.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“ET”2None
Name Payloadtemplate.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“ET”2None
ElementTemplate IDtemplate.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“ET”2None
ElementTemplate IDtemplate.ID22Urlencoded Guid

 

AFEnumerationSet

The Web ID for an AFEnumerationSet consists of the following data:

Full Type

Field NameValueEncodedWidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“MS”2None
Source Marker‘R’ if enumerationSet.PISystem != null‘D’ if enumerationSet.PIServer != null1None
Server IDenumerationSet.PISystem.ID (if AF)enumerationSet.PIServer.ID (if PI)22Urlencoded Guid
EnumerationSet IDenumerationSet.ID22Urlencoded Guid
Name PayloadenumerationSet.GetPath(AFEncodeType.Name,null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

 

ID Only Type

Field NameValueEncodedWidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“MS”2None
Source Marker‘R’ if enumerationSet.PISystem != null‘D’ if enumerationSet.PIServer != null1None
Server IDenumerationSet.PISystem.ID (if AF)enumerationSet.PIServer.ID (if PI)22Urlencoded Guid
EnumerationSet IDenumerationSet.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncodedWidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“MS”2None
Source Marker‘R’ if enumerationSet.PISystem != null‘D’ if enumerationSet.PIServer != null1None
Name PayloadenumerationSet.GetPath(AFEncodeType.Name,null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

 

Local ID Only Type

Field NameValueEncodedWidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“MS”2None
Source Marker‘R’ if enumerationSet.PISystem != null‘D’ if enumerationSet.PIServer != null1None
EnumerationSet IDenumerationSet.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncodedWidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“MS”2None
Source Marker‘R’ if enumerationSet.PISystem != null‘D’ if enumerationSet.PIServer != null1None
EnumerationSet ID
  1. enumerationSet.ID
22Urlencoded Guid

 

 

AFEnumerationValue

The Web ID for an AFEnumerationValue consists of the following data: 
Full Type

Field NameValueEncodedWidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“MV”2None
Source Marker‘R’ if val.EnumerationSet.PISystem != null‘D’ if val.EnumerationSet.PIServer != null1None
Server IDval.EnumerationSet.PISystem.ID (if AF)val.EnumerationSet.PIServer.ID (if PI)22Urlencoded Guid
EnumerationSet IDval.EnumerationSet.ID22Urlencoded Guid
EnumerationValue IDval.ID22Urlencoded Guid
Name Payload(val.EnumerationSet.GetPath(AFEncodeType.Name, null).Substring(2) + '\\' + val.Name) .ToUpperInvariant()varUrlencoded UTF8String

 

ID Only Type

Field NameValueEncodedWidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“MV”2None
Source Marker‘R’ if val.EnumerationSet.PISystem != null‘D’ if val.EnumerationSet.PIServer != null1None
Server IDval.EnumerationSet.PISystem.ID (if AF)val.EnumerationSet.PIServer.ID (if PI)22Urlencoded Guid
EnumerationSet IDval.EnumerationSet.ID22Urlencoded Guid
EnumerationValue IDval.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncodedWidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“MV”2None
Source Marker‘R’ if val.EnumerationSet.PISystem != null‘D’ if val.EnumerationSet.PIServer != null1None
Name Payload

(val.EnumerationSet.GetPath(AFEncodeType.Name,null)

.Substring(2) + '\\' + val.Name) .ToUpperInvariant()

varUrlencoded UTF8String

 

Local ID Only Type

Field NameValueEncodedWidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“MV”2None
Source Marker‘R’ if val.EnumerationSet.PISystem != null‘D’ if val.EnumerationSet.PIServer != null1None
EnumerationSet IDval.EnumerationSet.ID22Urlencoded Guid
EnumerationValue IDval.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncodedWidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“MV”2None
Source Marker‘R’ if val.EnumerationSet.PISystem != null‘D’ if val.EnumerationSet.PIServer != null1None
EnumerationSet IDval.EnumerationSet.ID22Urlencoded Guid
EnumerationValue IDval.ID22Urlencoded Guid

 

 

AFEventFrame

The Web ID for an AFEventFrame consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“Fm”2None
System IDeventFrame.PISystem.ID22Urlencoded Guid
Event Frame IDeventFrame.ID22Urlencoded Guid
Name PayloadeventFrame.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“Fm”2None
System IDeventFrame.PISystem.ID22Urlencoded Guid
Event Frame IDeventFrame.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“Fm”2None
Name PayloadeventFrame.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“Fm”2None
Event Frame IDeventFrame.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“Fm”2None
Event Frame IDeventFrame.ID22Urlencoded Guid

 

 

AFNotification

The Web ID for an AFNotification consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“Nf”2None
System IDnotification.PISystem.ID22Urlencoded Guid
Element IDnotification.ID22Urlencoded Guid
Name Payloadnotification.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“Nf”2None
System IDnotification.PISystem.ID22Urlencoded Guid
Element IDnotification.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“Nf”2None
Name Payloadnotification.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“Nf”2None
Element IDnotification.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“Nf”2None
Element IDnotification.ID22Urlencoded Guid

 

 

AFNotificationTemplate

The Web ID for an AFNotificationTemplate consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“NT”2None
System IDtemplate.PISystem.ID22Urlencoded Guid
ElementTemplate IDtemplate.ID22Urlencoded Guid
Name Payloadtemplate.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“NT”2None
System IDtemplate.PISystem.ID22Urlencoded Guid
ElementTemplate IDtemplate.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“NT”2None
Name Payloadtemplate.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“NT”2None
ElementTemplate IDtemplate.ID22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“NT”2None
ElementTemplate IDtemplate.ID22Urlencoded Guid

 
AFTimeRule

The Web ID for an AFTimeRule consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“TR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
System IDtimeRule.PISystem.ID22Urlencoded Guid
Owner IDtimeRule.Analysis.ID or timeRule.AnalysisTemplate.ID22Urlencoded Guid
Time Rule IDtimeRule.ID22Urlencoded Guid
Name PayloadtimeRule.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“TR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
System IDtimeRule.PISystem.ID22Urlencoded Guid
Owner IDtimeRule.Analysis.ID or timeRule.AnalysisTemplate.ID22Urlencoded Guid
Time Rule IDtimeRule.ID22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“TR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
Name Payload

timeRule.GetPath(AFEncodeType.Name,null)

.Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“TR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
Owner IDtimeRule.Analysis.ID ortimeRule.AnalysisTemplate.ID22Urlencoded Guid
Time Rule IDtimeRule.ID22Urlencoded Guid

    

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“TR”2None
Owner Marker‘X’ if rule’s owner is AFAnalysis‘T’ if rule’s owner is AFAnalysisTemplate1None
Owner IDtimeRule.Analysis.ID ortimeRule.AnalysisTemplate.ID22Urlencoded Guid
Time Rule IDtimeRule.ID22Urlencoded Guid

 

 

AFPlugIn for Time Rule

The Web ID for an AFPlugIn, whose Identity is PlugInTimeRule, consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“TP”2None
System IDtimeRulePlugIn.PISystem.ID22Urlencoded Guid
Event Frame IDtimeRulePlugIn.ID22Urlencoded Guid
Name PayloadtimeRulePlugIn.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“TP”2None
System IDtimeRulePlugIn.PISystem.ID22Urlencoded Guid
Event Frame IDtimeRulePlugIn.ID22Urlencoded Guid

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“TP”2None
Name PayloadtimeRulePlugIn.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“TP”2None
Event Frame IDtimeRulePlugIn.ID22Urlencoded Guid

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“TP”2None
Event Frame IDtimeRulePlugIn.ID22Urlencoded Guid

 

 

AFSecurityIdentity

The Web ID for an AFSecurityIdentity consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“SI”2None
System IDsecurityIdentity.PISystem.ID22Urlencoded Guid
Security IdentityIDsecurityIdentity.ID22Urlencoded Guid
Name PayloadsecurityIdentity.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“SI”2None
System IDsecurityIdentity.PISystem.ID22Urlencoded Guid
Security IdentityIDsecurityIdentity.ID22Urlencoded Guid

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“SI”2None
Name PayloadsecurityIdentity.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“SI”2None
Security IdentityIDsecurityIdentity.ID22Urlencoded Guid

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“SI”2None
Security IdentityIDsecurityIdentity.ID22Urlencoded Guid

 

 

AFSecurityMapping

The Web ID for an AFSecurityMapping consists of the following data.

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“SM”2None
System IDsecurityMapping.PISystem.ID22Urlencoded Guid
SecurityMapping IDsecurityMapping.ID22Urlencoded Guid
Name PayloadsecurityMapping.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“SM”2None
System IDsecurityMapping.PISystem.ID22Urlencoded Guid
SecurityMapping IDsecurityMapping.ID22Urlencoded Guid

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“SM”2None
Name PayloadsecurityMapping.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8String

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“SM”2None
SecurityMapping IDsecurityMapping.ID22Urlencoded Guid

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“SM”2None
SecurityMapping IDsecurityMapping.ID22Urlencoded Guid

 
AFTable

The Web ID for an AFTable consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“Bl”2None
System IDtable.PISystem.ID22Urlencoded Guid
Table IDtable.ID22Urlencoded Guid
Name Payloadtable.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 Strin

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“Bl”2None
System IDtable.PISystem.ID22Urlencoded Guid
Table ID

table.ID

22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“Bl”2None
Name Payload

table.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“Bl”2None
Table ID

table.ID

22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“Bl”2None
Table ID

table.ID

22Urlencoded Guid

 

 

AFCategory for Table

The Web ID for an AFCategory, whose Identity is CategoryTable, consists of the following data:

 

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“BC”2None
System ID

category.PISystem.ID

22Urlencoded Guid
Category ID

category.ID

22Urlencoded Guid
Name Payload

category.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“BC”2None
System ID

category.PISystem.ID

22Urlencoded Guid
Category ID

category.ID

22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“BC”2None
Name Payload

category.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“BC”2None
Category ID

category.ID

22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“BC”2None
Category ID

category.ID

22Urlencoded Guid

 

 

PIPoint

The Web ID for a PI Point consists of the following data:

 

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“DP”2None
Server ID

point.Server.ID

22Urlencoded Guid
Point ID

point.ID

6Urlencoded Int32
Name Payload

point.GetPath().Substring(2)

.ToUpperInvariant()
varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“DP”2None
Server ID

point.Server.ID

22Urlencoded Guid
Point ID

point.ID

6Urlencoded Int32

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“DP”2None
Name Payload

point.GetPath().Substring(2)

.ToUpperInvariant()
varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“DP”2None
Point ID

point.ID

6Urlencoded Int32

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“DP”2None
Point ID

point.ID

6Urlencoded Int32

 

 

PIServer

The Web ID for a PI Server consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“DS”2None
Server ID

server.ID

22Urlencoded Guid
Server Name

server.Name.ToUpperInvariant()

varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“DS”2None
Server ID

server.ID

22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“DS”2None
Server Name

server.Name.ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“DS”2None

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“DS”2None

 

 

PISystem

The Web ID for a PISystem consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“RS”2None
System ID

piSystem.ID

22Urlencoded Guid
Name Payload

piSystem.GetPath(AFEncodeType.Name,

null).Substring(2).ToUpperInvariant()
varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“RS”2None
System ID

piSystem.ID

22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“RS”2None
Name Payload

piSystem.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“RS”2None

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“RS”2None

 

 

UOM

The Web ID for a UOM consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“Ut”2None
System ID

uom.PISystem.ID

22Urlencoded Guid
UOM ID

uom.ID

22Urlencoded Guid
Name Payload

uom.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“Ut”2None
System ID

uom.PISystem.ID

22Urlencoded Guid
UOM ID

uom.ID

22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“Ut”2None
Name Payload

uom.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“Ut”2None
UOM ID

uom.ID

22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“Ut”2None
UOM ID

uom.ID

22Urlencoded Guid

 
UOMClass

The Web ID for a UOMClass consists of the following data:

Full Type

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker“UC”2None
System ID

uomClass.PISystem.ID

22Urlencoded Guid
UOM ID

uomClass.ID

22Urlencoded Guid
Name Payload

uomClass.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘I’1None
Version‘1’1None
Marker“UC”2None
System ID

uomClass.PISystem.ID

22Urlencoded Guid
UOM ID

uomClass.ID

22Urlencoded Guid

 

Path Only Type

Field NameValueEncoded WidthEncoding Method
Type‘P’1None
Version‘1’1None
Marker“UC”2None
Name Payload

uomClass.GetPath(AFEncodeType.Name, null).Substring(2).ToUpperInvariant()

varUrlencoded UTF8 String

 

Local ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘L’1None
Version‘1’1None
Marker“UC”2None
UOM ID

uomClass.ID

22Urlencoded Guid

 

Default ID Only Type

Field NameValueEncoded WidthEncoding Method
Type‘D’1None
Version‘1’1None
Marker“UC”2None
UOM ID

uomClass.ID

22

Urlencoded Guid

(If you're looking for the PI object encodings spec, visit this post)

 

Supported Versions

Web ID 2.0 first became available in PI Web API 2017 R2 (1.10 and later).   You can check your installed version by browsing to your PI Web API System endpoint  {yourwebapiserver}/piwebapi/system .

Video: Everything you wanted to know about WebID 2.0

 

What is Web ID?

Web ID is a fail-safe mechanism for retrieving artifcats from PI and AF servers while remaining safe for use in URLs. WebID URLs are resilient to changes of an object’s name or ID, which means you can store them and use them in your apps.

 

PI Web API uses Web ID as the main access mechanism to explore the objects in the PI system landscape.

 

If you already know the structure of your AF hierarchy, you can compose Web ID addresses yourself, sparing you the expense of consulting the query and search endpoints in PI Web API to determine what those Web IDs are.

 

How can I use Web ID to enhance my application?

With Web ID you can build direct links to storage areas in the PI System and cache those in your own application.   This is helpful for scenarios where you have a large number of objects to trade with PI Web API and you already know how the objects are modeled in the PI System.   They are also critical to efficient operations such as Batch requests where you need to perform a large amount of operations at once.

 

With Web ID you can also save on network bandwidth and transfer rates by composing shorter Web IDs where necessary, if server contexts aren’t expressly needed.

 

The Basics - How a Web ID is composed

A Web ID is a smart code that is comprised of several compound strings. The first four characters of a WebID determine how the remainder of the string is comprised and what object is being referenced.

 

Diagram of how a Web ID is composed

 

In the example here, a full version of a Web ID is being used to encode the ID of an AF Element.

 

The components of the Web ID in this instance are:

AF Element (Web ID Type: Full)

 

Field NameValueEncoded WidthEncoding Method
Type‘F’1None
Version‘1’1None
Marker‘Em’2None
System IDelement.PISystem.ID22Urlencoded Guid
Element IDelement.ID22Urlencoded Guid
Name Payloadelement.GetPath(AFEncodeType. Name, null).Substring(2).ToUpperInvariant()varUrlencoded UTF8 String

(Visit here for the full listing of supported object types and their encodings)

 

Web ID Types

The following Web ID types can be used to reduce the length of ID that you use to cache. You can request WebID types by adding ?webIDType={type} to any URL request in PI Web API, or posting any type of Web ID you wish to the PI Web API server. PI Web API will automatically figure out what type of Web ID you sent based on the formatting markers inside the ID.

 

Here are some examples:

Web ID TypeSampleElements Omitted
Full (default)F1EmDqD5loBNH0erqeqJodtALAh_fRZ2eH5xGWZgAVXQKgBgUkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx
?webIDType=IDOnlyI1EmDqD5loBNH0erqeqJodtALAh_fRZ2eH5xGWZgAVXQKgBgPath
?webIDType=PathOnlyP1EmUkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQxServer ID, Object ID
?webIDType=LocalIDOnlyL1Emh_fRZ2eH5xGWZgAVXQKgBgServer ID, Path
?webIDType=DefaultIDOnlyD1Emh_fRZ2eH5xGWZgAVXQKgBgServer ID, Path

Let’s decompose in code

The following code sample demonstrates how a full Web ID is parsed.

Example C# - Decomposing Web ID values

  using System;
  using System.Text;

  class WebIDExample
  {

  internal static string Encode(byte[] value)
  {
 string encoded = System.Convert.ToBase64String(value);
 return encoded.TrimEnd(new char[] { '=' }).Replace('+', '-').Replace('/', '_');
  }

  internal static string Encode(Guid value)
  {
 byte[] bytes = value.ToByteArray();
 return Encode(bytes);
  }

  internal static byte[] Decode(string value)
  {
 //Base 64 strings are in multiples of 4 bytes long.
 //This restores the = sign padding and changes the Uri-safe chars with the Base64 requirement
 StringBuilder decodestring = new StringBuilder(value.Replace('-','+').Replace('_','/'));
 int padneeded = value.Length % 4;
 for (int i = 0; i < padneeded; i++)
 {
 decodestring.Append('=');
 }

 byte[] bytes = System.Convert.FromBase64String(decodestring.ToString());
 return bytes;
  }

  internal static string DecodeString(string value)
  {
 return Encoding.UTF8.GetString(Decode(value));
  }

  internal static Guid DecodeGUID(string value)
  {
 byte[] guid = Decode(value);
 return new Guid(guid);
  }

  public static void Main()
  {

 // Given a Web ID of F1EmDqD5loBNH0erqeqJodtALAh_fRZ2eH5xGWZgAVXQKgBgUkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx,
 // let's decode the component parts.

 // F Full 1 Version Em AF Element RXhhbXBsZVN0cmluZw== Server
 // ID (GUID), string must be padded to decode
 // h/fRZ2eH5xGWZgAVXQKgBg== AF Object ID (GUID), change the _
 // to a / before decoding UkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx
 // Name (RESTUNIT\SAWYER\ELEMENT1)

 // Note: The decoded GUIDs are returned as a series of UTF8 bytechars, which are then
 // convertible into a GUID by printing the hex value of each byte.

 // Encode/decode basic string parts used in WebID
 Console.WriteLine("The F value of the WebID = Full");
 Console.WriteLine($"The value of RXhhbXBsZVN0cmluZw is {DecodeString("RXhhbXBsZVN0cmluZw")}");
 Console.WriteLine($"The value of DqD5loBNH0erqeqJodtALA is {DecodeGUID("DqD5loBNH0erqeqJodtALA").ToString()}");
 Console.WriteLine($"The value of h_fRZ2eH5xGWZgAVXQKgBg is {DecodeGUID("h_fRZ2eH5xGWZgAVXQKgBg").ToString()}");
 Console.WriteLine($"The value of UkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx is {DecodeString("UkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx").ToString()}");

  }

  }

 

Example JS - Decomposing Web ID values

//var btoa = require('btoa');
//var atob = require('atob');

function DecodeString(strDecode) {
  var decodestring = strDecode.replace('-', '+').replace('_', '/');
  var padneeded = decodestring.length % 4;
  for (var i = 0; i < padneeded; i++) {
  decodestring += '=';
  }

  return (atob(decodestring)).toString('utf8');;
}

function Base64ToArrayBuffer(base64) {
  var binary_string = atob(base64);
  var len = binary_string.length;
  var bytes = new Uint8Array(len);
  for (var i = 0; i < len; i++) {
  bytes[i] = binary_string.charCodeAt(i);
  }
  return bytes.buffer;
}

function DecodeGUID(strDecode) {
  var bytes = Base64ToArrayBuffer(strDecode);
  var uncodedbytes = new Uint8Array(bytes);

  var guidstr = "";

  for (var i = 3; i >= 0; i--) {
  if (uncodedbytes[i] < 17) {
  guidstr += "0" + uncodedbytes[i].toString(16);
  } else {
  guidstr += uncodedbytes[i].toString(16);
  }
  }
  guidstr += "-";
  if (uncodedbytes[5] < 17) {
  guidstr += "0" + uncodedbytes[5].toString(16);
  } else {
  guidstr += uncodedbytes[5].toString(16);
  }
  if (uncodedbytes[4] < 17) {
  guidstr += "0" + uncodedbytes[4].toString(16);
  } else {
  guidstr += uncodedbytes[4].toString(16);
  }
  guidstr += "-";
  if (uncodedbytes[7] < 17) {
  guidstr += "0" + uncodedbytes[7].toString(16);
  } else {
  guidstr += uncodedbytes[7].toString(16);
  }
  if (uncodedbytes[6] < 17) {
  guidstr += "0" + uncodedbytes[6].toString(16);
  } else {
  guidstr += uncodedbytes[6].toString(16);
  }
  guidstr += "-";
  if (uncodedbytes[8] < 17) {
  guidstr += "0" + uncodedbytes[8].toString(16);
  } else {
  guidstr += uncodedbytes[8].toString(16);
  }
  if (uncodedbytes[9] < 17) {
  guidstr += "0" + uncodedbytes[9].toString(16);
  } else {
  guidstr += uncodedbytes[9].toString(16);
  }
  guidstr += "-";
  for (i = 10; i < 16; i++) {
  if (uncodedbytes[i] < 17) {
  guidstr += "0" + uncodedbytes[i].toString(16);
  } else {
  guidstr += uncodedbytes[i].toString(16);
  }
  }

  return guidstr;
}


function ParseExample() {
  console.log("Taking the Full Web ID of " +
  "F1EmDqD5loBNH0erqeqJodtALAh_fRZ2eH5xGWZgAVXQKgBgUkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx\n");
  console.log("Let's break this into its constituent parts: ");
  console.log("F1 Full Web ID, Version 1");
  console.log("Em This is an AF Element");
  console.log("DqD5loBNH0erqeqJodtALA -> " + DecodeGUID("DqD5loBNH0erqeqJodtALA") + " Server ID");
  console.log("h_fRZ2eH5xGWZgAVXQKgBg -> " + DecodeGUID("h_fRZ2eH5xGWZgAVXQKgBg") + " AF Object ID");
  console.log("UkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx -> " + DecodeString("UkVTVFVOSVRcU0FXWUVSXEVMRU1FTlQx"));
}


ParseExample();

 

How the encoding works

 

Encoded fields are constructed mostly in two ways:

Encoded Strings (Base64)

UTF-8 strings designating names are encoded in Base64 . However, they do not include the padding characters required to decode them. This means you will need to follow this pattern:

  • Determine length of string
  • If the modulo of the string’s length is not evenly divisible by 4, then pad the string with equal signs ‘=’ until it is evenly divisible by four.
  • Once decoded into a binary array, convert the binary array to UTF-8 characters.

 

Encoded GUID/UUID (Base64)

How a GUID is composed

Universally Unique Identifiers (UUIDs) are 128-bit numbers that are used to uniquely identify any type of object as well as guarantee with an extremely high level of probability that randomly-generated numbers will not collide.

 

Web ID contains unqiue object identifiers that point to servers and resources in PI Asset Framework. Usually this will be a Server ID that identifies the AF Server where an Asset Framework object is based then GUID/UUID of an AF object itself; like an element, attribute, batch frame or template, etc.

 

Note about byte order - PI Web API uses Microsoft-formatted GUID numbers. Because they are expressed in Base64 strings, they will be 22 characters in length. In other environments such as Javascript or Java, UUIDs may be expressed with different byte orders.

 

Given a GUID expressed as DqD5loBNH0erqeqJodtALA, you must expand this string to DqD5loBNH0erqeqJodtALA== so that it is 24 characters long. Converting the individual bytes to hexadecimal notation and placing the bytes in the correct order should yield 96f9a00e-4d80-471f-aba9-ea89a1db402c as the server GUID.

 

 

 

 

For the full listing of supported PI object types and their Web ID encodings, visit here.

ray

Next Generation PI SQL Processing

Posted by ray Employee Jan 10, 2018

We have been working on a new SQL query processing engine we call the Real-Time Query Processor (RTQP). The RTQP Engine has several important goals. First and foremost, we plan to improve performance and scalability of your SQL queries. We understand that some queries involving large PI System databases and large amounts of time series data could be improved. Secondly, we are taking the opportunity to simplify the design of the tables that support SQL queries. Our goal is to simplify our design so that fewer table joins are required to perform your most common tasks.

 

The OSIsoft PI SQL Team is proud to announce the availability of the second Community Technology (CTP2) release of the Real-Time Query Processor (RTQP)! There was a CTP1 which was shared with a few early adopters; we thank them for their feedback. To install CTP2, you need a new OLEDB provider called PI SQL Client OLEDB. This provider communicates with the PI SQL Data Access Server (RTQP Engine) which performs the SQL query processing. You can download the PI SQL Client OLEDB, documentation and release notes from the Technical Support Download Center. The required PI SQL Data Access Server (RTQP Engine) is an optional component in the PI AF Services 2017 R2 install kit.

 

Our new table designs are not compatible with PI OLEDB Enterprise. We hope you will be motivated to migrate but we will continue to support PI OLEDB Enterprise and PI OLEDB Provider indefinitely so we don’t break your working configurations. They can be installed in parallel.

 

We welcome feedback! Please contact us at BetaOLEDB@osisoft.com instead of calling Technical Support. Or, you can post comments here.

Filter Blog

By date: By tag: