Craig Brass Systems Forum: CreateUser, UpdatePassword, DeleteUser - Craig Brass Systems Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CreateUser, UpdatePassword, DeleteUser how to create/update a user ?

#1
User is offline   maddogx 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 13-September 09
Hello,
your API looks great nice and clean,
I am search for an option to create(register) a user, update his password and delete a user.
I want to control the user credentials from my system, once a user created in my system it will automatically created with same l/p in kayako.
I found some example which does it via swift.php inclusion, then I found your API which itroduced much more features,one of them is 'updateEmailAddress' which answers one of my needs to change user's email.

Say I can use this script to register a new user:
<?
define("SWIFT_AREA", 40);

require_once ("./swift.php");

//$_REQUEST[email] = "johndoe@domain.com";
//$_REQUEST[password] = "password";
//$_REQUEST["fullname"] = "John Doe";

$enabled = 1; // user is validated
$_SWIFT["tgroup"]["regusergroupid"] = 2; // registered users group is 2 by default
$_SWIFT["languageid"] = 1; // default language is 1

$userid = insertUser($enabled, $_REQUEST["email"], $_REQUEST["password"], $_SWIFT["tgroup"]["regusergroupid"], LOGINAPI_DEFAULT, 0, $_REQUEST["fullname"], $_SWIFT["languageid"], 0, false, 1);
                
if (!$userid)
{
    $error = "Email address already exists";
} else {
    updateCustomFields(CUSTOMFIELD_USER, $userid);
    $dotemplate = iif($enabled==1,"registersuccess", "registervalidate");
}
?> 


But how can i change a user password or delete user?
thank you.
0

#2
User is offline   Craig Brass 

  • Staff - Managing Director and Chief Software Architect
  • PipPipPip
  • Group: Management
  • Posts: 349
  • Joined: 17-January 07
The API doesn't support these functions and I doubt it ever will unless you plan to extend it yourself as V4 will be released next year and will likely contain these functions.

The reason they were left out is that the API was designed to allow people to replicate Kayako inside another application. Accounts are auto created when they enter a new ticket.
Craig Brass
Managing Director and Chief Software Architect - Craig Brass Systems
0

#3
User is offline   maddogx 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 13-September 09
I played with kayako and your api today and created some extension with those features, i added the following functions:
changePassword, deleteUser, registerUser to api.class.php
get the patch from here: http://interhost.co.il/api.class.patch
installation: patch -p0 < api.class.patch

and I also extended the example (api client), get it from here:
http://www.interhost...ako.api.php.txt

usage example:
http://api.caller.com/kayako.api.php?cmd=updateEmailAddress&oldEmail=old@email.com&newEmail=new@email.com&api_password=cleartext


interface: GET/POST
usage: kayako.api.php?cmd=<command>..args..&api_password=<api_password>
Availble commands:
cmd=updateEmailAddress
a1=oldEmail
a2=newEmail

cmd=changePassword
a1=email
a2=newpassword

cmd=deleteUser
a1=email

cmd=registerUser
a1=email
a2=userpassword
a3=fullname

any comments will be appriciated.
p.s its a proof of concept example, use on your own responsibility only.
0

#4
User is offline   maddogx 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 13-September 09
forgot to add wsdl.php patch which is required by my previous patch:
http://interhost.co.il/wsdl.patch
install:
patch -p0 < wsdl.patch
location: integrationapi/lib

thanks
0

#5
User is offline   Craig Brass 

  • Staff - Managing Director and Chief Software Architect
  • PipPipPip
  • Group: Management
  • Posts: 349
  • Joined: 17-January 07
Thanks for sharing this :)
Craig Brass
Managing Director and Chief Software Architect - Craig Brass Systems
0

#6
User is offline   maddogx 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 13-September 09
you welcome anytime,
don't forget to edit authorized IP list in kayako.api.php:
$authorized_ip="127.0.0.1,192.168.1.1";
I put here my 3rd party servers ip which calls the API via curl
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users