Created
September 22, 2020 20:17
-
-
Save fotinakis/2d286f642bd1e5d15fc9fc8973259112 to your computer and use it in GitHub Desktop.
Percy Projects API example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Could also use the low-level ruby API client to make these calls: https://github.com/percy/percy-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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