EcoStruxure IT forum
Schneider Electric support forum about installation and configuration for DCIM including EcoStruxure IT Expert, IT Advisor, Data Center Expert, and NetBotz
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-04 11:39 PM . Last Modified: 2024-04-04 02:29 AM
(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 . Last Modified: 2024-04-04 02:29 AM
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 . Last Modified: 2024-04-04 02:29 AM
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 . Last Modified: 2024-04-04 02:29 AM
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 . Last Modified: 2024-04-04 02:29 AM
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 . Last Modified: 2024-04-04 02:29 AM
+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 . Last Modified: 2024-04-04 02:29 AM
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 . Last Modified: 2023-10-20 05:01 AM
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 board - and gain access to more than 10,000+ support articles along with insights from experts and peers.