Using the Site Factory REST API

Acquia Cloud Site Factory includes a REST API that you can use to create and manage your hosted websites and to obtain the status of your Site Factory interface's jobs.

Obtaining your API key

Each of the Site Factory API calls requires you to enter your Site Factory username and API key to either complete the action or to return results. To obtain your API key, complete the following steps:

  1. Sign in to your Site Factory interface using an account with the platform admin role.
  2. In the admin menu, click the Hello, [username] link, where [username] is your account name.
  3. Click the API key tab.

Acquia Cloud Site Factory displays your API key. Because the key is required for use by the different Site Factory API calls, save the key to a text file or some other secure location.

Using the REST API

Similar to many other APIs, the Site Factory API uses standard HTTP methods to communicate with the service, including GET, PUT, and POST. You can view the list of available Site Factory API calls on your instance of Acquia Cloud Site Factory, along with specific parameters and examples of their use, at the following URL (where [site_URL] is the URL of your Site Factory interface):

https://[site_URL]/api/v1

You can also review complete documentation for all of the available Site Factory API methods by visiting the Site Factory API Reference.

Sample Site Factory API methods

Here are some examples of the methods provided in the Site Factory API:

REST API call Description
groups Obtain a group listing, or create a group
ping Determine if the API is responding
sites Create, duplicate, or manage backups for a website
stage Start the staging process
status Obtain or modify the status of the Site Factory
theme Send or process theme modifications
users Create, modify, list, or delete user accounts in the Site Factory

For complete documentation, see the Site Factory API Reference.

Testing your connection

When you first start using the Site Factory API, we encourage you to use the ping call to test your connection to the API. To do this, complete the following steps:

  1. Obtain your user account's API key from the Site Factory interface.
  2. Open a command prompt, and then enter the following command:

    curl 'https://[site_URL]/api/v1/ping' -u [user_name]:[api_key]

    where:

    • [site URL] is the URL of your Site Factory interface
    • [user_name] is your Site Factory interface user account name
    • [api_key] is your user account's API key from the Site Factory interface
  3. Verify that the API call returns results similar to the following:

    {"message":"pong","server_time":"2014-11-18T13:44:57+00:00"}

Using the REST API with staging environments

Because staging environments do not have access to the SSL certificates that are made available to production environments, you must append the -k command line switch to your curl command when you make calls to a staging environment using the Site Factory API.

For example, using the ping call on a staging environment would require a command similar to the following:

curl 'https://[site_URL]/api/v1/ping' -u [user_name]:[api_key] -k

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Contact supportStill need assistance? Contact Acquia Support