haxpax / gosms

:mailbox_closed: Your own local SMS gateway in Go
GNU General Public License v2.0
1.45k stars 154 forks source link

API request example? #4

Closed demogorgonz closed 9 years ago

demogorgonz commented 9 years ago

Can someone please provide examples for API usage :) ?

Thank you!

Omie commented 9 years ago

hey,

API specification is quite clear I suppose, please let me know what wasn't clear enough so that I can update the document as well.

As for example, this is how one can push an sms using requests module in Python


#pip install requests
import requests

sms = { "mobile": "+919890098900", "message": "hello, world" }
r = requests.post("http://<gosms-server-ip>:8951/api/sms/", data=msg)
print r.text
demogorgonz commented 9 years ago

@Omie there is no web API i suppose ? It would be great if parameters could be forwarded in URL string, for example : "http://localhost/mobile=+xxxxxxxxx%message=hello, world"

Omie commented 9 years ago

@demogorgonz It is a web API :) We are using POST instead of GET since it makes more sense.

demogorgonz commented 9 years ago

@Omie i thought it would be neat feature that API could listen via web URL, something like rundeck does :+1:

Anyway, thank you very much!