Request Format REST |
A REST request is very easy to understand. It is a simple HTTP GET or HTTP POST action. Some methods require a GET and some a POST. General rule of thumb; If you send us information, you need a POST. If you ask us to send information you should use a GET. You can find the right action for a method in it's documentation. UrlThe url for all requests is: https://api.webcron.org/ GET Examplehttps://api.webcron.org/monitor.get/frequence:1,2/protocol:http
The part after "api.webcron.org/" is the method of the request. In above example the method is monitor.get. After the method you can add parameters. The format of parameters is: name:value or, in case of more values: name:value1,value2,value3 POST and encodingThe format of posted data is as follows: "fieldName=value". name=theName&url=http%3A%2F%2Fwww.dothis.com%2Fdo.php%3Fwhat%3Dbackup&frequence=2&
post=what%3Dbackup%26when%3Dnow All data in a POST should be properly encoded. In above example, the string after "url" and "post" are encoded. Most languages have a function to do this (php: urlencode(), javascript: escape()). Or use an online encoding tool . cURL POST ExampleBelow an example using cURL to add a monitor. Replace ApiUsername and ApiPassword by yours. curl -u ApiUsername:ApiPassword -d name='theName' -d url='http://www.monitorthis.net' -d protocol=http -d frequence=2 api.webcron.org/monitor.add
|