Parchment Docs

Friends

Friends and social features

Get Friends

Get list of accepted friends

GET
/friends

Response Body

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)
Empty

Get Friends Invitations

Get pending friend invitations

GET
/friends/invitations

Query Parameters

directionstring

Response Body

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)
Empty

Post Friends Invite

Send a friend invitation to a user (local or remote)

POST
/friends/invite

Request Body

application/jsonRequired
handleRequiredstring
signatureRequiredstring

Response Body

curl -X POST "https://example.com/friends/invite" \
  -H "Content-Type: application/json" \
  -d '{
    "handle": "string",
    "signature": "string"
  }'
const body = JSON.stringify({
  "handle": "string",
  "signature": "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"
  }`)
  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"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Post Friends Invitations By Id Accept

Accept a pending friend invitation

POST
/friends/invitations/{id}/accept

Request Body

application/jsonRequired
signatureRequiredstring

Path Parameters

idRequiredstring

Response Body

curl -X POST "https://example.com/friends/invitations/string/accept" \
  -H "Content-Type: application/json" \
  -d '{
    "signature": "string"
  }'
const body = JSON.stringify({
  "signature": "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"
  }`)
  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"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Post Friends Invitations By Id Reject

Reject a pending friend invitation

POST
/friends/invitations/{id}/reject

Request Body

application/jsonRequired
signaturestring

Path Parameters

idRequiredstring

Response Body

curl -X POST "https://example.com/friends/invitations/string/reject" \
  -H "Content-Type: application/json" \
  -d '{
    "signature": "string"
  }'
const body = JSON.stringify({
  "signature": "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"
  }`)
  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"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Delete Friends Invitations By Id

Cancel an outgoing friend invitation

DELETE
/friends/invitations/{id}

Path Parameters

idRequiredstring

Response 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)
Empty

Delete Friends By Handle

Remove a friend

DELETE
/friends/{handle}

Path Parameters

handleRequiredstring

Response Body

curl -X DELETE "https://example.com/friends/string"
fetch("https://example.com/friends/string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/friends/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"

response = requests.request("DELETE", url)

print(response.text)
Empty

Get Friends Resolve By Handle

Resolve a handle to user info (local or remote)

GET
/friends/resolve/{handle}

Path Parameters

handleRequiredstring

Response Body

curl -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)
Empty

Post Friends Sync keys

Sync friend public keys and profile from their servers

POST
/friends/sync-keys

Response Body

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)
Empty