API: OpenSRS Email

The API: OpenSRS Hosted Email Developer Hub

Welcome to the API: OpenSRS Hosted Email developer hub. You'll find comprehensive guides and documentation to help you start working with API: OpenSRS Hosted Email as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Example clients

Perl and LWP

📘

Note:

In the test environment, Perl and LWP based requests may fail and return the error: 500 Can't connect to admin.test.hostedemail.com:443 (certificate verify failed) due to the test environment SSL certificate being invalid.

To bypass certificate checking, you can use the following line in your script:

$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;

The Perl script below lists a number of modules that need to be installed. In addition to these, and to make an HTTPS connection using LWP, please ensure you have the following module installed:

LWP::Protocol::https

!/usr/bin / perl
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
use Data::Dumper;
my $api_url = 'https://admin.a.hostedemail.com/api';
my $method = 'get_user';
my $url = $api_url.$method;
my $credentials = {
    'user' => '[email protected]',
    'password' => 'sw0rdf1sh'
};
my $user = '[email protected]';
my % request_body = (
    'credentials' => $credentials,
    'user' => $user,
);
#encode request in JSON
my $json_request = encode_json(\ % request_body);
#send request to API
my $ua = LWP::UserAgent - > new;
my $request = HTTP::Request - > new(POST => $url);
$request - > content_type('application/json');
$request - > content($json_request);
my $response = $ua - > request($request);
if ($response - > is_success)# HTTP success 
{
    #convert response from JSON to a perl hash
    my $response_body = from_json($response - > content());
    print Dumper $response_body;
} 
else 
{
    print "Something went terribly wrong\n";
    print $response - > status_line, "\n";
}

Updated less than a minute ago

Example clients


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.