Skip to content

Instantly share code, notes, and snippets.

@dims
Created November 13, 2024 20:00
Show Gist options
  • Save dims/ca85222a3d25eb1b3a4df8b7fafa51b5 to your computer and use it in GitHub Desktop.
Save dims/ca85222a3d25eb1b3a4df8b7fafa51b5 to your computer and use it in GitHub Desktop.
cat <<EOF | curl --location 'https://bsky.social/xrpc/com.atproto.server.createSession' --header 'Content-Type: application/json' -d @- | jq
{
  "identifier": "dims.dev",
  "password": "$BSKY_PASSWORD"
}
EOF

WORKS!

export MY_DID="did:plc:kfztyuziv2i44b5kpecth77y"
export MY_ACCESS_JWT="stick in accessJWT from above!"

curl --location 'https://bsky.social/xrpc/app.bsky.feed.getAuthorFeed?actor=dims.dev&limit=5' \
--header "Authorization: Bearer $MY_ACCESS_JWT" | jq

WORKS!

curl --location 'https://bsky.social/xrpc/app.bsky.graph.getLists?actor=dims.dev&limit=5' \
--header "Authorization: Bearer $MY_ACCESS_JWT" | jq

WORKS!

export MY_LIST_AT_URI="at://did:plc:kfztyuziv2i44b5kpecth77y/app.bsky.graph.list/3lau2wjkn3g2s"

curl --location "https://bsky.social/xrpc/app.bsky.graph.getList?list=$MY_LIST_AT_URI&limit=5" \
--header "Authorization: Bearer $MY_ACCESS_JWT" | jq

WORKS!

curl --location 'https://bsky.social/xrpc/app.bsky.actor.getProfile?actor=madhavjivrajani.bsky.social&limit=5' \
--header "Authorization: Bearer $MY_ACCESS_JWT" | jq

WORKS!


DATE=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")
cat <<EOF | curl --location 'https://bsky.social/xrpc/com.atproto.repo.createRecord' --header "Authorization: Bearer $MY_ACCESS_JWT" --header 'Content-Type: application/json' -d @- | jq
{
  "repo": "$MY_DID",
  "collection": "app.bsky.graph.listitem",
  "record": {
    "$type": "app.bsky.graph.listitem",
    "subject": "did:plc:nnhhbyo5prqipkd6t3cpp3l6",
    "list": "$MY_LIST_AT_URI",
    "createdAt": "$DATE"
  }
}
EOF

WORKS!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment