AD2PI REST API

General Discussion

AD2PI REST API

Postby miragejb » Wed Jan 17, 2018 7:51 am

This maybe a stupid question...

I assuming that the REST API for the AD2PI can be utilized with any development language that can GET/POST HTTP REST messages (such as C# or Java). Is this correct?

I've been searching, but I only see references to Python which I am not familiar with (nor want to be).

Thanks.
miragejb
Junior Nut
Junior Nut
 
Posts: 29
Joined: Wed Jan 17, 2018 7:32 am

Re: AD2PI REST API

Postby kevin » Sun Jan 21, 2018 10:03 pm

Yes, anything that can GET/POST/PUT whatever will work. See http://www.alarmdecoder.com/swagger for implementation details
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2PI REST API

Postby miragejb » Tue Jan 23, 2018 4:14 am

Thanks. I saw that earlier.

Do you know if the REST API supports PUSH notifications?
miragejb
Junior Nut
Junior Nut
 
Posts: 29
Joined: Wed Jan 17, 2018 7:32 am

Re: AD2PI REST API

Postby kevin » Tue Jan 23, 2018 5:55 am

What is shown is what is there... I'm not sure what you mean other than that.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2PI REST API

Postby miragejb » Tue Jan 23, 2018 6:13 am

A REST Push notification is like an event. Instead of you polling the server (issuing the HTTP commands) every few seconds in order to get the state of the alarm system (i.e. armed away, ready state, armed stay, alarm sounding, etc), REST technology provides the ability to "push" events out to the connected clients. Therefore you would get notifications (almost) instantly instead of there being a lag.

Having a program poll the website on the PI is an expensive time/consuming operation. It chews up a lot of resources and sometimes can overwhelm the webserver itself.

I know the documentation for the command set is on the website. However, REST developers usually provide push notifications for event handling. I wasn't sure if there were some undocumented features that weren't listed.

I hope I am explaining myself okay. Sometimes I don't make sense -- or at least that's what my wife tells me :-).

Thanks.
miragejb
Junior Nut
Junior Nut
 
Posts: 29
Joined: Wed Jan 17, 2018 7:32 am

Re: AD2PI REST API

Postby kevin » Tue Jan 23, 2018 6:01 pm

You can achieve this through a 'custom notification' and GET/POST urldecoded or json data to any endpoint you want.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2PI REST API

Postby miragejb » Tue Jan 23, 2018 6:13 pm

Thanks for your reply.

If I'm understanding you correctly, you are stating that I still have to query the endpoint repetitively...correct? In other words, I looping every 5 seconds (for example) and using HTTP GET to retrieve the JSON from the particular endpoint I need.

Is this what you are saying? If I'm not following you correctly, could you please elaborate?

I know I can GET/POST data to the web server to retrieve the data I need, but I was hoping there was a PUSH notification in the REST API that would send an immediate event to a registered listener when an event would occur on the alarm panel

If I'm not following you correctly, could you please elaborate?

As always, thanks for you help.
miragejb
Junior Nut
Junior Nut
 
Posts: 29
Joined: Wed Jan 17, 2018 7:32 am

Re: AD2PI REST API

Postby kevin » Tue Jan 23, 2018 6:38 pm

Utilizing the "Custom Notification" you can have the webapp GET or POST to ANY URL you want, including a 3rd party system, you do not have to poll anything when you're posting directly to where you want to post...

Flow is as such:

Alarm Event happens
Notification Triggered
Notification Sent to configured URL with specified customizable fields

You can always manually check the status with the REST API, yes, but if you want what you're asking for, Custom Notification is what you are looking for.

Example usage would be to trigger something on IFTTT or start a camera recording on alarm event.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2PI REST API

Postby miragejb » Tue Jan 23, 2018 6:57 pm

Sounds interesting. I was thinking specifically in terms of the REST specifications/implementations. I am assuming when you say the "webapp" you are referring to the webapp on the PI (developed by alarmdecoder) that is the buffer between the AD2PI and the connecting client. Therefore I am basing the following questions on this assumption.

Does this Custom Notification piece already exist somewhere within the webapp? It would have to reside somewhere on the PI. If so, how do you configure it. Is there doc on it.

If not, would it be something that I would have to develop on the PI (and/or extend from the web app) in order to make this "Custom Notification" trigger? The only caveat to this is that if the PI has to POST data elsewhere (Based on the URL), the recipient of that URL would have to be another HTTP server and not a client.

It's challenging for me to try to understand and collaborate on this topic, but I'm doing the best I can.

Your response is greatly appreciated.
miragejb
Junior Nut
Junior Nut
 
Posts: 29
Joined: Wed Jan 17, 2018 7:32 am

Re: AD2PI REST API

Postby kevin » Tue Jan 23, 2018 7:04 pm

It already exists in the webapp.

https://www.alarmdecoder.com/wiki/index ... m_URL_POST

Since that documentation it now does GET as well.

It's all open source ... extend it how you want it.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Next

Return to General

Who is online

Users browsing this forum: No registered users and 36 guests

cron