curl -X PUT "https://api.playground.try.be/users/00000000-0000-0000-0000-000000000000" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"email": "guest@example.com",
"first_name": "Dan",
"last_name": "Smith",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"cashier_id": "00000000-0000-0000-0000-000000000000",
"site_ids": [
"00000000-0000-0000-0000-000000000000"
]
}'
const response = await fetch('https://api.playground.try.be/users/00000000-0000-0000-0000-000000000000', {
method: 'PUT',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
"email": "guest@example.com",
"first_name": "Dan",
"last_name": "Smith",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"cashier_id": "00000000-0000-0000-0000-000000000000",
"site_ids": [
"00000000-0000-0000-0000-000000000000"
]
}),
})
if (!response.ok) {
throw new Error(`Trybe API ${response.status}: ${await response.text()}`)
}
const data = await response.json()
import httpx
response = httpx.put(
"https://api.playground.try.be/users/00000000-0000-0000-0000-000000000000",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"email": "guest@example.com",
"first_name": "Dan",
"last_name": "Smith",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"cashier_id": "00000000-0000-0000-0000-000000000000",
"site_ids": [
"00000000-0000-0000-0000-000000000000"
]
},
)
response.raise_for_status()
data = response.json()
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://api.playground.try.be/users/00000000-0000-0000-0000-000000000000', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'email' => 'guest@example.com',
'first_name' => 'Dan',
'last_name' => 'Smith',
'organisation_id' => '00000000-0000-0000-0000-000000000000',
'cashier_id' => '00000000-0000-0000-0000-000000000000',
'site_ids' => [
'00000000-0000-0000-0000-000000000000'
]
],
]);
$data = json_decode($response->getBody(), true);
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]interface{}{
"email": "guest@example.com",
"first_name": "Dan",
"last_name": "Smith",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"cashier_id": "00000000-0000-0000-0000-000000000000",
"site_ids": []interface{}{
"00000000-0000-0000-0000-000000000000",
},
})
req, _ := http.NewRequest("PUT", "https://api.playground.try.be/users/00000000-0000-0000-0000-000000000000", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
}
{
"data": {
"id": "5e1e3f6c-2a44-4f6e-8c61-9c1f7d2e1c11",
"name": "John Smith",
"given_name": "John",
"family_name": "Smith",
"email": "john.smith@example.com",
"email_verified": true,
"organisation_id": "9c3ad1e2-2d1b-4f4f-9e07-6d6c4f3a2b1a",
"organisation_name": "Trybe Spa Group",
"site_ids": [
"00000000-0000-0000-0000-000000000000"
],
"avatar_id": "7d2a1f9c-5b3e-4d8c-9f0a-2c4e6f8b1d3a",
"avatar": {
"id": "00000000-0000-0000-0000-000000000000",
"file_name": "super-cool-photo.jpg",
"mime_type": "image/jpeg",
"original_url": "https://example.com/media/super-cool-photo.jpg",
"size": 84256,
"url": "https://example.com/media/super-cool-photo-thumbnail@2x.jpg"
},
"cashier_id": "cashier-042",
"status": "active",
"2fa_enabled": true,
"twofa_enabled": true,
"created_at": "2020-01-01T00:00:00.000Z",
"updated_at": "2020-01-01T00:00:00.000Z",
"managed_by_sso": true,
"whitelisted_internal_user": false
}
}
{
"message": "Unauthenticated"
}
{
"message": "This action is unauthorized."
}
{
"message": "The requested resource could not be found"
}
{
"errors": {},
"message": "The request didn't pass validation"
}