With Copilot
Acquia Copilot is a conversational AI connected into our product documentation and knowledge base. Ask Copilot about product features, technical details, troubleshooting and how to get started with Acquia products.
Sign in to use Acquia Copilot
The Factory API enables you to interact with Site Factory from the command line by scripting often repeated events.
For information about obtaining your API key or basic usage of the Factory API, see Using the Site Factory API.
The following example scripts were created by Site Factory users, and you can adapt them to meet your needs:
The following script allows you to begin the website staging process to a specified environment, after modifying the script to fit your environment’s needs:
#!/usr/bin/env bash
## Synchronizing production and development environments on
## Site Factory
## Origin: http://docs.acquia.com/site-factory/extend/api/examples
#!/bin/sh
# Update the next two lines to provide your ACSF username and API key
user="[your_ACSF_username]"
api_key="[your_API_key]"
# Machine name of target environment
to_acsf_environment="dev"
# Update the next line to provide a comma-separated list of site IDs
sites="[123,456]"
# Update the next line to provide your Site Factory domain name
curl 'https://www.[domain].acsitefactory.com/api/v1/stage' \
-X POST -H 'Content-Type: application/json' \
-d "{"to_env": "${to_acsf_environment}", "sites": [ ${sites} ], "detailed_status": true}" \
-v -u $user:$api_keyThe api-dbupdate.txt script begins a code and database update for the specified environment.
The Site Factory API only returns data for 100 websites at a time. The get_all_sites function in the acsf-backups.php script provides a method for retrieving data for all websites.
The backup function in this example script provides a method for creating database backups for multiple websites hosted by Site Factory, and a backup_del function to iterate through existing backups, deleting all backups older than a specified age.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.