People
Avatars and covers
identity-image-service
The picture that stands for a profile, and the wide picture across the top of a profile or a post.
Set the avatar of a profile
/avatars/{node_id}/Replaces any there was, which is removed from storage. Answers with each size of the new one, at addresses good for a short while.
Who: Somebody signed in
Parameters
node_idintegerrequiredin pathThe id of the profile.
Body multipart/form-data
avatarfilerequiredThe picture: a JPEG or a PNG, of at most 10 MB.
Answers
- 201Createdmap of Image application/json
- 400
file_requiredwhen no file was sent,file_unreadablewhen it cannot be read as a pictureRefusal application/json - 401no token, or one that has expired
- 403it cannot have one, or the viewer may not change it
- 404there is no such profile or post, or the viewer may not see it
- 413
file_too_large: more than 10 MB, or too many pixelsRefusal application/json - 415
file_unsupported: not a JPEG or a PNGRefusal application/json
Request
curl -X POST "https://api.example.org/avatars/<node_id>/" \
-H "Authorization: Bearer $TOKEN" \
-F "avatar=@photo.jpg"
const form = new FormData();
form.append('avatar', file);
const response = await fetch('https://api.example.org/avatars/<node_id>/', {
method: 'POST',
headers: { Authorization: `Bearer ${token}` },
body: form,
});
const answer = await response.json();
import requests
response = requests.post(
"https://api.example.org/avatars/<node_id>/",
headers={"Authorization": f"Bearer {token}"},
data={},
files={"avatar": open("photo.jpg", "rb")},
)
answer = response.json()
Answer · 201
{
"key": {
"size": {
"height": 1,
"width": 1
},
"url": "https://example.org/"
}
}
Remove the avatar of a profile
/avatars/{node_id}/Who: Somebody signed in
Parameters
node_idintegerrequiredin pathThe id of the profile or the post.
Answers
- 200it has none now, whether or not it had one
- 400the request is not well formed, or a value in it is not one it may be
- 401no token, or one that has expired
- 403it cannot have one, or the viewer may not change it
- 404there is no such profile or post, or the viewer may not see it
Request
curl -X DELETE "https://api.example.org/avatars/<node_id>/" \
-H "Authorization: Bearer $TOKEN"
const response = await fetch('https://api.example.org/avatars/<node_id>/', {
method: 'DELETE',
headers: { Authorization: `Bearer ${token}` },
});
const answer = await response.json();
import requests
response = requests.delete(
"https://api.example.org/avatars/<node_id>/",
headers={"Authorization": f"Bearer {token}"},
)
answer = response.json()
A public profile's avatar, at an address that does not change
/avatars/{uuid}/{size}For other servers, which keep the address of a picture for weeks: a redirect to a freshly signed address in storage. Only what anybody may see is answered for; anything else, on a site for members included, is not found, in the same words as what does not exist.
Who: Anyone, signed in or not
Parameters
uuidstringrequiredin pathThe node's UUID, which other servers are given.sizestringrequiredin pathWhich size: for an avatarsmall,medium,largeorsquare; for a covermediumorlarge.
Answers
- 302the picture is at the address in Location
- 404there is no such picture that anybody may see
Request
curl "https://api.example.org/avatars/<uuid>/<size>"
const response = await fetch('https://api.example.org/avatars/<uuid>/<size>', {
method: 'GET',
});
const answer = await response.json();
import requests
response = requests.get(
"https://api.example.org/avatars/<uuid>/<size>",
)
answer = response.json()
Set the cover of a profile or a post
/covers/{node_id}/Replaces any there was, which is removed from storage. Answers with each size of the new one, at addresses good for a short while.
Who: Somebody signed in
Parameters
node_idintegerrequiredin pathThe id of the profile or the post.
Body multipart/form-data
coverfilerequiredThe picture: a JPEG or a PNG, of at most 10 MB.
Answers
- 201Createdmap of Image application/json
- 400
file_requiredwhen no file was sent,file_unreadablewhen it cannot be read as a pictureRefusal application/json - 401no token, or one that has expired
- 403it cannot have one, or the viewer may not change it
- 404there is no such profile or post, or the viewer may not see it
- 413
file_too_large: more than 10 MB, or too many pixelsRefusal application/json - 415
file_unsupported: not a JPEG or a PNGRefusal application/json
Request
curl -X POST "https://api.example.org/covers/<node_id>/" \
-H "Authorization: Bearer $TOKEN" \
-F "cover=@photo.jpg"
const form = new FormData();
form.append('cover', file);
const response = await fetch('https://api.example.org/covers/<node_id>/', {
method: 'POST',
headers: { Authorization: `Bearer ${token}` },
body: form,
});
const answer = await response.json();
import requests
response = requests.post(
"https://api.example.org/covers/<node_id>/",
headers={"Authorization": f"Bearer {token}"},
data={},
files={"cover": open("photo.jpg", "rb")},
)
answer = response.json()
Answer · 201
{
"key": {
"size": {
"height": 1,
"width": 1
},
"url": "https://example.org/"
}
}
Remove the cover of a profile or a post
/covers/{node_id}/Who: Somebody signed in
Parameters
node_idintegerrequiredin pathThe id of the profile or the post.
Answers
- 200it has none now, whether or not it had one
- 400the request is not well formed, or a value in it is not one it may be
- 401no token, or one that has expired
- 403it cannot have one, or the viewer may not change it
- 404there is no such profile or post, or the viewer may not see it
Request
curl -X DELETE "https://api.example.org/covers/<node_id>/" \
-H "Authorization: Bearer $TOKEN"
const response = await fetch('https://api.example.org/covers/<node_id>/', {
method: 'DELETE',
headers: { Authorization: `Bearer ${token}` },
});
const answer = await response.json();
import requests
response = requests.delete(
"https://api.example.org/covers/<node_id>/",
headers={"Authorization": f"Bearer {token}"},
)
answer = response.json()
A public profile's or post's cover, at an address that does not change
/covers/{uuid}/{size}For other servers, which keep the address of a picture for weeks: a redirect to a freshly signed address in storage. Only what anybody may see is answered for; anything else, on a site for members included, is not found, in the same words as what does not exist.
Who: Anyone, signed in or not
Parameters
uuidstringrequiredin pathThe node's UUID, which other servers are given.sizestringrequiredin pathWhich size: for an avatarsmall,medium,largeorsquare; for a covermediumorlarge.
Answers
- 302the picture is at the address in Location
- 404there is no such picture that anybody may see
Request
curl "https://api.example.org/covers/<uuid>/<size>"
const response = await fetch('https://api.example.org/covers/<uuid>/<size>', {
method: 'GET',
});
const answer = await response.json();
import requests
response = requests.get(
"https://api.example.org/covers/<uuid>/<size>",
)
answer = response.json()
Written by Claude, reviewed by Rastin Mehr · About this