addsite method

What this does

Add a website to Sitebeam. Once a site has been added, you can run tests on it. Alternatively, to quickly test a site, use the addandtestsite method.

Request

http://yoururl.com/api/addsite/

Where yoururl.com is the URL of your Sitebeam installation.

You can submit the following parameters via either GET or POST.

Parameter names are case sensitive.

Parameter Mandatory? Description
homeUrl Yes The URL of the homepage of the website to be tested. Essentially this is the top-most URL which will be spidered, e.g. http://silktide.com/ 

This URL is pre-processed by Sitebeam to correct common errors, so if say “silktide.com/index.php” was entered, Sitebeam would correct this to “http://silktide.com/”. The URL must be accessible online at the time the request is made, or an error will be returned.

name No The name of the website. If not specified, Sitebeam will use the domain name of the website, but without the URL scheme. E.g. “silktide.com” or “example.com”.
username No The username of the user who will own this site. If you don’t specify this or userId, then Sitebeam will select the top level Administrator for the install automatically.
userId No The user ID of the user who will own this site. If you don’t specify this or username, then Sitebeam will select the top level Administrator for the install automatically.
reuseExisting No If set to 1, then Sitebeam will not create the website if it already exists (i.e. if a matching homeUrl is found) – instead it will return the ID of the existing site. By default, Sitebeam always creates a new site.
warnSmallReports No If set to 1, then Sitebeam will warn if the report only contains 1 or 2 pages. This is the default behaviour for people using Sitebeam in the normal UI, but for the API the default is 0 – this hides these warnings.

Response

The service provides a JSON encoded response like so:

{

status: “ok”,

siteId: 110

}

Where siteId is the ID of the new website created. In the event of a failure, a descriptive error is returned instead:

{

status: “failed”,

errorMessage: “There is a problem with this web address: The domain name could not be found. It may not be correct, or this website may not be visible on the public internet.”

}

The error message is suitable to display to an end user.

Response time

The response time depends upon the website being added; Sitebeam will attempt to download the homeUrl page specified to check the site exists, and may also follow redirections if necessary to validate the homeUrl. This process usually takes a few seconds, but may be longer if the site is very slow to respond.

Was this article helpful? Contact our support team if you have a question.