Skip to content

Instantly share code, notes, and snippets.

@tokland
Created November 16, 2022 09:22
Show Gist options
  • Save tokland/ae3150365abaee175f34cae1095e95b0 to your computer and use it in GitHub Desktop.
Save tokland/ae3150365abaee175f34cae1095e95b0 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e -u -o pipefail
run() {
for version in "$@"; do
local url="https://play.dhis2.org/$version/api"
echo "# $version"
curl -sS -u 'admin:district' -L "$url/events.json?event=QsAhMiZtnl2&fields=*" | jq >events.json
curl -H "Content-Type: application/json" -sS -u 'admin:district' "$url/events" \
-d"@events.json" -X POST | jq '.response.importSummaries[] | {stats: .importCount, description: .description}' -c
done
}
run "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment