# Kyvis Labs API Client Module

**URL:** <https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120>\
**Category:** 3rd Party Modules\
**Created:** [January 28, 2023, 1:14am UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120 "2023-01-28T01:14:50Z")\
**Posts on this page:** 16\
**Page:** 3

<div class="post-metadata">

**Author:** ![zach\_carroll](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zach\_carroll](https://forum.inductiveautomation.com/u/zach_carroll)\
**Post date:** [June 18, 2024, 10:44pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/42 "2024-06-18T22:44:28Z")

</div>

Good afternoon. Love the module and using it often. I am running into an error with the body of a POST request function wherein the API I am interacting with (distech) requires the body to be a ‘jsonArray’ and no matter how I format the body, it’s being sent as a ‘json Object’.

The format is something like this:

```python
Body: |
  [
    {
      key: value,
      key: value,
      key: value
    },
    {
      key: value,
      key: value,
      key: value
    },
    {
      key: value,
      key: value,
      key: value
    }
  ]

```

If I submit like above, the exception comes from the module saying json strings must begin with ‘{‘

Thank you! 🙏

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 18, 2024, 10:52pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/43 "2024-06-18T22:52:04Z")

</div>

Your body isn't valid JSON as your array (the value) needs to be assigned to a key. I don't know what they're expecting, so could be something like this:

```python
{
  key: [
    {
      key: value,
      key: value,
      key: value
    },
    {
      key: value,
      key: value,
      key: value
    },
    {
      key: value,
      key: value,
      key: value
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![zach\_carroll](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zach\_carroll](https://forum.inductiveautomation.com/u/zach_carroll)\
**Post date:** [June 18, 2024, 10:54pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/44 "2024-06-18T22:54:06Z")

</div>

That would then be a ‘json object’ though, and it needs to be a ‘json array’

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 18, 2024, 11:07pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/45 "2024-06-18T23:07:32Z")

</div>

Oh, I think I see what you're saying....they want it to be formatted without the external object and pass just the array.

Would something like this work assuming your json object is named jsonObj:

```python
jsonArr = jsonObj['key']

```

I haven't used the module, but didn't know if you could just pass a variable as the body.  
Otherwise, your body looks like it would be OK in terms of how it's formatted.

It's possible the module itself is expecting it to begin with curly braces as a validation check. (Have you tried just tacking on the front/back opening/closing curly braces to see if it will take it?

---

<div class="post-metadata">

**Author:** ![zach\_carroll](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zach\_carroll](https://forum.inductiveautomation.com/u/zach_carroll)\
**Post date:** [June 19, 2024, 12:18am UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/46 "2024-06-19T00:18:11Z")

</div>

I have. The configuration is written in YAML. I’ve tried several combinations and anything formatted as a class json Object returns an error from the targeted API which says essentially “json object could not be formatted as json array”. So I assume it’s something to do with the module and was hoping a fix might be a simple matter. Fingers crossed.

As I’m writing this it’s occurred to me that I haven’t tried submitting it in a YAML sequence, which might allow coercion into a json array… something like

```python
Body:
  - key0:value
    key1:value
    key2:value
  - key0:value
    key1:value
    key2:value

```

Again, fingers crossed haha. Will try tmm

Update: (next morning)  
No dice. If there is a quick edit that can allow json Arrays to be passed into a body of a request, that is without the required '{', that would be incredible!

---

<div class="post-metadata">

**Author:** ![zach\_carroll](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zach\_carroll](https://forum.inductiveautomation.com/u/zach_carroll)\
**Post date:** [June 19, 2024, 7:19pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/47 "2024-06-19T19:19:25Z")

</div>

So my java is not amazing so don't judge haha, but i can confirm that editing Body.java located here:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f298962e7dfebb3320724e732b8b096a54d93b9b.png)

like so  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/730faa24567eac4e9924aad455853d4cd1416ff2.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/0/506207946afbaff1ef0e0f128171760e771dc113.png)

and rebuilding the module unsigned did indeed solve the problem. I expected some other dependencies to cause issues but this worked beautifully.

---

<div class="post-metadata">

**Author:** ![Yousef\_Ali](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@Yousef\_Ali](https://forum.inductiveautomation.com/u/Yousef_Ali)\
**Post date:** [February 6, 2025, 2:31pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/48 "2025-02-06T14:31:17Z")

</div>

i have this API to send notification through httpsclient (Post) . Api code created as a function and execute it through tag change script and working fine ..

i am trying to create Yaml field to be used through api client module and always failed ..

Any guidance to convert this to Yaml as reference . Thanks

```python
def msTeams(val,value2):
    import system
   
    url = "https://outlook.office.com/webhook/" \
           "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx@xxxxxx-xxx-xxx-xxx-xxxxx/" \
           "IncomingWebhook/xxxxxxxxxxxxxxxx/" \
           "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
    contentType = "application/json"
   
    brutData = {
        "@type": "MessageCard",
        "@context": "http://schema.org/extensions",
        "themeColor": "0076D7",
        "summary": "Ignition Notification Message",
        "sections": [{
                    "activityTitle": "Ignition Notification Message",
                    "activitySubtitle": "Ignition Web Service",
                    "activityImage": "https://avatars0.githubusercontent.com/u/26392698?s=400&v=4",
                    "facts": [{
                        "name": "Message",
                        "value": val},
                        {
                        "name": "Message",
                        "value": value2},
                       
                        {"name": "Date",
                        "value": system.date.now()
                        }
                    ],
                    
                    
                
            
	postData = system.util.jsonEncode(brutData)
    result = system.net.httpPost(url, contentType, postData)
    logger.info("Teams Webhook Response: " + str(result))
    return result
    

system.tag.readBlocking("myTagPaths")[0].value

msTeam {vale,value2)

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [April 7, 2025, 6:22pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/49 "2025-04-07T18:22:53Z")

</div>

I'm trying to setup my yaml, but I keep getting this error message in the logs. Anyone know what it means? I know the session\_token I am using is good.

```python
net.dongliu.requests.exception.RequestsException: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
at net.dongliu.requests.utils.SSLSocketFactories._getCustomSSLSocketFactory(SSLSocketFactories.java:53)
at net.dongliu.requests.utils.SSLSocketFactories.getCustomTrustSSLSocketFactory(SSLSocketFactories.java:61)
at net.dongliu.requests.executor.URLConnectionExecutor.doRequest(URLConnectionExecutor.java:127)
at net.dongliu.requests.executor.URLConnectionExecutor.proceed(URLConnectionExecutor.java:46)
at net.dongliu.requests.InterceptorChain.proceed(InterceptorChain.java:22)
at net.dongliu.requests.RequestBuilder.send(RequestBuilder.java:409)
at com.kyvislabs.api.client.gateway.api.functions.FunctionExecutor._execute(FunctionExecutor.java:68)
at com.kyvislabs.api.client.gateway.api.functions.FunctionExecutor.execute(FunctionExecutor.java:183)
at com.kyvislabs.api.client.gateway.api.functions.FunctionExecutor.run(FunctionExecutor.java:209)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
at java.base/sun.security.pkcs12.PKCS12KeyStore.engineGetKey(Unknown Source)
at java.base/sun.security.util.KeyStoreDelegator.engineGetKey(Unknown Source)
at java.base/java.security.KeyStore.getKey(Unknown Source)
at java.base/sun.security.ssl.SunX509KeyManagerImpl.(Unknown Source)
at java.base/sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(Unknown Source)
at java.base/javax.net.ssl.KeyManagerFactory.init(Unknown Source)
at net.dongliu.requests.utils.SSLSocketFactories._getCustomSSLSocketFactory(SSLSocketFactories.java:50)
... 14 common frames omitted
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
at java.base/com.sun.crypto.provider.CipherCore.unpad(Unknown Source)
at java.base/com.sun.crypto.provider.CipherCore.fillOutputBuffer(Unknown Source)
at java.base/com.sun.crypto.provider.CipherCore.doFinal(Unknown Source)
at java.base/com.sun.crypto.provider.PBES2Core.engineDoFinal(Unknown Source)
at java.base/javax.crypto.Cipher.doFinal(Unknown Source)
at java.base/sun.security.pkcs12.PKCS12KeyStore.lambda$engineGetKey$0(Unknown Source)
at java.base/sun.security.pkcs12.PKCS12KeyStore$RetryWithZero.run(Unknown Source)
... 21 common frames omitted

```

---

<div class="post-metadata">

**Author:** ![shc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shc/32/4918_2.png) [@shc](https://forum.inductiveautomation.com/u/shc)\
**Post date:** [July 14, 2025, 9:33am UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/50 "2025-07-14T09:33:39Z")

</div>

Hi, Anyone has a simple yaml file for using the API as endpoint, where it posible to recive a simple tag/value ?

---

<div class="post-metadata">

**Author:** ![richhull](https://avatars.discourse-cdn.com/v4/letter/r/b19c9b/32.png) [@richhull](https://forum.inductiveautomation.com/u/richhull)\
**Post date:** [August 14, 2025, 3:09pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/51 "2025-08-14T15:09:58Z")

</div>

I’m having a similar issue. Does anyone know how to read a tag value from ignition to the YAML API Configuration? Am I doing somethin wrong?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/d/ed349edcd1ea595b4e859018fdf75cd54aaff6b8.png)

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [August 14, 2025, 4:22pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/52 "2025-08-14T16:22:24Z")

</div>

> [@richhull](#):
>
> read a tag value from ignition to the YAML

The API Module uses the YAML file as a configuration file.  
Are you trying to submit a request to a REST endpoint when you change a tag value?

---

<div class="post-metadata">

**Author:** ![richhull](https://avatars.discourse-cdn.com/v4/letter/r/b19c9b/32.png) [@richhull](https://forum.inductiveautomation.com/u/richhull)\
**Post date:** [August 14, 2025, 4:23pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/53 "2025-08-14T16:23:39Z")

</div>

I am using the tag value as the token, the token refreshes every hour for security reasons so I would like it to read the tag value of the token as it refreshes.

---

<div class="post-metadata">

**Author:** ![Kyle.Chase](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@Kyle.Chase](https://forum.inductiveautomation.com/u/Kyle.Chase)\
**Post date:** [August 14, 2025, 4:29pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/54 "2025-08-14T16:29:03Z")

</div>

Are you trying to use the value of a tag as the token, or are you trying to write the token to a tag?

---

<div class="post-metadata">

**Author:** ![richhull](https://avatars.discourse-cdn.com/v4/letter/r/b19c9b/32.png) [@richhull](https://forum.inductiveautomation.com/u/richhull)\
**Post date:** [August 14, 2025, 4:29pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/55 "2025-08-14T16:29:31Z")

</div>

use the value of the tag as the token

---

<div class="post-metadata">

**Author:** ![Kyle.Chase](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@Kyle.Chase](https://forum.inductiveautomation.com/u/Kyle.Chase)\
**Post date:** [August 14, 2025, 6:02pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/56 "2025-08-14T18:02:57Z")

</div>

That isn’t possible with the module right now I believe. How are you getting the refreshed roken?

---

<div class="post-metadata">

**Author:** ![Kyle.Chase](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@Kyle.Chase](https://forum.inductiveautomation.com/u/Kyle.Chase)\
**Post date:** [August 14, 2025, 7:10pm UTC](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120/57 "2025-08-14T19:10:53Z")

</div>

Depending on how the token is being refreshed, this might be something that can be utilized using the session id auth type.

[Previous page](https://forum.inductiveautomation.com/t/kyvis-labs-api-client-module/69120.md?page=2)
