REST API v1
Forge has a basic REST API currently, which we created to enable our CLI tool and to test automated deployments.
Authentication
First, you need to login your user (they need to have an existing account from Forge)
POST https://getforge.com/api/cli/login
curl -X POST "https://getforge.com/api/cli/login" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-d '{
"email": "YOUR_EMAIL",
"password": "YOUR_PASSWORD"
}'
Response Example:
`{"name":"USERNAME","token":"YOUR_TOKEN"}`
You’ll want to store the token somewhere safe for further requests to the user account.
Fetch Sites
You’ll probably want to retrieve a list of the Forge users sites at some stage, in order for User to select a site to perform some action.
You can do that like this…
GET https://getforge.com/api/cli/sites
curl -X GET -H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
"https://getforge.com/api/cli/sites?token=YOUR_TOKEN"
Deploy API
POST
Endpoint: api/v2/cli/deploy
Description: to deploy your Forge site and create a new version
Parameters: site_token
(string), archive
(.zip file as multi-part form data), domain
(string e.g. my-site.getforge.io)
Join the Discussion
Have questions about this topic or want to share your experience? Join our community discussion!
Visit Forum Discussion