Created
June 7, 2022 02:36
-
-
Save carwin/7d38e879ec19b4ddb4c50291e574953c to your computer and use it in GitHub Desktop.
Examples of un-encoding URL strings in a Snyk REST API response
This file contains hidden or 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
#!/usr/bin/env bash | |
# This will transform all the percent encoded characters in the | |
# API response back into their ASCII counterparts. | |
# See - (https://en.wikipedia.org/wiki/Percent-encoding) | |
(curl -i "https://api.snyk.io/v3/orgs/<ORG_ID>/issues?project_id=<PROJECT_ID>&type=code&version=2022-04-06~experimental&limit=10" \ | |
-H "Accept: application/vnd.api+json" \ | |
-H "Authorization: Token REDACTED") \ | |
| awk -niord '{printf RT?$0chr("0x"substr(RT,2)):$0}' RS=%.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment