[openstreetmap/openstreetmap-website] Export of messages from internal message system (#3106)

mmd notifications at github.com
Fri Aug 2 18:51:10 UTC 2024


My proposal would be to use some shell script as follows:

```
#!/bin/bash

export TOKEN="..."
echo "Fetching outbox index"
curl --silent -H "Authorization: Bearer $TOKEN" https://api.openstreetmap.org/api/0.6/user/messages/outbox.json > outbox.json

export OUTBOX_IDS=$(jq '.messages[].id' outbox.json)
echo "Total messages: $(echo "$OUTBOX_IDS" | wc --lines)"

for a in $INBOX_IDS 
do
  echo "Exporting inbox message $a..."
  curl --silent -H "Authorization: Bearer $TOKEN" https://api.openstreetmap.org/api/0.6/user/messages/"$a".json > inbox_"$a".json
done

echo "Fetching inbox index"
curl --silent -H "Authorization: Bearer $TOKEN" https://api.openstreetmap.org/api/0.6/user/messages/inbox.json > inbox.json

export INBOX_IDS=$(jq '.messages[].id' inbox.json)
echo "Total messages: $(echo "$INBOX_IDS" | wc --lines)"

for a in $OUTBOX_IDS 
do
  echo "Exporting outbox message $a..."
  curl --silent -H "Authorization: Bearer $TOKEN" https://api.openstreetmap.org/api/0.6/user/messages/"$a".json > outbox_"$a".json
done
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/3106#issuecomment-2265957352
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/3106/2265957352 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240802/ba10ad61/attachment-0001.htm>


More information about the rails-dev mailing list