Skip to content

Instantly share code, notes, and snippets.

@disconn3ct
Created November 6, 2024 19:06
Show Gist options
  • Save disconn3ct/c6354ddb4dd401c4e09a8b255d5cfad4 to your computer and use it in GitHub Desktop.
Save disconn3ct/c6354ddb4dd401c4e09a8b255d5cfad4 to your computer and use it in GitHub Desktop.
Mealie favorites sync
# Copy favorites from $ACCOUNT1 to $ACCOUNT2. No effort is made to prevent duplicates. It doesn't sync, it just copies.
set TOK='admin token here'
set ACCOUNT1='fff-fff-fff-fff-etc'
set ACCOUNT2='aaa-aaa-aaa-aaa-aaa'
set MEALIE='https://mealie.local'
# prints 'null' or error for each
curl -sSX 'GET' "$MEALIE/api/users/$ACCOUNT1/favorites" -H 'accept: application/json' -H"Authorization: Bearer $TOK" | \
jq -r '.ratings[].recipeId' | while read a ; do
curl -sSX 'POST' "$MEALIE/api/users/$ACCOUNT2/favorites/$a" -H'accept: application/json' -H"Authorization: Bearer $TOK" | jq .
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment