I have two questions

Ask and answer questions related to any type of OSA scripting.
Message
Author
Automate
Posts: 1691
Joined: Sat Dec 11, 2010 1:44 pm
Location: US

Re: I have two questions

#11 Post by Automate » Thu Sep 25, 2014 3:16 am

Maximo wrote:Thanks for the replies.

So this is the REST Post I need to use but just can't get it to work at all.

http://localhost:8732/api/object/Garage ... m2={param2}

The object has the following;

State: Not Recording / Recording
Method: OFF / ON
Event: Not Recording / Recording

So how do I use this post?
Your method name needs to match your State or State Label if you want to use the Owned By SYSTEM. To simplify you may want to use States OFF and ON.

Your URL should be
http://localhost:8732/api/object/GarageCamera/On

Make sure you use a POST not a GET
You can use the following in Chrome to test
https://chrome.google.com/webstore/deta ... o?hl=en-US

Andre
Posts: 26
Joined: Tue Jul 08, 2014 6:29 am

Re: I have two questions

#12 Post by Andre » Thu Sep 25, 2014 3:26 am

Can you get the script to fire correctly when attached to an object within OSA?

I have an object called "Test" I then attach the script that I am testing via the methods. Then toggle "On" or "Off" methods in Object View and cause the script to fire until I am happy that is works from within OSA, then I start working outwards.

Also, have you tried any other methods, that you know work, via the REST interface? This way we will know of the actual object is a problem or the way that it is being called.

I can investigate the REST interface on the weekend sometime, see if I can get some methods firing and get back to you..

Maximo
Posts: 199
Joined: Thu Dec 15, 2011 8:53 am
Location: UK

Re: I have two questions

#13 Post by Maximo » Thu Sep 25, 2014 8:32 am

Thanks guys, you help is very much appreciated.

Installed the chome app and ran the test, it works :-) So in the app you can select Get, Post, Etc.... What do I now need to do with the URL so that it's sent as a Post?

Cheers,

Garry

Automate
Posts: 1691
Joined: Sat Dec 11, 2010 1:44 pm
Location: US

Re: I have two questions

#14 Post by Automate » Thu Sep 25, 2014 1:43 pm

From a command line? cURL should work

Something like:
curl -X POST http://OSA_REST_URL

Maximo
Posts: 199
Joined: Thu Dec 15, 2011 8:53 am
Location: UK

Re: I have two questions

#15 Post by Maximo » Fri Sep 26, 2014 1:24 am

Stage one is now working, thanks Automate for the pointer.

Code: Select all

curl --data '' http://tv01.local.mycyberspace.co.uk:8732/api/object/Garage_Camera/ON
This works just fine.

I'll see what I can do with this on the Raspberry PI's now for my Temp's.

Good work guys.

Andre
Posts: 26
Joined: Tue Jul 08, 2014 6:29 am

Re: I have two questions

#16 Post by Andre » Fri Sep 26, 2014 10:57 pm

You should be able to use cURL for that then as well.

Post Reply