Important Announcement: Community Back to Full Functionality
Dear Members, we are thrilled to announce that our Community is back to full functionality and that posts publication is now enabled again! We appreciate your patience during the last weeks. Learn more about our Community Guidelines. Thank you, Schneider Electric Community Team.
EcoStruxure IT forum
Schneider Electric support forum about installation, configuration for Data Center Operation, Data Center Expert, EcoStruxure IT, NetBotz, DCIM, IT Advisor.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This question was originally posted on DCIM Support by david rose on 2018-09-17
(CID:134032557)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This answer was originally posted on DCIM Support by david rose on 2018-09-17
Hi Ed,
Happy to look at your CURL code - might help we see what's going on - or give me a base to work from.
Currently I have the simplest of Perl scripts trying to get a simple of assets (small steps).
I'm getting "500" error being returned.
500 Can't connect to dco.rhino-hosting.com:443 (Bad file descriptor) at simple.pl line 23.
This is against one of the the training servers.
use strict;
use warnings;
use LWP::UserAgent ();
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->credentials(
'dco.rhino-hosting.com:443',
'ISXO',
'user' => 'password'
);
$ua->default_header( Accept => 'application/json' );
my $response = $ua->get('https://dco.rhino-hosting.com/api/v8.1/assets');
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}
Thanks,
dave
(CID:134032607)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This answer was originally posted on DCIM Support by Ed Tarento on 2018-09-17
Hi David
I haven't used any of the REST PERL packages as I've tried to use only the installed software for SE for my scripting. This is no doubt something that each client/programmer will have a view on. Therefore I simply use a PERL system call and CURL. I would not call this production or professional grade solution but it gets the job done. If that helps, I'm happy to share a script
Cheers
Ed
(CID:134032589)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This answer was originally posted on DCIM Support by david rose on 2018-09-17
Hi Ed,
Happy to look at your CURL code - might help we see what's going on - or give me a base to work from.
Currently I have the simplest of Perl scripts trying to get a simple of assets (small steps).
I'm getting "500" error being returned.
500 Can't connect to dco.rhino-hosting.com:443 (Bad file descriptor) at simple.pl line 23.
This is against one of the the training servers.
use strict;
use warnings;
use LWP::UserAgent ();
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->credentials(
'dco.rhino-hosting.com:443',
'ISXO',
'user' => 'password'
);
$ua->default_header( Accept => 'application/json' );
my $response = $ua->get('https://dco.rhino-hosting.com/api/v8.1/assets');
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}
Thanks,
dave
(CID:134032607)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This comment was originally posted on DCIM Support by Ed Tarento on 2018-09-17
Try HTTP rather than HTTPS - just as a test
(CID:134032614)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This comment was originally posted on DCIM Support by Christopherus Laurentius on 2018-09-17
+1 on this comment.
Disable the auto routing from http to https via webmin if you are testing via http.
(CID:134032633)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This comment was originally posted on DCIM Support by david rose on 2018-09-18
That's done the trick - thanks!
And changed the authorisation to Basic.
Code now looks like this (in case anyone else is interested).
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use Data::Dumper;
use JSON;
my $address = "dco.rhino-hosting.com";
my $port = 80;
my $username = "user";
my $pass = "password";
my $url = "http://$address:$port/api/v8.1/assets";
print $url . "\n";
my $browser = LWP::UserAgent->new('Mozilla');
my $req = HTTP::Request->new(GET => $url);
$req->authorization_basic($username, $pass);
my $res = $browser->request($req);
print Dumper($res) . "\n";
my $response = from_json($res->decoded_content);
print Dumper($response) . "\n";
(CID:134032974)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM
This question is closed for comments. You're welcome to start a new topic if you have further comments on this issue.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the forum - and gain access to more than 10,000+ support articles along with insights from experts and peers.