PUT /users/:uuid/status
Updates the availability and/or a users' custom status.
Required Parameters
Parameter | Type | Description |
---|---|---|
uuid | string | The user uuid |
Optional Parameters
Parameter | Type | Description |
---|---|---|
available | boolean | User is available (true ) or away (false ) |
custom_status_uuid | string | The uuid of a custom status |
info
You can update only the user's availability, only their custom status, or both in the same request.
caution
Ensure that a custom_status
already exists in your account before passing them.
Similarly, for the user's uuid
, use a valid one associated to a user in your account.
Example Request
- cURL
- Node
- Ruby
- Go
- PHP
- Python
- C#
- Java
- Rust
curl -X PUT "https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"available": false,
"custom_status_uuid": "0d6041a2-8b88-49ec-a99b-a88a078a16c1"
}'
import axios from 'axios';
const response = await axios.put(
'https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status',
// '{\n "available": false,\n "custom_status_uuid": "0d6041a2-8b88-49ec-a99b-a88a078a16c1"\n }',
{
'available': false,
'custom_status_uuid': '0d6041a2-8b88-49ec-a99b-a88a078a16c1'
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status')
req = Net::HTTP::Put.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"available\": false,\n \"custom_status_uuid\": \"0d6041a2-8b88-49ec-a99b-a88a078a16c1\"\n }"
req.body = {
'available' => false,
'custom_status_uuid' => '0d6041a2-8b88-49ec-a99b-a88a078a16c1'
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"available": false,
"custom_status_uuid": "0d6041a2-8b88-49ec-a99b-a88a078a16c1"
}`)
req, err := http.NewRequest("PUT", "https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"available\": false,\n \"custom_status_uuid\": \"0d6041a2-8b88-49ec-a99b-a88a078a16c1\"\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'available': False,
'custom_status_uuid': '0d6041a2-8b88-49ec-a99b-a88a078a16c1',
}
response = requests.put(
'https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status',
headers=headers,
json=json_data,
)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "available": false,\n "custom_status_uuid": "0d6041a2-8b88-49ec-a99b-a88a078a16c1"\n }'
#response = requests.put('https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status', headers=headers, data=data)
using System.Net.Http;
using System.Net.Http.Headers;
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Put, "https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status");
request.Headers.Add("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM");
request.Content = new StringContent("{\n \"available\": false,\n \"custom_status_uuid\": \"0d6041a2-8b88-49ec-a99b-a88a078a16c1\"\n }");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("PUT");
httpConn.setRequestProperty("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{\n \"available\": false,\n \"custom_status_uuid\": \"0d6041a2-8b88-49ec-a99b-a88a078a16c1\"\n }");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
extern crate reqwest;
use reqwest::header;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut headers = header::HeaderMap::new();
headers.insert("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM".parse().unwrap());
headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::blocking::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.build()
.unwrap();
let res = client.put("https://api.callbell.eu/v1/users/414a6d692bd645ed803f2e7ce360d4c8/status")
.headers(headers)
.body(r#"
{
"available": false,
"custom_status_uuid": "0d6041a2-8b88-49ec-a99b-a88a078a16c1"
}
"#
)
.send()?
.text()?;
println!("{}", res);
Ok(())
}
Response
Parameter | Type | Description |
---|---|---|
user_status | string{} | The user status that has been updated |
custom_status | string{} | The custom status of the user |
id | string | The custom status' id |
name | string | The custom status' name |
last_updated_at | string | The last update date of the user's custom status |
appearance | string{} | The user's appearance |
available | boolean | The user's availability |
appearance | string{} | The user's appearance |
last_updated_at | string | The user appearance's last update date |
Example Response
response.json
{
"user_status": {
"custom_status": {
"id": "0d6041a2-8b88-49ec-a99b-a88a078a16c1",
"name": "Vacationing",
"last_updated_at": "2024-11-22T21:29:43.311+01:00"
},
"appearance": {
"available": false,
"last_updated_at": "2024-11-26T20:14:40.649+01:00"
}
}
}