Skip to content

Instantly share code, notes, and snippets.

@carwin
Created June 7, 2022 02:36
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 carwin/7d38e879ec19b4ddb4c50291e574953c to your computer and use it in GitHub Desktop.
Save carwin/7d38e879ec19b4ddb4c50291e574953c to your computer and use it in GitHub Desktop.
Examples of un-encoding URL strings in a Snyk REST API response
#!/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