DAIBOLA

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:sedamo:api:sedamo_api_method_account_create [2022/03/31 16:09] adminen:sedamo:api:sedamo_api_method_account_create [2024/03/11 21:43] (current) admin
Line 1: Line 1:
 +====== API: Account/Create ======
  
 +== Summary ==
 +Creates a new user account and the first API key. 
 +
 +== URL == 
 +https://api.sedamo.info/2.0/account/create
 +
 +== Authentication == 
 +Not required 
 +
 +== Parameters ==
 +  * [''familyname''] Family name
 +  * [''callingname''] Given name
 +  * [''title''] Addressing 
 +  * [''companyname''] Name of the company or general second address line
 +  * [''sedamo'' //sedamo// address code for further communication by mail (if e-mail fails)
 +  * [''email address''] E-mail address  \\ (<wrap tip>Above contact data are optional but highly recommended!</wrap>
 +  * [''username''] 8-chars DOS-style username (__exactly__ 8 chars!) Auto-generated if missing.
 +  * [''password''] Min. 8-char password. Complexity will __not__ be tested! Auto-generated if missing.
 +  * [''language''] ISO-2 code of the preferred language for further communication. EN (English) if missing.
 +  * ''format'' {JSON | XML} <wrap hi>the only mandatory parameter</wrap> 
 +
 +
 +== Response ==   
 +  * ''username''
 +  * ''password''
 +  * ''apikey''
 +
 +== Examples == 
 +
 +Register an user with name and full contact data: 
 +
 +<code PHP sedamo_api_method_account_create.php>
 +<?php
 +$data = array(
 +     'format' => "JSON",
 +     'title' => "Mr",
 +     'callingname' => "John",
 +     'familyname' => "Doe",
 +     'companyname' => "ACME Ltd",
 +     'sedamo' => "ABCDEFGH",
 +     'email' => "john@example.com",
 +     'username' => "john_doe",
 +     'password' => "", // password will be generated automatically
 +     'language' => "en"
 +);
 +
 +$url = "https://api.sedamo.info/2.0/account/create?" . http_build_query($data);
 +$json = file_get_contents($url);
 +$json_array = json_decode($json, true);  // 2nd parameter "true": returns result as an array 
 +var_dump($json_array);  // shows array 
 +</code>
 +
 +Minimalist registration: Only format given. Username, password (and API key) will be generated. E.g. for use within an app with automated registration in the background.
 +
 +<code PHP sedamo_api_method_account_create.php>
 +<?php
 +$url = "https://api.sedamo.info/2.0/account/create?format=JSON";
 +$json = file_get_contents($url);
 +$json_array = json_decode($json, true);  // 2nd parameter "true": returns result as an array 
 +var_dump($json_array);  // shows array 
 +</code>
 +
 +
 +
 +Example of a returned JSON object:
 +
 +<code JAVA>
 +{
 +    "status": "ok",
 +    "username": "john_doe",
 +    "password": "pass88Ax99b",
 +    "apikey": "Sample0123Sample0123Sample0123Sample0123"
 +}
 +</code>
 +
 +Example of a returned XML string:
 +
 +<code XML>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<sedamo>
 +          <status>ok</status>
 +          <username>john_doe</username>
 +          <password>pass88Ax99b</password>
 +          <apikey>Sample0123Sample0123Sample0123Sample0123</apikey>
 +</sedamo>
 +</code>
 +
 +== Possible error messages ==
 +  * username is not 8 chars long
 +  * username is already in use
 +  * e-mail invalid
 +  * //sedamo// address code invalid
 +
 +Sample error message: 
 +
 +<code JAVA>
 +{
 +    "status": "error",
 +    "message": "data invalid"
 +}
 +</code>
 +
 +[[en:sedamo:api:start|Back to sedamo API start page]]