Skip to content

Instantly share code, notes, and snippets.

@sedkis
Last active October 5, 2022 19:38
Show Gist options
  • Save sedkis/073be783049d5081413e8fdf98ee35ae to your computer and use it in GitHub Desktop.
Save sedkis/073be783049d5081413e8fdf98ee35ae to your computer and use it in GitHub Desktop.
Tyk Portal Bootstrap
TOKEN=1bfa65c26a66487157941e23c0ed5a6e # User API Key / Token
ORG=622ba349eaf9c2000181a507 # Dashboard Org ID
CNAME=tyk-portal.localhost:3000 # Portal CNAME you wish to set
DASH_URL=http://localhost:3000 # This can be an IP, a hostname, etc, but Port is necessary if non-standard
# Create Portal.
curl -X POST $DASH_URL/api/portal/configuration \
--header "Authorization: $TOKEN" \
--data "{}"
# Initialize Catalogue.
curl -X POST $DASH_URL/api/portal/catalogue \
--header "Authorization: $TOKEN" \
--data "{
\"org_id\": \"$ORG\"
}"
# Create Portal Home Page.
curl -X POST $DASH_URL/api/portal/pages \
--header "Authorization: $TOKEN" \
--data "{
\"is_homepage\": true,
\"template_name\": \"\",
\"title\": \"Developer Portal Home\",
\"slug\": \"/\",
\"fields\": {
\"JumboCTATitle\": \"Tyk Developer Portal\",
\"SubHeading\": \"Sub Header\",
\"JumboCTALink\": \"#cta\",
\"JumboCTALinkTitle\": \"Your awesome APIs, hosted with Tyk!\",
\"PanelOneContent\": \"Panel 1 content.\",
\"PanelOneLink\": \"#panel1\",
\"PanelOneLinkTitle\": \"Panel 1 Button\",
\"PanelOneTitle\": \"Panel 1 Title\",
\"PanelThereeContent\": \"\",
\"PanelThreeContent\": \"Panel 3 content.\",
\"PanelThreeLink\": \"#panel3\",
\"PanelThreeLinkTitle\": \"Panel 3 Button\",
\"PanelThreeTitle\": \"Panel 3 Title\",
\"PanelTwoContent\": \"Panel 2 content.\",
\"PanelTwoLink\": \"#panel2\",
\"PanelTwoLinkTitle\": \"Panel 2 Button\",
\"PanelTwoTitle\": \"Panel 2 Title\"
}
}"
# Set Protal CNAME.
curl -X PUT $DASH_URL/api/portal/cname \
--header "Authorization: $TOKEN" \
--data "{
\"cname\": \"$CNAME\"
}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment