Create user.
curl --request POST \
--url https://lab.trustos.telefonicatech.com/id/v2/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@john.com",
"company": "Company Name",
"password": "password",
"credits": 10000,
"networks": [
10004
]
}
'import requests
url = "https://lab.trustos.telefonicatech.com/id/v2/users"
payload = {
"email": "john@john.com",
"company": "Company Name",
"password": "password",
"credits": 10000,
"networks": [10004]
}
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: 'john@john.com',
company: 'Company Name',
password: 'password',
credits: 10000,
networks: [10004]
})
};
fetch('https://lab.trustos.telefonicatech.com/id/v2/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://lab.trustos.telefonicatech.com/id/v2/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' => 'john@john.com',
'company' => 'Company Name',
'password' => 'password',
'credits' => 10000,
'networks' => [
10004
]
]),
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://lab.trustos.telefonicatech.com/id/v2/users"
payload := strings.NewReader("{\n \"email\": \"john@john.com\",\n \"company\": \"Company Name\",\n \"password\": \"password\",\n \"credits\": 10000,\n \"networks\": [\n 10004\n ]\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://lab.trustos.telefonicatech.com/id/v2/users")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@john.com\",\n \"company\": \"Company Name\",\n \"password\": \"password\",\n \"credits\": 10000,\n \"networks\": [\n 10004\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/id/v2/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\": \"john@john.com\",\n \"company\": \"Company Name\",\n \"password\": \"password\",\n \"credits\": 10000,\n \"networks\": [\n 10004\n ]\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 201,
"message": "User created",
"data": {
"username": "did:user:<id>",
"address": "0x1234"
}
}{
"statusCode": 400,
"type": "Validation Error",
"message": "Request parameters are wrong, check requirements",
"errors": [
{
"field": "",
"error": ""
}
]
}{
"statusCode": 401,
"type": "Authentication Error",
"message": "Token is not provided"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}Identity
Create User
Creates a new user.
POST
/
users
Create user.
curl --request POST \
--url https://lab.trustos.telefonicatech.com/id/v2/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@john.com",
"company": "Company Name",
"password": "password",
"credits": 10000,
"networks": [
10004
]
}
'import requests
url = "https://lab.trustos.telefonicatech.com/id/v2/users"
payload = {
"email": "john@john.com",
"company": "Company Name",
"password": "password",
"credits": 10000,
"networks": [10004]
}
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: 'john@john.com',
company: 'Company Name',
password: 'password',
credits: 10000,
networks: [10004]
})
};
fetch('https://lab.trustos.telefonicatech.com/id/v2/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://lab.trustos.telefonicatech.com/id/v2/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' => 'john@john.com',
'company' => 'Company Name',
'password' => 'password',
'credits' => 10000,
'networks' => [
10004
]
]),
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://lab.trustos.telefonicatech.com/id/v2/users"
payload := strings.NewReader("{\n \"email\": \"john@john.com\",\n \"company\": \"Company Name\",\n \"password\": \"password\",\n \"credits\": 10000,\n \"networks\": [\n 10004\n ]\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://lab.trustos.telefonicatech.com/id/v2/users")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@john.com\",\n \"company\": \"Company Name\",\n \"password\": \"password\",\n \"credits\": 10000,\n \"networks\": [\n 10004\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/id/v2/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\": \"john@john.com\",\n \"company\": \"Company Name\",\n \"password\": \"password\",\n \"credits\": 10000,\n \"networks\": [\n 10004\n ]\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 201,
"message": "User created",
"data": {
"username": "did:user:<id>",
"address": "0x1234"
}
}{
"statusCode": 400,
"type": "Validation Error",
"message": "Request parameters are wrong, check requirements",
"errors": [
{
"field": "",
"error": ""
}
]
}{
"statusCode": 401,
"type": "Authentication Error",
"message": "Token is not provided"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Data needed for the creation of a user inside TrustOS.
Was this page helpful?
⌘I