sitestudio / otest

Test SKGithubTest app
MIT License
0 stars 0 forks source link

App Cat Groups - Implement #295

Open sitestudio opened 1 month ago

sitestudio commented 1 month ago

Provide a list of App Catalog groups

skgithubtest[bot] commented 1 month ago

This script below will fetch and output the list of App Catalog groups. The script is a simple curl command, which targets the Mockaco plugin that provides the necessary information about the App Catalog groups.

Here is the bash script:

#!/bin/bash

# Creating a function to call each API and output group data
get_group_data() {
  groupCode=$1
  groupName=$(curl -s -X POST https://<api_endpoint>/get_app_catalog_group_name -d '{ "groupCode":"'$groupCode'" }' | jq -r '.response')
  echo "Group Code: $groupCode"
  echo "Group Name: $groupName"
}

# List of group codes to fetch
groupCodes=("CONSENT" "ATT" "BOOK" "DOETEST" "LIB" "SMS" "STUDENT" "STUDENTPUB")

# Iterate over the group codes and fetch the group data
for groupCode in ${groupCodes[@]}; do
  get_group_data $groupCode
  echo "--------"
done

Please replace <api_endpoint> with the actual endpoint of the Mockaco Plugin.

To run the script, save it to a file (for example, getGroups.sh), give it execute permissions with chmod +x getGroups.sh, and then run it with ./getGroups.sh.

Note: The script assumes that jq is installed on your machine for parsing JSON data. If it is not, you can install it by running sudo apt-get install jq on Ubuntu or brew install jq on MacOS.