DudaMobile White Label Self Service

Overview

With DudaPro, you can now integrate much of the Duda experience on your own platform. In order to accomplish this, we would: Create an Account for the User --> Create a Site -->  Grant the newly created account access to the site --> Log the user into the mobile site builder by performing Single Sign On (SSO). After the user is logged in, they will be able to fully customize the mobile website through the editor.

Target Audience

Companies with an existing user base and account management system who would like to allow their customers to create and edit mobile sites.

Available for: DudaPro Partners

Essentials before getting started

  1. Make sure you are a DudaPro Partner and have setup your customized editor, dashboard, login and domains.
  2. Requested API access and have been approved. Have your API user and password keys ready.
  3. Create a form on your website asking users to enter a site URL and their email address (incase you don't already have this information) and submit the information to a page that will perform the actions below.

Steps to implement

Full implementation code is attached to the bottom of this article.

1) Create Account

You will create a DudaPro sub-account that is related to your master account with Duda. This sub-account will later grant access to edit the site you create. To do this, we will call the /accounts/create URI to create the account with the input data.

API URL:

https://api.dudamobile.com/api/accounts/create
Parameters:

  • account_name - your sub account users email address (mandatory)
  • first_name - your sub account users first name (optional)
  • last_name - your sub account users last name (optional)

Success response code: [http_code] => 204

PHP Code Example:

<?php
//Set JSON formated message to send to Duda
$data = '
    {  
      "account_name": "{account_email}",
      "first_name": "{account_owner_first_name}",
      "last_name": "{account_owner_last_name}"
    }
';
//Initiate cURL
$ch = curl_init();
//Set cURL parameters
curl_setopt($ch, CURLOPT_URL, 'https://api.dudamobile.com/api/accounts/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "{your_api_username}:{your_api_password}");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER,array(                                                                         
   'Content-Type: application/json',      
    'Content-Length: ' .strlen($data))                                                                      
);  
//Perform cURL call and set $output as returned data, if any is returned
$output = curl_exec($ch);
curl_close($ch);
?>

2) Create Site

Now that we have the sub-account created, we also want to create a site to grant access to. To do this, we will POST a message to the /sites/create URI.

API URL:

https://api.dudamobile.com/api/sites/mobile/create
Parameters:

  • site_data:
  • original_site_url - the base URL of the website you want to convert (mandatory)

Success response code: [http_code] => 200

Success Response: site_name

<?php
//Set JSON formated message to send to Duda
$data = '
    {  
    "site_data":
        {
            "original_site_url":"{original_site_url}"
        }
    }
';
//Initiate cURL
$ch = curl_init();
//Set cURL parameters
curl_setopt($ch, CURLOPT_URL, 'https://api.dudamobile.com/api/sites/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "{your_api_username}:{your_api_password}");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER,array(                                                                         
    'Content-Type: application/json',      
    'Content-Length: ' .strlen($data))                                                                      
);  
//Perform cURL call and set $output as returned data, please note the retuned site_name value
$output = curl_exec($ch);
curl_close($ch);
?>

3) Grant Sub-Account Access

Now that we have the sub-account and site created, we want to grant access for the sub-account to the site.

API URL: 

https://api.dudamobile.com/api/grant...es/{site_name}
Parameters:

  • account_name (from the account you created above)
  • site_name (from the site you created above as well)

Success response code: [http_code] => 200

<?php
$data = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.dudamobile.com/api/accounts/grant-access/{previously_created_account_name}/sites/{previously_created_site_alias}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "{your_api_username}:{your_api_password}");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER,array(                                                                         
    'Content-Type: application/json',      
    'Content-Length: ' .strlen($data))                                                                      
);  
$output = curl_exec($ch);
curl_close($ch);
?>

4) Perform Single Sign On

After you’ve created a sub-account for your user, a site and granted access, you can perform SSO to log them directly into your branded editor. Head over to our SSO page to see exactly how to implement this last step.

Note:

  • Sub-account users cannot create or delete sites, this must be done by the DudaPro partner.
  • The login, dashboard and editor pages cannot be customized through the API, they need to be customized by logging directly into the partner account and going to the account settings.
×

Priority Phone Support

English phone support is available 18 hours a day,
Monday through Friday, 3am to 9pm (EST).

United States +1 866-776-1550 3am to 9pm (Eastern)
United Kingdom +44 (0)800-011-9071 8am to 2am (London)
France +33 (0)9-75-18-84-74 9am to 3am (Paris)
Israel +972 (0)3-720-8922 10am to 4am (Jerusalem)
Australia +61 (0)2-8880-9166 7pm to 1pm (Sydney)
To schedule a call in French, Portuguese, Hebrew or Russian, please email us at prioritysupport@dudamobile.com
×

Please Log in as a DudaPro

Priority Phone Support is available exclusively to DudaPros. Log in to your DudaPro account now to see our international support numbers.

Log In
Not a DudaPro? Start a free trial now!