createAccount
Create account endpoint
The API provides endpoints for clear and hashed password login and account creation, clear password usage is discouraged to improve user information in unsafe environments.
/auth/createAccount
Usage and SDK Samples
curl -X POST\
-H "x-access-token: [[apiKey]]"\
-H "Accept: application/json"\
-H "Content-Type: application/json"\
"http://192.168.1.116:8080/api/auth/createAccount"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountsApi;
import java.io.File;
import java.util.*;
public class AccountsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: ApiKeyAdminAuth
ApiKeyAuth ApiKeyAdminAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAdminAuth");
ApiKeyAdminAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAdminAuth.setApiKeyPrefix("Token");
AccountsApi apiInstance = new AccountsApi();
Auth_createAccount_body body = ; // Auth_createAccount_body | Object to login in to the local system, email is optional. password must be hashed (SHA-256)
try {
User result = apiInstance.createAccount(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AccountsApi#createAccount");
e.printStackTrace();
}
}
}
import io.swagger.client.api.AccountsApi;
public class AccountsApiExample {
public static void main(String[] args) {
AccountsApi apiInstance = new AccountsApi();
Auth_createAccount_body body = ; // Auth_createAccount_body | Object to login in to the local system, email is optional. password must be hashed (SHA-256)
try {
User result = apiInstance.createAccount(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AccountsApi#createAccount");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKeyAdminAuth)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"x-access-token"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"x-access-token"];
Auth_createAccount_body *body = ; // Object to login in to the local system, email is optional. password must be hashed (SHA-256)
AccountsApi *apiInstance = [[AccountsApi alloc] init];
// Create account endpoint
[apiInstance createAccountWith:body
completionHandler: ^(User output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var EnfyoDeviceApi = require('enfyo_device_api');
var defaultClient = EnfyoDeviceApi.ApiClient.instance;
// Configure API key authorization: ApiKeyAdminAuth
var ApiKeyAdminAuth = defaultClient.authentications['ApiKeyAdminAuth'];
ApiKeyAdminAuth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAdminAuth.apiKeyPrefix['x-access-token'] = "Token"
var api = new EnfyoDeviceApi.AccountsApi()
var body = ; // {{Auth_createAccount_body}} Object to login in to the local system, email is optional. password must be hashed (SHA-256)
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createAccount(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class createAccountExample
{
public void main()
{
// Configure API key authorization: ApiKeyAdminAuth
Configuration.Default.ApiKey.Add("x-access-token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("x-access-token", "Bearer");
var apiInstance = new AccountsApi();
var body = new Auth_createAccount_body(); // Auth_createAccount_body | Object to login in to the local system, email is optional. password must be hashed (SHA-256)
try
{
// Create account endpoint
User result = apiInstance.createAccount(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AccountsApi.createAccount: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAdminAuth
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-access-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-access-token', 'Bearer');
$api_instance = new Swagger\Client\ApiAccountsApi();
$body = ; // Auth_createAccount_body | Object to login in to the local system, email is optional. password must be hashed (SHA-256)
try {
$result = $api_instance->createAccount($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AccountsApi->createAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountsApi;
# Configure API key authorization: ApiKeyAdminAuth
$WWW::SwaggerClient::Configuration::api_key->{'x-access-token'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-access-token'} = "Bearer";
my $api_instance = WWW::SwaggerClient::AccountsApi->new();
my $body = WWW::SwaggerClient::Object::Auth_createAccount_body->new(); # Auth_createAccount_body | Object to login in to the local system, email is optional. password must be hashed (SHA-256)
eval {
my $result = $api_instance->createAccount(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AccountsApi->createAccount: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: ApiKeyAdminAuth
swagger_client.configuration.api_key['x-access-token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['x-access-token'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.AccountsApi()
body = # Auth_createAccount_body | Object to login in to the local system, email is optional. password must be hashed (SHA-256)
try:
# Create account endpoint
api_response = api_instance.create_account(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AccountsApi->createAccount: %s\n" % e)
Parameters
| Name | Description |
|---|---|
| body * |
Responses
Status: 200 - Sample response: Details about a user by ID
Status: 401 - Appears when the resource is protected and an access token is missing or invalid, as a result of a request missing a login headers or having invalid tokens. For JSON Web Token use the x-access-token header and for bearer authoriuzation use the standard authorization header. It is also possible to have this response ehen you are trying to request for a protected endpoint with a fast response bearer object, check documentation to verify the endpoint authorization requirements.
{"isOk":false,"message":"No token provided! (closed session)","message_es":"No se ha encontrado token de seguridad (sesion no iniciada)"}
{"isOk":false,"message":"Unauthorized!","message_es":"Acceso no Autorizado"}
{"isOk":false,"message":"No jwt token or bearer token"}
{"isOk":false,"message":"Bearer token Invalid"}
Status: 403 - Appears when the user has no privileges to run a specific action or while accessing restricted resources. Usually API endpoints are secured in 2 levels, User Scoped (AuthCode [100] = 1), and Administration rights. However specific system configuration endpoints are available only to factory maintenance personeel
{"isOk":false,"message":"Current user has not enought access rights to execute the request"}
Status: 500 - Unexpected error