GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Cube Documentation home page
  • Demos
  • Changelog
  • Community
  • Get Started
  • Documentation
  • Admin
  • Embedding
  • Reference
  • Cube Core
  • Recipes
  • API
  • Authentication
  • POSTJSON query

This view

  • Original page
  • New address

GeezerVison is showing docs.cube.dev — Create user - Cube Documentation

Create user
curl --request POST \
  --url https://{tenant}.cubecloud.dev/api/v1/users \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "<string>",
  "username": "<string>",
  "defaultRoles": [
    "<string>"
  ],
  "externalId": "<string>",
  "firstName": "<string>",
  "isAdmin": true,
  "isExternal": null,
  "password": "<string>",
  "picture": null,
  "settings": {}
}
'
import requests

url = "https://{tenant}.cubecloud.dev/api/v1/users"

payload = {
    "email": "<string>",
    "username": "<string>",
    "defaultRoles": ["<string>"],
    "externalId": "<string>",
    "firstName": "<string>",
    "isAdmin": True,
    "isExternal": None,
    "password": "<string>",
    "picture": None,
    "settings": {}
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    email: '<string>',
    username: '<string>',
    defaultRoles: ['<string>'],
    externalId: '<string>',
    firstName: '<string>',
    isAdmin: true,
    isExternal: null,
    password: '<string>',
    picture: null,
    settings: {}
  })
};

fetch('https://{tenant}.cubecloud.dev/api/v1/users', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://{tenant}.cubecloud.dev/api/v1/users",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'email' => '<string>',
    'username' => '<string>',
    'defaultRoles' => [
        '<string>'
    ],
    'externalId' => '<string>',
    'firstName' => '<string>',
    'isAdmin' => true,
    'isExternal' => null,
    'password' => '<string>',
    'picture' => null,
    'settings' => [
        
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

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

func main() {

	url := "https://{tenant}.cubecloud.dev/api/v1/users"

	payload := strings.NewReader("{\n  \"email\": \"<string>\",\n  \"username\": \"<string>\",\n  \"defaultRoles\": [\n    \"<string>\"\n  ],\n  \"externalId\": \"<string>\",\n  \"firstName\": \"<string>\",\n  \"isAdmin\": true,\n  \"isExternal\": null,\n  \"password\": \"<string>\",\n  \"picture\": null,\n  \"settings\": {}\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{tenant}.cubecloud.dev/api/v1/users")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"<string>\",\n  \"username\": \"<string>\",\n  \"defaultRoles\": [\n    \"<string>\"\n  ],\n  \"externalId\": \"<string>\",\n  \"firstName\": \"<string>\",\n  \"isAdmin\": true,\n  \"isExternal\": null,\n  \"password\": \"<string>\",\n  \"picture\": null,\n  \"settings\": {}\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{tenant}.cubecloud.dev/api/v1/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"email\": \"<string>\",\n  \"username\": \"<string>\",\n  \"defaultRoles\": [\n    \"<string>\"\n  ],\n  \"externalId\": \"<string>\",\n  \"firstName\": \"<string>\",\n  \"isAdmin\": true,\n  \"isExternal\": null,\n  \"password\": \"<string>\",\n  \"picture\": null,\n  \"settings\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "email": "<string>",
  "id": 123,
  "isAdmin": true,
  "notifications": {},
  "username": "<string>",
  "activeRoleId": 123,
  "aliases": [
    {
      "createdAt": "<string>",
      "id": 123,
      "source": "ldap",
      "updatedAt": "<string>",
      "userId": 123,
      "username": "<string>"
    }
  ],
  "createdAt": "2023-12-25",
  "defaultRoles": [
    "<string>"
  ],
  "externalId": "<string>",
  "firstName": "<string>",
  "gitUser": "<string>",
  "impersonation": {
    "expiresAt": "2023-12-25",
    "impersonatedUser": null,
    "startedAt": "2023-12-25"
  },
  "isDeactivated": true,
  "lastLogin": "2023-12-25",
  "picture": "<string>",
  "samlId": "<string>",
  "settings": {
    "alternatingRowColors": true,
    "defaultDeploymentId": 123,
    "lastSeenChangelogId": 123,
    "locale": "<string>",
    "memory": {
      "generateFromChats": true
    },
    "sheets": {
      "autoRunQueryOnChange": true,
      "openExplorationFromSheet": true,
      "revealSheetOnOpen": true,
      "showAppliedFilters": true,
      "suppressDuplicateValues": true
    },
    "theme": "<string>",
    "timezone": "<string>"
  },
  "title": "<string>",
  "tosAccepted": {},
  "updatedAt": "2023-12-25",
  "userPolicies": [
    {
      "actions": [
        "All"
      ],
      "resourceType": "Global",
      "resources": [
        "<string>"
      ]
    }
  ]
}
POST
/
api
/
v1
/
users
Create user
curl --request POST \
  --url https://{tenant}.cubecloud.dev/api/v1/users \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "<string>",
  "username": "<string>",
  "defaultRoles": [
    "<string>"
  ],
  "externalId": "<string>",
  "firstName": "<string>",
  "isAdmin": true,
  "isExternal": null,
  "password": "<string>",
  "picture": null,
  "settings": {}
}
'
import requests

url = "https://{tenant}.cubecloud.dev/api/v1/users"

payload = {
    "email": "<string>",
    "username": "<string>",
    "defaultRoles": ["<string>"],
    "externalId": "<string>",
    "firstName": "<string>",
    "isAdmin": True,
    "isExternal": None,
    "password": "<string>",
    "picture": None,
    "settings": {}
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    email: '<string>',
    username: '<string>',
    defaultRoles: ['<string>'],
    externalId: '<string>',
    firstName: '<string>',
    isAdmin: true,
    isExternal: null,
    password: '<string>',
    picture: null,
    settings: {}
  })
};

fetch('https://{tenant}.cubecloud.dev/api/v1/users', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://{tenant}.cubecloud.dev/api/v1/users",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'email' => '<string>',
    'username' => '<string>',
    'defaultRoles' => [
        '<string>'
    ],
    'externalId' => '<string>',
    'firstName' => '<string>',
    'isAdmin' => true,
    'isExternal' => null,
    'password' => '<string>',
    'picture' => null,
    'settings' => [
        
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

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

func main() {

	url := "https://{tenant}.cubecloud.dev/api/v1/users"

	payload := strings.NewReader("{\n  \"email\": \"<string>\",\n  \"username\": \"<string>\",\n  \"defaultRoles\": [\n    \"<string>\"\n  ],\n  \"externalId\": \"<string>\",\n  \"firstName\": \"<string>\",\n  \"isAdmin\": true,\n  \"isExternal\": null,\n  \"password\": \"<string>\",\n  \"picture\": null,\n  \"settings\": {}\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{tenant}.cubecloud.dev/api/v1/users")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"<string>\",\n  \"username\": \"<string>\",\n  \"defaultRoles\": [\n    \"<string>\"\n  ],\n  \"externalId\": \"<string>\",\n  \"firstName\": \"<string>\",\n  \"isAdmin\": true,\n  \"isExternal\": null,\n  \"password\": \"<string>\",\n  \"picture\": null,\n  \"settings\": {}\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{tenant}.cubecloud.dev/api/v1/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"email\": \"<string>\",\n  \"username\": \"<string>\",\n  \"defaultRoles\": [\n    \"<string>\"\n  ],\n  \"externalId\": \"<string>\",\n  \"firstName\": \"<string>\",\n  \"isAdmin\": true,\n  \"isExternal\": null,\n  \"password\": \"<string>\",\n  \"picture\": null,\n  \"settings\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "email": "<string>",
  "id": 123,
  "isAdmin": true,
  "notifications": {},
  "username": "<string>",
  "activeRoleId": 123,
  "aliases": [
    {
      "createdAt": "<string>",
      "id": 123,
      "source": "ldap",
      "updatedAt": "<string>",
      "userId": 123,
      "username": "<string>"
    }
  ],
  "createdAt": "2023-12-25",
  "defaultRoles": [
    "<string>"
  ],
  "externalId": "<string>",
  "firstName": "<string>",
  "gitUser": "<string>",
  "impersonation": {
    "expiresAt": "2023-12-25",
    "impersonatedUser": null,
    "startedAt": "2023-12-25"
  },
  "isDeactivated": true,
  "lastLogin": "2023-12-25",
  "picture": "<string>",
  "samlId": "<string>",
  "settings": {
    "alternatingRowColors": true,
    "defaultDeploymentId": 123,
    "lastSeenChangelogId": 123,
    "locale": "<string>",
    "memory": {
      "generateFromChats": true
    },
    "sheets": {
      "autoRunQueryOnChange": true,
      "openExplorationFromSheet": true,
      "revealSheetOnOpen": true,
      "showAppliedFilters": true,
      "suppressDuplicateValues": true
    },
    "theme": "<string>",
    "timezone": "<string>"
  },
  "title": "<string>",
  "tosAccepted": {},
  "updatedAt": "2023-12-25",
  "userPolicies": [
    {
      "actions": [
        "All"
      ],
      "resourceType": "Global",
      "resources": [
        "<string>"
      ]
    }
  ]
}

Authorizations

​
Authorization
string
header
required

Token authentication. Send Authorization: Bearer <YOUR_TOKEN>.

Body

application/json

UserCreateInput

​
email
string
required
​
username
string
required
​
defaultRoles
string[] | null
​
externalId
string | null
​
firstName
string | null
​
isAdmin
boolean | null
​
isExternal
unknown
​
password
string | null
​
picture
unknown
​
settings
object | null

Response

200 - application/json
​
email
string
required
​
id
integer
required
​
isAdmin
boolean
required
​
notifications
object
required
​
username
string
required
​
activeRoleId
integer | null
​
aliases
object[] | null

Show child attributes

​
createdAt
string<date>string<date-time>
​
defaultRoles
string[] | null
​
externalId
string | null
​
firstName
string | null
​
gitUser
string | null
​
impersonation
object | null

Show child attributes

​
isDeactivated
boolean | null
​
lastLogin
string<date>string<date-time>
​
picture
string | null
​
samlId
string | null
​
settings
object | null

Show child attributes

​
title
string | null
​
tosAccepted
object | null
​
updatedAt
string<date>string<date-time>
​
userPolicies
object[] | null

The caller's effective resource policies: direct grants, organization-wide grants, and grants inherited from their groups. Only populated by GET /api/v1/users/me.

Show child attributes

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.