Skip to content

Instantly share code, notes, and snippets.

@fotinakis
Created September 22, 2020 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fotinakis/2d286f642bd1e5d15fc9fc8973259112 to your computer and use it in GitHub Desktop.
Save fotinakis/2d286f642bd1e5d15fc9fc8973259112 to your computer and use it in GitHub Desktop.
Percy Projects API example
# Could also use the low-level ruby API client to make these calls: https://github.com/percy/percy-client
# Must be private user token:
export PERCY_TOKEN=...
export ORG_SLUG=""
export PROJECT_NAME="Foo 123"
export PROJECT_SLUG="foo-123"
# Create a new project
curl "https://percy.io/api/v1/organizations/$ORG_SLUG/projects" \
-X POST \
-H "accept: application/vnd.api+json" \
-H "content-type: application/vnd.api+json" \
-H "Authorization: Token token=$PERCY_TOKEN" \
--data \
"{
\"data\": {
\"type\": \"projects\",
\"attributes\": {
\"name\": \"$PROJECT_NAME\",
\"slug\": \"$PROJECT_SLUG\"
}
}
}"
# Archive a project
curl "https://percy.io/api/v1/projects/$ORG_SLUG/$PROJECT_SLUG" \
-X PATCH \
-H "accept: application/vnd.api+json" \
-H "content-type: application/vnd.api+json" \
-H "Authorization: Token token=$PERCY_TOKEN" \
--data \
"{
\"data\": {
\"type\": \"projects\",
\"attributes\": {
\"is-enabled\": false
}
}
}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment