Parsing JSON in Webcall from Blue Iris


#1

1) Give a description of the problem
Hi, I’ve tried for a few hours to extract a value from a JSON body in an HTTP call

I’m trying to pass a License Plate from Blue Iris into Webcore to determine if the gate should open.

I can see the HTML call triggering the Piston, and I’ve debugged the call to see that I am in fact sending JSON (see images)

2) What is the expected behaviour?
Essentially I want to populate a variable in Webcore with the value of the ‘plate’ and then see if that Matches a safe list.

3) What is happening/not happening?

The piston is firing but I cannot access the JSON payload, what am I doing wrong?

At present I;m just sending a hardcoded plate into Webcore but I can’t even get that to show up in the logs…

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full

20/08/2022, 17:40:21 +661ms
+1ms ╔Received event [Home].ifttt = licenseplate with a delay of 54ms
+54ms ║RunTime Analysis CS > 21ms > PS > 5ms > PE > 28ms > CE
+57ms ║Runtime (37125 bytes) successfully initialized in 5ms (v0.3.114.20220203) (54ms)
+58ms ║╔Execution stage started
+68ms ║║Comparison (string) licenseplate executes (string) licenseplate = true (2ms)
+70ms ║║Cancelling condition #3's schedules...
+71ms ║║Condition #3 evaluated true (7ms)
+73ms ║║Cancelling condition #2's schedules...
+74ms ║║Condition group #2 evaluated true (state changed) (10ms)
+75ms ║║Cancelling condition #1's schedules...
+76ms ║║Condition group #1 evaluated true (state changed) (13ms)
+79ms ║║Cancelling statement #5's schedules...
+86ms ║║[eventName:licenseplate, param1:ifttt, param2:licenseplate, params:[:], remoteAddr:92.29.91.147]
+87ms ║║Executed virtual command log (2ms)
+93ms ║║null
+96ms ║║Executed virtual command log (3ms)
+100ms ║║Executed virtual command parseJson (0ms)
+102ms ║╚Execution stage complete. (45ms)
+104ms ╚Event processed successfully (104ms)

Below is an image which I think proves I am sending a correct JSON payload…

This is my RAW HTTP call

POST [http://graph-eu01-euwest1.api.smartthings.com/api/token/992480d9-20a8-4d60-ad9a-a37e31fe878a/smartapps/installations/602241a1-2afd-4501-baad-d36212a8f721/ifttt/licenseplate HTTP/1.1](http://graph-eu01-euwest1.api.smartthings.com/api/token/992480d9-20a8-4d60-ad9a-a37e31fe878a/smartapps/installations/602241a1-2afd-4501-baad-d36212a8f721/ifttt/licenseplate%20HTTP/1.1)

Content-Type: application/json

User-Agent: Blue Iris

Host: graph-eu01-euwest1.api.smartthings.com

Content-Length: 18

Pragma: no-cache

{"Plate": "PQ5TY"}

Any help would be greatly appreciated.

Thanks


#2

I’ve figured out what was happening, I was trying to send via HTTP and the payload was not making it through…

When I switched to HTTPS I then saw the plate result in the logs…

+89ms ║║[Plate:PQ5TY, eventName:licenseplate, param1:ifttt, param2:licenseplate, params:[:], remoteAddr:92.29.91.147]


#3

FYI in case you have not seen: groovy, and webcore will cease on the ST platform on Sept. 30, 2022. You may want to head over to the ST forum for more info or find alternative solutions. :slight_smile: