Difference between revisions of "Change/Importing contacts via CSV using curl"

 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
===<h1>Importing contacts via CSV using curl</h1>===
+
{{BC|Certified}}
 +
__FORCETOC__
 +
<div class="col-md-12 ibox-content">
 +
=Importing contacts via CSV using curl=  
 
<hr>
 
<hr>
<br>
+
{{KB|{{ZC}}|{{ZCS 8.8}}||||}}
  
<h2>Problem:</h2>
 
  
Contact isn't imported via CSV file using curl.
+
====Problem====
  
Message showing in the mailbox.log file
+
When trying to import a contact via CSV file using curl. we get the following error in the mailbox.log file:
  
 +
<pre>
 
  2016-01-22 13:31:04,844 INFO  [qtp509886383-729:https://localhost:7071/home/user@example.com/Contacts?fmt=csv [name=admin@zcs.va;mid=9;ip=127.0.0.1;] UserServlet - POST: https://localhost:7071/home/user@example.com
 
  2016-01-22 13:31:04,844 INFO  [qtp509886383-729:https://localhost:7071/home/user@example.com/Contacts?fmt=csv [name=admin@zcs.va;mid=9;ip=127.0.0.1;] UserServlet - POST: https://localhost:7071/home/user@example.com
 
  2016-01-22 13:31:04,845 INFO  [qtp509886383-729:https://localhost:7071/home/user@example.com/Contacts?fmt=csv] [name=admin@zcs.va;mid=9;ip=127.0.0.1;] mailbox - UserServlet received file unknown - 195 request bytes
 
  2016-01-22 13:31:04,845 INFO  [qtp509886383-729:https://localhost:7071/home/user@example.com/Contacts?fmt=csv] [name=admin@zcs.va;mid=9;ip=127.0.0.1;] mailbox - UserServlet received file unknown - 195 request bytes
 +
</pre>
  
  
====CSV File :====
+
====Solution====
"fullName","lastName","firstName","email","email2","mobilePhone","mobilePhone2","jobTitle","company","namePrefix"
 
"John Doe","John","Doe","John.Doe@example.com","","","","","",""
 
  
 +
* Ensure the CSV is in the following format:
 +
*:<pre>
 +
*::"First Name","Last Name","Display Name","Nickname","Primary Email","Secondary Email","Screen Name","Work Phone","Home Phone","Fax Number","Pager Number","Mobile Number","Home Address","Home City","Home County","Home Post Code","Home Country","Work Address","Work City","Work County","Work Post Code","Work Country","Job Title","Department","Organisation","Web Page 1","Web Page 2","Birth Month","Custom 1","Custom 2","Custom 3","Custom 4","Notes"
 +
*::"John","Doe","John Doe","John","John.Doe@example.com","","","","","","","","","","","","","","","","","","","","","","","","","","","",""</pre>
  
 +
* Import using this command:
 +
*:<pre>curl -k -u admin@example.com:admin_pass --upload-file /tmp/contact.csv https://localhost:7071/home/user@example.com/Contacts?fmt=csv</pre>
  
<h2>Solution:</h2>
+
Using the above command, the admin can import contacts for all users. Just change <code>user@example.com</code> to the relevant user's address.
 +
If you're using a valid SSL certificate, <code>-k</code> can be omitted.
  
1). Make the CSV in the following format:
 
  
"First Name","Last Name","Display Name","Nickname","Primary Email","Secondary Email","Screen Name","Work Phone","Home Phone","Fax Number","Pager Number","Mobile Number","Home Address","Home City","Home County","Home Post Code","Home Country","Work Address","Work City","Work County","Work Post Code","Work Country","Job Title","Department","Organisation","Web Page 1","Web Page 2","Birth Month","Custom 1","Custom 2","Custom 3","Custom 4","Notes"
+
{| class="wikitable" style="background-color:#d0f0c0;" cellpadding="10"
  "John","Doe","John Doe","John","John.Doe@example.com","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
+
|'''Submitted by''': Shashank Shekhar Tewari
 +
|}
  
 
+
{{Article Footer|ZCS 8.8|2020-04-13}}
2). Import using this command:
 
 
 
curl -k -u admin@example.com:admin_pass --upload-file /tmp/contact.csv https://localhost:7071/home/user@example.com/Contacts?fmt=csv
 
 
 
 
 
 
 
Using the above command, the admin can import contacts for all users. Just change 'user@example.com' to the relevant user's address. If you're using a valid SSL certificate, '-k' can be omitted.
 
 
 
 
 
Submitted by:  Shashank Tewari
 

Latest revision as of 10:54, 3 November 2021

Importing contacts via CSV using curl


   KB 23374        Last updated on 2021-11-3  




0.00
(0 votes)


Problem

When trying to import a contact via CSV file using curl. we get the following error in the mailbox.log file:

 2016-01-22 13:31:04,844 INFO  [qtp509886383-729:https://localhost:7071/home/user@example.com/Contacts?fmt=csv [name=admin@zcs.va;mid=9;ip=127.0.0.1;] UserServlet - POST: https://localhost:7071/home/user@example.com
 2016-01-22 13:31:04,845 INFO  [qtp509886383-729:https://localhost:7071/home/user@example.com/Contacts?fmt=csv] [name=admin@zcs.va;mid=9;ip=127.0.0.1;] mailbox - UserServlet received file unknown - 195 request bytes


Solution

  • Ensure the CSV is in the following format:
    "First Name","Last Name","Display Name","Nickname","Primary Email","Secondary Email","Screen Name","Work Phone","Home Phone","Fax Number","Pager Number","Mobile Number","Home Address","Home City","Home County","Home Post Code","Home Country","Work Address","Work City","Work County","Work Post Code","Work Country","Job Title","Department","Organisation","Web Page 1","Web Page 2","Birth Month","Custom 1","Custom 2","Custom 3","Custom 4","Notes"
    "John","Doe","John Doe","John","John.Doe@example.com","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
  • Import using this command:
    curl -k -u admin@example.com:admin_pass --upload-file /tmp/contact.csv https://localhost:7071/home/user@example.com/Contacts?fmt=csv

Using the above command, the admin can import contacts for all users. Just change user@example.com to the relevant user's address. If you're using a valid SSL certificate, -k can be omitted.


Submitted by: Shashank Shekhar Tewari
Verified Against: ZCS 8.8 Date Created: 2020-04-13
Article ID: https://wiki.zimbra.com/index.php?title=Change/Importing_contacts_via_CSV_using_curl Date Modified: 2021-11-03



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Jump to: navigation, search