Friends
Friends and social features
curl -X GET "https://example.com/friends/"fetch("https://example.com/friends/")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/friends/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/"
response = requests.request("GET", url)
print(response.text)curl -X GET "https://example.com/friends/invitations?direction=incoming"fetch("https://example.com/friends/invitations?direction=incoming")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/friends/invitations?direction=incoming"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/invitations?direction=incoming"
response = requests.request("GET", url)
print(response.text)Post Friends Invite
Send a friend invitation to a user (local or remote). Remote invitations need the nonce and timestamp the client signed into its v2 FRIEND_INVITE envelope.
Request Body
application/jsonRequiredhandleRequiredstring320signatureRequiredstringEd25519 signature over the v2 federation envelope
256noncestringEnvelope nonce the client signed
64timestampstringEnvelope timestamp the client signed
40Response Body
curl -X POST "https://example.com/friends/invite" \
-H "Content-Type: application/json" \
-d '{
"handle": "string",
"signature": "string",
"nonce": "string",
"timestamp": "string"
}'const body = JSON.stringify({
"handle": "string",
"signature": "string",
"nonce": "string",
"timestamp": "string"
})
fetch("https://example.com/friends/invite", {
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://example.com/friends/invite"
body := strings.NewReader(`{
"handle": "string",
"signature": "string",
"nonce": "string",
"timestamp": "string"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/invite"
body = {
"handle": "string",
"signature": "string",
"nonce": "string",
"timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)Post Friends Invitations By Id Accept
Accept a pending friend invitation. For a remote sender, the signed v2 FRIEND_ACCEPT envelope is forwarded to their server.
Request Body
application/jsonRequiredsignatureRequiredstringEd25519 signature over the v2 federation envelope
256noncestringEnvelope nonce the client signed
64timestampstringEnvelope timestamp the client signed
40Path Parameters
idRequiredstringResponse Body
curl -X POST "https://example.com/friends/invitations/string/accept" \
-H "Content-Type: application/json" \
-d '{
"signature": "string",
"nonce": "string",
"timestamp": "string"
}'const body = JSON.stringify({
"signature": "string",
"nonce": "string",
"timestamp": "string"
})
fetch("https://example.com/friends/invitations/string/accept", {
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://example.com/friends/invitations/string/accept"
body := strings.NewReader(`{
"signature": "string",
"nonce": "string",
"timestamp": "string"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/invitations/string/accept"
body = {
"signature": "string",
"nonce": "string",
"timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)Post Friends Invitations By Id Reject
Reject a pending friend invitation. For a remote sender, a signed v2 FRIEND_REJECT envelope is forwarded when provided.
Request Body
application/jsonRequiredsignaturestringEd25519 signature over the v2 federation envelope
256noncestringEnvelope nonce the client signed
64timestampstringEnvelope timestamp the client signed
40Path Parameters
idRequiredstringResponse Body
curl -X POST "https://example.com/friends/invitations/string/reject" \
-H "Content-Type: application/json" \
-d '{
"signature": "string",
"nonce": "string",
"timestamp": "string"
}'const body = JSON.stringify({
"signature": "string",
"nonce": "string",
"timestamp": "string"
})
fetch("https://example.com/friends/invitations/string/reject", {
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://example.com/friends/invitations/string/reject"
body := strings.NewReader(`{
"signature": "string",
"nonce": "string",
"timestamp": "string"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/invitations/string/reject"
body = {
"signature": "string",
"nonce": "string",
"timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)Delete Friends Invitations By Id
Cancel an outgoing friend invitation
Path Parameters
idRequiredstringResponse Body
curl -X DELETE "https://example.com/friends/invitations/string"fetch("https://example.com/friends/invitations/string")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/friends/invitations/string"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/invitations/string"
response = requests.request("DELETE", url)
print(response.text)Delete Friends By Handle
Remove a friend. For a remote friend, pass the signed v2 RELATIONSHIP_REVOKE envelope; without it, or if delivery fails, the revocation is queued for retry.
Path Parameters
handleRequiredstringQuery Parameters
revoke_signaturestring256revoke_noncestring64revoke_timestampstring40Response Body
curl -X DELETE "https://example.com/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=string"fetch("https://example.com/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=string")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=string"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/string?revoke_signature=string&revoke_nonce=string&revoke_timestamp=string"
response = requests.request("DELETE", url)
print(response.text)Get Friends Resolve By Handle
Resolve a handle to user info (local or remote)
Path Parameters
handleRequiredstring960Response Body
TypeScript Definitions
Use the response body type in TypeScript.
handleRequiredstringsigningKeyRequiredstringencryptionKeyRequiredstringinboxRequiredstringnamestringpicturestringTypeScript Definitions
Use the response body type in TypeScript.
messageRequiredstringTypeScript Definitions
Use the response body type in TypeScript.
messageRequiredstringTypeScript Definitions
Use the response body type in TypeScript.
messageRequiredstringcurl -X GET "https://example.com/friends/resolve/string"fetch("https://example.com/friends/resolve/string")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/friends/resolve/string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/resolve/string"
response = requests.request("GET", url)
print(response.text){
"handle": "string",
"signingKey": "string",
"encryptionKey": "string",
"inbox": "string",
"name": "string",
"picture": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}curl -X POST "https://example.com/friends/sync-keys"fetch("https://example.com/friends/sync-keys")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/friends/sync-keys"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/friends/sync-keys"
response = requests.request("POST", url)
print(response.text)