How to add customers via API?

Post: http://www.namedoseusite.com.br/api_customers.php?action=add_Customers































Parameter format description
Customers_FirstName json

Customers FirstName
Only Text is Required
Format: Varchar (32)
* Field Required

Customers_lastName json Customers LastName
Only Text is Required
Format: Varchar (32)
* Field Required
Customers_email_address json Email Address
Example: name@site.com.br
Format: varchar (96)
* Field Required
Customers_Password json password
Minimum: 8 characters
format: varchar (40)
* Field Required
Customers_Telephone json Telephone
Example: (11) 3230-6255
Format: varchar (32)
* Field Required
Customers_Telephone_Commercial json Commercial Telephone
Example: (11) 3230-6255
Format: varchar (32)
Customers_telephone_mobile json Telephone Mobile
Example: (11) 3230-6255
Format: varchar (32)
Skype json Skype Name
Format: Varchar (32)
msn json msn name
format: varchar (32)
Customers_Fax json Fax Telephone
Example: (11) 3230-6255
Format: varchar (32)
Customers_Newsletter json Use the 1 to yes or 0 to no
Only Number is Required
Format: int (1)
* Field Required
Customers_Groups_id json Check the Api To Get the List of Customers Groups
Only Number is Required
Format: Int (11)
* Field Required
Customers_Language json

English, Spanish, Japanese or Portuguese
* Field Required

Customers_Gender json m or f
* Field Required
Customers_Dob json dd/mm/yyyy
* Field Required
entry_street_address json Street Address
Format: Varchar (64)
* Field Required
entry_number json Number Street Address
Only Number is Required
* Field Required
entry_completion json Completion Street Address
entry_suburb json suburb
entry_postcode json Post code
Only Number is Required
* Field Required
entry_city json City
Only Text is Required
* Field Required
entry_state json Check the Api To Get the List of State
* Field Required
entry_country_id json Check the Api To Get the List of Country
Only Number is Required
* Field Required
entry_rg json rg
entry_cpf json CPF
entry_company json Company Name
entry_cnpj json cnpj
entry_ie json ie
Person_Kind json pj or pf
format: varchar (2)
* Field Required

php sample

 // sample add customers

$ URL = $ tabain_url. ' /api_customers.php? Action = add_customers ' ;;

$ data = array ("customs_firstname" = & gt; "Customers FirstName", // Customers FirstName * Field Required
"customs_lastname" = & gt; "LastName Customers", // Customers LastName * Field Required
"Customers_email_address" = & gt; "email@mformula.com.br", // email address * Field Required
"Customers_Password" = & gt; "Test", // password * Field Required
"Customers_telephone" = & gt; "(11) 3230-6255", // Telephone Example: (11) 3230-6255 * Field Required
"Customers_telephone_commercial" = & gt; "(11) 3230-6255", // Commercial Telephone Example: (11) 3230-6255
"Customers_telephone_mobile" = & gt; "(11) 3230-6255", // Telephone Mobile Example: (11) 3230-6255
"Skype" = & gt; "", // skype name
"msn" = & gt; "", // msn
"Customers_Fax" = & gt; "", // Fax Telephone Example: (11) 3230-6255
"Customers_Newsletter" = & gt; "1", // use the 1 to yes or 0 to (only number is required) * Field Required
"Customers_groups_id" = & gt; "", // Check the Api to Get the List of Customers Groups
"Customers_language" = & gt; "Portuguese", // English, Spanish, Japanese or Portuguese * Field Required
"Customers_Gender" = & gt; "m", // m or f * Field Required
"Customers_DOB" = & gt; "01/02/1980", // dd/mm/yyyy * Field Required
"entry_street_address" = & gt; "Av Paulista", // Street Address * Field Required
"entry_number" = & gt; "1500", // Number Street Address * Field Required
"entry_completion" = & gt; "", // Completion Street Address
"entry_suburb" = & gt; "Gardens", // Suburb
"entry_postcode" = & gt; "04206000", // post code
"entry_city" = & gt; "Sao Paulo", // City * Field Required
"entry_state" = & gt; "Sao paulo", // check the api to get the list of state * Field Required
"entry_country_id" = & gt; "30", // check the api to get the list of country
"Entry_Rg" = & gt; "", // RG
"entry_cpf" = & gt; "28240621856", // CPF
"Entry_Company" = & gt; "", // Company Name
"entry_cnpj" = & gt; "", // CNPJ
"entry_ie" = & gt; "", // IE
"Person_Kind" = & gt; "pf" // pj or pf * Field Required
);

$ data_string = json_encode ($ date);

$ CH = curl_init ($ URL);
Curl_Setopt ($ CH, curlopt_customrequest, "post");
Curl_Setopt ($ CH, Curlopt_postFields, $ Data_String);
Curl_Setopt ($ CH, Curlopt_Returntransfer, True);
curl_setopt ($ CH, curlopt_ssl_verifypeer, false);
Curl_Setopt ($ CH, Curlopt_httpheader, Array (
' CONTENT-TYPE: Application/JSON ',
"Cache-Control: No-Cache",
' Usuario1: ' . base64_encode ($ Usuario1),
' password1: ' . base64_encode ($ password1),
' CONTENT-LENGTH: ' . Strlen ($ data_string)))
);

$ result = curl_exec ($ CH);
Curl_Close ($ CH);

print_r ($ result);

// Sample Add Customers EOF

Return Error:

Code
Message

Return Success:

code
ID
Message

Leave a Reply 0