ai/at
ai/at
1
0

curl を追加

syui 2024-10-18 17:37:25 +00:00
commit 5e2cd776f5

56
curl.md Normal file

@ -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
```