Created
December 10, 2012 20:59
-
-
Save chicks/4253351 to your computer and use it in GitHub Desktop.
Example of how to create a SugarCRM User via REST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'digest/md5' | |
require 'rubygems' | |
require 'sugarcrm' | |
SugarCRM.connect("http://localhost:8888/sugarcrm", "admin", "letmein", :debug => true) | |
user = SugarCRM::User.new | |
user.email1 = "[email protected]" | |
user.user_name = "test_user" | |
user.user_hash = Digest::MD5.hexdigest("Password123!") # 2c103f2c4ed1e59c0b4e2e01821770fa | |
user.last_name = "Doe" | |
user.status = "Active" | |
user.employee_status = "Active" | |
user.team_count = 1 | |
user.team_name = "Global" | |
user.save! | |
# set_entry: Request: | |
# { | |
# "session": "87932a67e55c905270017cf3ced72e95", | |
# "module_name": "Users", | |
# "name_value_list": { | |
# "user_name": {"name":"user_name","value":"test_user"}, | |
# "last_name": {"name":"last_name","value":"Doe!"}, | |
# "status": {"name":"status","value":"Active"}, | |
# "team_count": {"name":"team_count","value":1}, | |
# "team_name": {"name":"team_name","value":"Global"}, | |
# "email1": {"name":"email1","value":"[email protected]"}, | |
# "user_hash":{"name":"user_hash","value":"2c103f2c4ed1e59c0b4e2e01821770fa"}, | |
# "employee_status":{"name":"employee_status","value":"Active"} | |
# } | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment