commit 5e2cd776f5ca3ff189b83d7877715b8eb20c5123 Author: syui Date: Fri Oct 18 17:37:25 2024 +0000 curl を追加 diff --git a/curl.md b/curl.md new file mode 100644 index 0000000..c80c47e --- /dev/null +++ b/curl.md @@ -0,0 +1,56 @@ +## version + +```sh +$ curl -sL syu.is/xrpc/_health +``` + +## did + +```sh +$ curl -sL "syu.is/xrpc/com.atproto.repo.describeRepo?repo=ai.syu.is" |jq -r .did +$ curl -sL plc.syu.is/did:plc:6qyecktefllvenje24fcxnie +``` + +## timeline + +```sh +$ curl -sL "syu.is/xrpc/com.atproto.repo.listRecords?repo=ai.syu.is&collection=app.bsky.feed.post&reverse=true&limit=1" +``` + +## invite code + +```sh +host=syu.is +admin_password=xxx +url=https://${host}/xrpc/com.atproto.server.createInviteCode +json="{\"useCount\":1}" +curl -X POST -u admin:${admin_password} -H "Content-Type: application/json" -d "$json" -sL $url +``` + +## create account + +```sh +host=syu.is +url=https://${host}/xrpc/com.atproto.server.createAccount +json="{\"email\": \"$email\", \"handle\": \"$handle\", \"password\": \"$password\"}" +curl -X POST -H "Content-Type: application/json" -d $json -sL $url +``` + +## login + +```sh +# session +host=syu.is +handle=ai.syu.is +pass=xxx +url=https://${host}/xrpc/com.atproto.server.createSession +curl -sL -X POST -H "Content-Type: application/json" -d "{\"identifier\":\"$handle\",\"password\":\"$pass\"}" $url + +# refresh +j=`!!` +token=`echo $j|jq -r .accessJwt` +refresh=`echo $j|jq -r .refreshJwt` +url=https://${host}/xrpc/com.atproto.server.refreshSession +curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $refresh" $url +``` +