Skip to content

Instantly share code, notes, and snippets.

@onokatio
Created September 24, 2018 08:03
Show Gist options
  • Save onokatio/96570ec64e5a20e90c45bdacb64423c1 to your computer and use it in GitHub Desktop.
Save onokatio/96570ec64e5a20e90c45bdacb64423c1 to your computer and use it in GitHub Desktop.
#!/bin/bash
APIKEY=${APIKEY:-"NONE"}
DOMAIN=${DOMAIN:-"NONE"}
VERSION=${VERSION:-"v2"}
command_HTTP=${command_HTTP:-"curl -Ss"}
if [[ "${APIKEY}" == "NONE" ]];then
echo "\$APIKEY is empty. Please make sure to set it."
exit
fi
if [[ "${DOMAIN}" == "NONE" ]];then
echo "\$DOMAIN is empty. Please make sure to set it."
exit
fi
# String(JSON) getHTTP(Strings endpoint,Strings args);
function getHTTP(){
${command_HTTP} "${DOMAIN}/api/${VERSION}/$1?apiKey=${APIKEY}&$2"
}
# Strings(JSON) getProjects(void)
function getProjects(){
echo $( getHTTP "projects" )
}
# Strings(JSON) getIssues(int projectID)
function getIssues(){
echo $( getHTTP "issues" "projectId=$1" )
}
pid=$(getProjects | jq .[0].id)
getIssues $pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment