Very very easy example I hacked together. At least I got logged in but not deleting the session so not that clean yet.
https://dl.dropboxusercontent.com/u/289 ... %20api.zip
-
- Veeam Software
- Posts: 1818
- Liked: 655 times
- Joined: Mar 02, 2012 1:40 pm
- Full Name: Timothy Dewin
- Contact:
-
- Veeam Software
- Posts: 1818
- Liked: 655 times
- Joined: Mar 02, 2012 1:40 pm
- Full Name: Timothy Dewin
- Contact:
Re: Rest API PHP call
Here is an updated version https://dl.dropboxusercontent.com/u/289 ... _start.zip
It contains an example vrest_start.php that will start a job via the rest api. Basically the simple example in PHP. In vrest_start.php I also added the code to log out. Could be useful if you want to use a linux scheduler. However it is still async. The task I get back from Enterprise manager just seems to "wait" (task status = finnished) until the backup command has been acknowledged by the backup server.
It contains an example vrest_start.php that will start a job via the rest api. Basically the simple example in PHP. In vrest_start.php I also added the code to log out. Could be useful if you want to use a linux scheduler. However it is still async. The task I get back from Enterprise manager just seems to "wait" (task status = finnished) until the backup command has been acknowledged by the backup server.
-
- Influencer
- Posts: 23
- Liked: 1 time
- Joined: Mar 21, 2014 3:06 pm
- Full Name: sirine chadly
- Contact:
Re: Rest API PHP call
Hello I tried to use the vrest.zip but I get this error when executing; php vrest_start.php BackupJob
"fatal error call to undefined method Guzzle\Common\Exception\RuntimeException::getResponse() in vrest_start.php"
"fatal error call to undefined method Guzzle\Common\Exception\RuntimeException::getResponse() in vrest_start.php"
-
- Influencer
- Posts: 23
- Liked: 1 time
- Joined: Mar 21, 2014 3:06 pm
- Full Name: sirine chadly
- Contact:
Re: Rest API PHP call
Why I only get "the magic is starting here" and the rest ??
-
- Veeam Software
- Posts: 1818
- Liked: 655 times
- Joined: Mar 02, 2012 1:40 pm
- Full Name: Timothy Dewin
- Contact:
Re: Rest API PHP call
Long time I wrote this but reviewed it quickly. Basically it means you are successfully loading the guzzle library but nothing has happened yet
Make sure you have changed the username and password in the file because if the login fails, it won't do anything (if ($login != "") but no else statement saying something like "login failed")
Make sure you have changed the username and password in the file because if the login fails, it won't do anything (if ($login != "") but no else statement saying something like "login failed")
Who is online
Users browsing this forum: No registered users and 4 guests