Example RestAPI code

RESTful knowledge exchange

Re: Example RestAPI code

Veeam Logoby headcloudmonkey » Tue Jan 26, 2016 4:26 pm

Hi Harold/Preben,

How are you getting on with the API code for Veeam v9? Did you manage to get it working correctly? I'm getting a cURL error 7 Failed to connect Permission denied error when I try with the modifications above (Guzzle v4, and base_url).

Thanks
Dan
Daniel Gould
CTO
w: www.stratogen.net
headcloudmonkey
Service Provider
 
Posts: 13
Liked: 3 times
Joined: Thu Jul 09, 2015 9:14 am
Location: Brighton, East Sussex, UK
Full Name: Dan Gould

Re: Example RestAPI code

Veeam Logoby poulpreben » Tue Jan 26, 2016 4:35 pm

Hi Dan,

Sorry, I have been on the road for customer engagements for the past couple of days.

I'm not sure why that is not working for you. You may just revert to the last version I have tested extensively. Remove all the files, and use this:

Code: Select all
git clone https://github.com/poulpreben/veeam-cloudconnect.git
cd veeam-cloudconnect
git checkout d1dc554b5525e5b5ba383a2659e3659a3be02eea


That's using the commit I made on GuzzleHTTP 4, which definitely worked.
poulpreben
Expert
 
Posts: 935
Liked: 398 times
Joined: Mon Jul 23, 2012 8:16 am
Full Name: Preben Berg

Re: Example RestAPI code

Veeam Logoby headcloudmonkey » Tue Jan 26, 2016 5:17 pm 1 person likes this post

All fixed - I forgot about disbaling selinux protection in my linux VM running the code!
Daniel Gould
CTO
w: www.stratogen.net
headcloudmonkey
Service Provider
 
Posts: 13
Liked: 3 times
Joined: Thu Jul 09, 2015 9:14 am
Location: Brighton, East Sussex, UK
Full Name: Dan Gould

Re: Example RestAPI code

Veeam Logoby poulpreben » Sun Jan 31, 2016 10:17 am

Hi all. I have had to revert to using GuzzleHTTP 5.x, as 6.x implements PSR-7, which would require me to completely refactor my code.

I have not tested which SELinux settings are required, but here is my configuration:
Code: Select all
$ vagrant ssh -c "uname -a; php --version; apachectl -v"
Linux restful-demo 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Oct 14 2015 14:20:21


Thanks for your feedback!
poulpreben
Expert
 
Posts: 935
Liked: 398 times
Joined: Mon Jul 23, 2012 8:16 am
Full Name: Preben Berg

Re: Example RestAPI code

Veeam Logoby peasoupcto » Mon Feb 01, 2016 4:08 pm

Thanks Preben,

I'm using guzzle 4.x currently which is working good for me so far. any benefits of using 5.x?

my config is:

Code: Select all
Linux vm-dc01-www02 4.2.0-25-generic #30-Ubuntu SMP Mon Jan 18 12:31:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
PHP 5.6.11-1ubuntu3.1 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
Server version: Apache/2.4.12 (Ubuntu)
Server built:   Jul 24 2015 15:59:00


Do you have any tips on username check? i.e. check if user exist in API and return to form if it does .. Am breaking my head around that part

Thanks
Harold Buter
CTO PeaSoup Hosting
w: http://peasoup.net
peasoupcto
Service Provider
 
Posts: 11
Liked: 2 times
Joined: Fri Jan 22, 2016 11:49 am
Location: weybridge
Full Name: Harold Buter

Re: Example RestAPI code

Veeam Logoby poulpreben » Tue Feb 02, 2016 12:56 pm

Hi Harold,

The only reason I changed to 5.x is because it is actively maintanined, whereas 4.x is end of life. For the example specifically, I do not see any differences.

We are all at the annual sales kickoff this week, so I do not have access to my development environment, but I can definitely write such a check for you once I get back.

Thanks,
Preben
poulpreben
Expert
 
Posts: 935
Liked: 398 times
Joined: Mon Jul 23, 2012 8:16 am
Full Name: Preben Berg

Re: Example RestAPI code

Veeam Logoby peasoupcto » Wed Feb 03, 2016 12:33 pm

Hi Preben,

that would make sense, I will upgrade to version 5.x a bit later as I still develop some other parts at the moment . Any help with the check would be very much appreciated, programming using the API is relative new to me

Thanks again for your help mate

and have fun at the kick off :)

cheers,
Harold Buter
CTO PeaSoup Hosting
w: http://peasoup.net
peasoupcto
Service Provider
 
Posts: 11
Liked: 2 times
Joined: Fri Jan 22, 2016 11:49 am
Location: weybridge
Full Name: Harold Buter

Re: Example RestAPI code

Veeam Logoby poulpreben » Thu Feb 04, 2016 5:26 pm

Hi Harold,

I have added the veeam_check_username() method here > https://github.com/poulpreben/veeam-clo ... s.php#L152

Thanks,
Preben
poulpreben
Expert
 
Posts: 935
Liked: 398 times
Joined: Mon Jul 23, 2012 8:16 am
Full Name: Preben Berg

Re: Example RestAPI code

Veeam Logoby peasoupcto » Thu Feb 11, 2016 10:08 am 1 person likes this post

Brilliant mate,

many thanks for that! will incorporate that into the our site now :)

cheers,
Harold Buter
CTO PeaSoup Hosting
w: http://peasoup.net
peasoupcto
Service Provider
 
Posts: 11
Liked: 2 times
Joined: Fri Jan 22, 2016 11:49 am
Location: weybridge
Full Name: Harold Buter

Previous

Return to RESTful API



Who is online

Users browsing this forum: No registered users and 3 guests