Slimsite integration guide

From Hostcontrol Wiki
Jump to: navigation, search


Introduction

This is a practical guide for developers on how to integrate the Resello Slimsite website builder with custom customer control panels.

It covers creating a new website builder hosting account and giving a customer access to the account.

The examples are CURL commands which can be easily run from the command line of translated to other languages.


Domain registrations

The Resello website builder can be used with both domains registered through the Resello system or domains registered via other systems.

In the second scenario (domain already exists outside of Resello) we need to create an "unmanaged" domain within Resello.

We still need to add the domain to Resello for the website builder to be able to host the site on the correct domain name.


Prerequisites

To follow this guide you need:

  • A Resello reseller account on production or OTE environment (contact Resello support if you need an account)
  • Access to the Reseller control panel in Resello (Reseller Area)
  • The RP API key (you can create a key from the Reseller Area)
  • Your reseller reference (displayed in the Reseller Area)
  • A contact handle: you can create a contact in the reseller area via "Settings" -> "Generic contacts"

If you are registering domains outside the Resello system you can provide dummy/minimal contact details when creating the generic contact.

The Resello API uses "Basic Auth" based on the reseller reference as username and the API key as password. You can substitute your own reference and key in the examples below.


Steps

These steps describe how you can add a domain, create an website builder hosting account and give a customer access to the websitebuilder.


Create the domain

First we need to add the domain to Resello, using the domain API.

Tip: Remove '"is_managed": false' to actually register the domain via the Resello system. In this case you first need to create the contacts; see <this link> on how to do this. For testing purposes it is easier to add "is_managed": true.

Tip: <contact handle> is the handle you can see under "Settings" -> "Generic contact" in the Reseller Area

curl --user <reference>:<api-key> -H "Content-Type: application/json" -X POST -d '{ "name": "<domain name>", "is\_managed": false, "contacts": [{"role": "registrant", "contact": "<contact handle>"}, {"role": "admin","contact": "<contact handle>"},{"role": "billing","contact": "<contact handle>"},{"role": "tech","contact": "<contact handle>"}]}' https://rp01.hostcontrol.com/api/v1/domain

If the call is successful you should see an element called "id" in the result JSON. Hold on to this ID, we need it later. (In an actual implementation you want to store this in a database and link it to the domain.)


Create the hosting account

The website builder is delivered as part of an hosting account, to also accommodate for e-mail hosting.

To create the hostingaccount we use the hosting-account API:

curl --user <reference>:<api-key> -H "Content-Type: application/json" -X POST -d '{"type": "website-builder", "country": "NL", "owner\_email\_address": "test@hostcontrol.com", "storage\_quota": 400, "traffic\_quota": null, "max\_domain\_count": 1, "max\_database\_count": 0, "max\_user\_count": 0, "is\_installations\_enabled": false, "max\_email\_user\_count": 2, "max\_email\_forward\_count": 2, "max\_email\_user\_storage\_quota": 200, "is\_pop3\_enabled": false, "is\_smtp\_enabled": false, "is\_imap_enabled": false, "website\_builder\_plan": 1}' https://rp01.hostcontrol.com/api/v1/hosting-account

Tip: the "website\_builder\_plan" determines which website builder plan is created. See plan overview for all available plan combinations. The letters A-F correspond to plan id 1-6, the Ecwid plans are id 7-10.

The resulting JSON contains the unique id for this hosting account as "reference" (format "ac-XXXXX", do not confuse with website-builder -> reference)


Link the hosting account to the domain

In this step we link the hosting account and domain together, so the website builder knows on which domain the website should be visible if the customer publishes.

For this step you need to pass the reference from the hosting account above as <hosting reference> in the JSON body and the id from the domain (note: not the actual domain name) in the URL:

curl --user reference:api-key -H "Content-Type: application/json" -X POST -d '{"hosting\_account": "<hosting reference>"}' https://rp01.hostcontrol.com/api/v1/domain/<domain id>/link

This should just return: {"success": true}


Access the website builder interface

The online website builder provides the WYSIWYG editor customers can use to edit their website.

To give a customer access to this website builder, we need to retrieve an access:

curl --user <reference>:<api-key> -H "Content-Type: application/json" -X POST -d '{"hosting\_account": "ac-v6as4"}' https://rp01.hostcontrol.com/api/v1/hosting-website-builder-token

This will return a JSON document with the access\_url: {"access_url": "http://in01.hostcontrol.com/publisher/?token=XXXX", ...}

You can now redirect the customer to this url and it should open the website editor for that domain.

Tip: the token is only valid for an limited time; it is best to create the token directly after the customer clicks the "Edit website" button in your control panel and then redirect to the "access_url".


Get the A records (Optional)

Only needed when the domain is not registered in Resello.

If you manage the domain in another system you need to point the domain A records to the new website. For this you need the IP on which the website will be published.

You can retrieve these IP addresses by looking at the DNS zone in Resello via the dns-zone API:

curl --user <reference>:<api-key> -H "Content-Type: application/json" -X GET https://rp01.hostcontrol.com/api/v1/dns-zone/twoxy-test-01.nl

This will return a JSON document with: "records": ["type:": "A", "content": "<ip address>", ... ]

Use the <ip address> as the A record for this domain.

Tip: the website will be available at this IP after the customer publishes the website from the online website builder.


Conclusion

We hope this hands-on guide will help you implement the Slimsite website builder smoothly. Do not hesitate to contact us if you have questions about this guide or implementation!