REST API knowledge exchange
sirinech
Influencer
Posts: 23 Liked: 1 time
Joined: Mar 21, 2014 3:06 pm
Full Name: sirine chadly
Contact:
Post
by sirinech » May 16, 2014 11:05 am
this post
Hello Every Body, I'm trying to get the X-RestSession using curl php :
Code: Select all
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => $url,
CURLOPT_VERBOSE => true,
CURLOPT_HEADER => true,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
);
curl_setopt_array($ch, $curlConfig);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array(
'HTTP_AUTH_LOGIN: '.$login,
'HTTP_AUTH_PASSWD: '.$passwd,
'Content-Type: application/xml; charset=utf-8',
'Content-Length: '.strlen($data),
'Authorization: Basic '.$data,
));
curl_exec($ch);
But I get this screen:
https://www.dropbox.com/s/mkgtbnwvg3lix75/test.png
What could be the problem??
sirinech
Influencer
Posts: 23 Liked: 1 time
Joined: Mar 21, 2014 3:06 pm
Full Name: sirine chadly
Contact:
Post
by sirinech » May 17, 2014 8:08 pm
this post
I changed the code to this and it worked but I don't see the X-RestSvcSessionId in the response header how do I get it?
sirinech
Influencer
Posts: 23 Liked: 1 time
Joined: Mar 21, 2014 3:06 pm
Full Name: sirine chadly
Contact:
Post
by sirinech » May 17, 2014 9:30 pm
1 person likes this post
Solved
clh_jl
Service Provider
Posts: 14 Liked: 2 times
Joined: Sep 22, 2014 12:49 pm
Contact:
Post
by clh_jl » Sep 22, 2014 12:50 pm
this post
What was the solution?
veremin
Product Manager
Posts: 20415 Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Sep 22, 2014 2:42 pm
this post
Are experiencing any problems while trying to create logon session via cURL? The following request should work fine, at least it does so in my case (I'm using Windows cURL client):
Code: Select all
curl -XPOST -v -u user:password http://EM:9399/api/sessionMngr/ -H "Content-Length: 0"
Thanks.
clh_jl
Service Provider
Posts: 14 Liked: 2 times
Joined: Sep 22, 2014 12:49 pm
Contact:
Post
by clh_jl » Sep 24, 2014 2:40 pm
this post
Hi,
Thanks for the reply. I was looking to do something similar using PHP - however, I have since realised that there are a large number of code samples provided as part of the Veeam EM installation (C:\Program Files\Veeam\Backup and Replication\Enterprise Manager\samples) which I used to connect instead.
Thanks.
veremin
Product Manager
Posts: 20415 Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Sep 24, 2014 4:19 pm
this post
Glad to hear you've nailed. Don't forget to utilize our
Help Center to learn more about syntax and available entities. Thanks.
Users browsing this forum: No registered users and 1 guest