# Parsing an alarm source path with API function?

**URL:** <https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630>\
**Category:** Ignition\
**Created:** [March 25, 2022, 4:31am UTC](https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630 "2022-03-25T04:31:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 25, 2022, 4:31am UTC](https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630/1 "2022-03-25T04:31:49Z")

</div>

I presume that there’s an API call we can use to parse alarm source paths properly to pull out the provider, tagpath, and alarm name, without resorting to using `split(':')`s and fixed indices which just feels dodgy.  
E.g. parsing this

```auto
almSource = prov:{}:/tag:{}:/alm:{}
almSourceList = almSource.split(':')

prov = almSourceList[1]
tag = almSourceList[3]
alm = almSourceList[5]

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 1, 2023, 11:08pm UTC](https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630/2 "2023-03-01T23:08:06Z")

</div>

_Very_ late (this topic randomly came up in the list of unanswered topics below the fold), but for posterity...  
This `:/` separated syntax is the string representation of a [`QualifiedPath`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.25/com/inductiveautomation/ignition/common/QualifiedPath.html#parse(java.lang.String)). If you want to avoid doing the parsing manually, you can import and call that class yourself.

And the common IDs you reference within a QualifiedPath can be referenced in [`WellKnownPathTypes`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.25/com/inductiveautomation/ignition/common/WellKnownPathTypes.html).

---

<div class="post-metadata">

**Author:** ![Arnaud\_Declerck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/arnaud_declerck/32/44872_2.png) [@Arnaud\_Declerck](https://forum.inductiveautomation.com/u/Arnaud_Declerck)\
**Post date:** [April 20, 2023, 9:43am UTC](https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630/3 "2023-04-20T09:43:26Z")

</div>

> [@nminchin](#):
>
> ```auto
> almSource = prov:{}:/tag:{}:/alm:{}
> almSourceList = almSource.split(':')
> 
> prov = almSourceList[1]
> tag = almSourceList[3]
> alm = almSourceList[5]
> 
> ```

hi @paul-griffith, @nminchin

Would you have some example of this ?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 20, 2023, 11:27am UTC](https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630/4 "2023-04-20T11:27:57Z")

</div>

I think it'd be something like this, but haven't tested yet:

```auto
from com.inductiveautomation.ignition.common import QualifiedPath
qp = "prov:{}:/tag:{}:/alm" 
qp2 = QualifiedPath.parse(qp)
qp2.Tag
qp2.Provider
qp2.Alarm

```

---

<div class="post-metadata">

**Author:** ![Arnaud\_Declerck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/arnaud_declerck/32/44872_2.png) [@Arnaud\_Declerck](https://forum.inductiveautomation.com/u/Arnaud_Declerck)\
**Post date:** [April 20, 2023, 5:47pm UTC](https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630/5 "2023-04-20T17:47:05Z")

</div>

Hi @nminchin,

thanks for the info

regards

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 20, 2023, 6:00pm UTC](https://forum.inductiveautomation.com/t/parsing-an-alarm-source-path-with-api-function/57630/6 "2023-04-20T18:00:50Z")

</div>

Actually, you need slightly different syntax to pull out members:

```python
from com.inductiveautomation.ignition.common import QualifiedPath, WellKnownPathTypes

qp = "prov:{}:/tag:{}:/alm" 
qp2 = QualifiedPath.parse(qp)
tag = qp2.getPathComponent(WellKnownPathTypes.Tag) # or just "tag"
provider = qp2.getPathComponent(WellKnownPathTypes.Provider) # or just "prov""
alarm = qp2.getPathComponent(WellKnownPathTypes.Alarm) # or just "alm"

```
