Parchment Docs

Sharing

Sharing and invitations

Get all outgoing shares

GET
/sharing/outgoing

Response Body

curl -X GET "https://example.com/sharing/outgoing"
fetch("https://example.com/sharing/outgoing")
package main

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

func main() {
  url := "https://example.com/sharing/outgoing"

  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/sharing/outgoing"

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

print(response.text)
Empty

Get shares for a resource

GET
/sharing/outgoing/{resourceType}/{resourceId}

Path Parameters

resourceTypeRequiredstring
resourceIdRequiredstring
Minimum length: 1Maximum length: 128

Response Body

curl -X GET "https://example.com/sharing/outgoing/string/string"
fetch("https://example.com/sharing/outgoing/string/string")
package main

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

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

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

print(response.text)
Empty

Share a resource with a friend

Collections may be shared by their owner, or by an editor when the resharing policy allows it; other resource types only by their owner. The recipient must be an accepted friend (403 otherwise). Returns 409 when the resource is already shared with the recipient, and 502 when a cross-server share could not be delivered (nothing is stored).

POST
/sharing

Request Body

application/jsonRequired
recipientHandleRequiredstring
Maximum length: 320
resourceTypeRequiredstring
resourceIdRequiredstring
Minimum length: 1Maximum length: 128
encryptedDatastring
Maximum length: 65536
noncestring
Maximum length: 256
rolestring
federationSignaturestring
Maximum length: 256
federationNoncestring
Maximum length: 256
federationTimestampstring
Maximum length: 64

Response Body

curl -X POST "https://example.com/sharing/" \
  -H "Content-Type: application/json" \
  -d '{
    "recipientHandle": "string",
    "resourceType": "collection",
    "resourceId": "string",
    "encryptedData": "string",
    "nonce": "string",
    "role": "viewer",
    "federationSignature": "string",
    "federationNonce": "string",
    "federationTimestamp": "string"
  }'
const body = JSON.stringify({
  "recipientHandle": "string",
  "resourceType": "collection",
  "resourceId": "string",
  "encryptedData": "string",
  "nonce": "string",
  "role": "viewer",
  "federationSignature": "string",
  "federationNonce": "string",
  "federationTimestamp": "string"
})

fetch("https://example.com/sharing/", {
  body
})
package main

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

func main() {
  url := "https://example.com/sharing/"
  body := strings.NewReader(`{
    "recipientHandle": "string",
    "resourceType": "collection",
    "resourceId": "string",
    "encryptedData": "string",
    "nonce": "string",
    "role": "viewer",
    "federationSignature": "string",
    "federationNonce": "string",
    "federationTimestamp": "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/sharing/"
body = {
  "recipientHandle": "string",
  "resourceType": "collection",
  "resourceId": "string",
  "encryptedData": "string",
  "nonce": "string",
  "role": "viewer",
  "federationSignature": "string",
  "federationNonce": "string",
  "federationTimestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Revoke a share

POST
/sharing/{shareId}/revoke

Path Parameters

shareIdRequiredstring

Response Body

curl -X POST "https://example.com/sharing/string/revoke"
fetch("https://example.com/sharing/string/revoke")
package main

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

func main() {
  url := "https://example.com/sharing/string/revoke"

  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/sharing/string/revoke"

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

print(response.text)
Empty

Replace an existing share envelope (metadata refresh)

PUT
/sharing/envelope

Request Body

application/jsonRequired
recipientHandleRequiredstring
Maximum length: 320
resourceTypeRequiredstring
resourceIdRequiredstring
Minimum length: 1Maximum length: 128
encryptedDataRequiredstring
Maximum length: 65536
nonceRequiredstring
Maximum length: 256

Response Body

curl -X PUT "https://example.com/sharing/envelope" \
  -H "Content-Type: application/json" \
  -d '{
    "recipientHandle": "string",
    "resourceType": "collection",
    "resourceId": "string",
    "encryptedData": "string",
    "nonce": "string"
  }'
const body = JSON.stringify({
  "recipientHandle": "string",
  "resourceType": "collection",
  "resourceId": "string",
  "encryptedData": "string",
  "nonce": "string"
})

fetch("https://example.com/sharing/envelope", {
  body
})
package main

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

func main() {
  url := "https://example.com/sharing/envelope"
  body := strings.NewReader(`{
    "recipientHandle": "string",
    "resourceType": "collection",
    "resourceId": "string",
    "encryptedData": "string",
    "nonce": "string"
  }`)
  req, _ := http.NewRequest("PUT", 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/sharing/envelope"
body = {
  "recipientHandle": "string",
  "resourceType": "collection",
  "resourceId": "string",
  "encryptedData": "string",
  "nonce": "string"
}
response = requests.request("PUT", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Update an existing share's role

PATCH
/sharing/{shareId}

Request Body

application/jsonRequired
roleRequiredstring

Path Parameters

shareIdRequiredstring

Response Body

curl -X PATCH "https://example.com/sharing/string" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "viewer"
  }'
const body = JSON.stringify({
  "role": "viewer"
})

fetch("https://example.com/sharing/string", {
  body
})
package main

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

func main() {
  url := "https://example.com/sharing/string"
  body := strings.NewReader(`{
    "role": "viewer"
  }`)
  req, _ := http.NewRequest("PATCH", 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/sharing/string"
body = {
  "role": "viewer"
}
response = requests.request("PATCH", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Delete a share

DELETE
/sharing/{shareId}

Path Parameters

shareIdRequiredstring

Response Body

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

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

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

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

print(response.text)
Empty

Get all incoming shares

GET
/sharing/incoming

Response Body

curl -X GET "https://example.com/sharing/incoming"
fetch("https://example.com/sharing/incoming")
package main

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

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

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

print(response.text)
Empty

Get pending incoming shares

GET
/sharing/incoming/pending

Response Body

curl -X GET "https://example.com/sharing/incoming/pending"
fetch("https://example.com/sharing/incoming/pending")
package main

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

func main() {
  url := "https://example.com/sharing/incoming/pending"

  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/sharing/incoming/pending"

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

print(response.text)
Empty

Accept an incoming share

POST
/sharing/incoming/{shareId}/accept

Path Parameters

shareIdRequiredstring

Response Body

curl -X POST "https://example.com/sharing/incoming/string/accept"
fetch("https://example.com/sharing/incoming/string/accept")
package main

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

func main() {
  url := "https://example.com/sharing/incoming/string/accept"

  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/sharing/incoming/string/accept"

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

print(response.text)
Empty

Reject an incoming share

POST
/sharing/incoming/{shareId}/reject

Path Parameters

shareIdRequiredstring

Response Body

curl -X POST "https://example.com/sharing/incoming/string/reject"
fetch("https://example.com/sharing/incoming/string/reject")
package main

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

func main() {
  url := "https://example.com/sharing/incoming/string/reject"

  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/sharing/incoming/string/reject"

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

print(response.text)
Empty

Delete an incoming share

DELETE
/sharing/incoming/{shareId}

Path Parameters

shareIdRequiredstring

Response Body

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

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

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

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

print(response.text)
Empty