Create a Project with CloudFlow API
This doc will walk you through creating a CloudFlow Project with the CloudFlow application programming interface (API).
Be sure to create an API Token for the steps in this guide that require the CLOUDFLOW_API_TOKEN
.
Get Your Account ID
In addition to your token you will also need to your CLOUDFLOW_ACCOUNT_ID
to identify which account the Environment will be added to. Your Account ID can easily be seen in the browser's URL for the CloudFlow Console, as in:
https://console.section.io/overview/account/CLOUDFLOW_ACCOUNT_ID
.
Alternatively, use the Account API Call to get your Account's ID.
CLOUDFLOW_API_TOKEN="" # Create/retrieve from https://console.section.io/configure/user/tokens
curl \
--header "Accept: application/json" \
--header "section-token: $CLOUDFLOW_API_TOKEN" \
-X GET "https://console.section.io/api/v1/account"
You will receive a JSON response with an "id"
, this is your CLOUDFLOW_ACCOUNT_ID
.
Create an Environment
Using the Create Application API call CloudFlow will automatically provision your Project.
You will send a JSON object with the following fields:
- The hostname This will be the domain name used to initialize the managed ingress controller if you opt-in to using it. This field will also act as the name of your environment. The hostname is limited to alphanumeric characters and the hyphen, and separated by dots.
- The origin field is optional and not applicable to environments created for KEI
- The stackName field must be set to kei
The curl command below sends the needed JSON object, embedded right into the command line.
CLOUDFLOW_API_TOKEN="" # See section above
CLOUDFLOW_ACCOUNT_ID="" # See section above
YOUR_ENVIRONMENT_HOSTNAME="example.domain.io"
curl \
--header "section-token: $CLOUDFLOW_API_TOKEN" \
--header "Content-Type: application/json" \
--header "Accept: application/json" -d "{ \
\"hostname\": \"$YOUR_ENVIRONMENT_HOSTNAME\", \
\"origin\": \"blank\", \
\"stackName\": \"kei\" \
}" "https://console.section.io/api/v1/account/$CLOUDFLOW_ACCOUNT_ID/application/create"
Any empty JSON response means that the command did not work.
You will now see a Project in the CloudFlow Console.