Export & Import

Below you will find explanation of the two formats into which you can export and import profiles into a haystack. You will also find general info on the limitations of the export and import procedures.

Export
Import

Export

You can export profiles from two places. The data is exported in two file formats: as XML file and as CSV file.

XML

The XML format is the same as the format into which you retrieve profile info using the Haystack API. The general format can be seen when you look in the SDK documentation (look at the Haystack Profile's List command) or you can quickly figure it out from the XML below:

 <hwsapi version="1.0">
  <ErrorCode>...</ErrorCode>
  <ErrorMsg>...</ErrorMsg>
  <Data>
    <Profile> 
      <FName>...</FName> 
      <LName>...</LName> 
      <SkypeId>...</SkypeId> 
      <RssFeed>...</RssFeed> 
      <Phone>...</Phone> 
      <Location>...</Location> 
      <Photo>...</Photo> 
      <Snapshot>...</Snapshot> 
      <Bio>...</Bio> 
      <Nts>...</Nts> 
      <Visible>0 or 1</Visible> 
      <Admin>0 or 1</Admin> 

      <Haystack name=”” id=””> 
        <Category name=””> 
          <Tag name=””> 
        ... 
        </Category>
        ... 
      </Haystack> 
    
      <!-- Other haystacks come here if needed. -> 
      ... 
   </Profile>
   <Profile>
   ...
   </Profile>
   <!-- Some other profiles may go here if needed -->
   ... 
  </Data>               
  <Time>...</Time>
 </hwsapi>

Note:
The tag names are case sensetive.
The <Time> tag informs you how long the export took on the server in milliseconds. The <ErrorCode> and <ErrorMsg> fields can be ignored.

Usually each <Profile> section will have only one <Haystack> subsection and this will be the haystack from which you export the profiles. But if you are not a haystack admin but a single user and you export your own profile, you will have a list of all haystacks into which you are participating.

In the Export Profile(s) Wizard you can specify which profile information you actually want to export. Based on this information not all of the XML tags may be present in your export file.

CSV

The Comma Separated Values file format is widely used in many application, most noticeably the Microsoft Excel program.

You can search google for the general CSV file format or you can have a look at Wikipedia here

If you would like to import the information for your profiles into an Excel like application you can directly export into the CSV format.

When you export into CSV file, the first line of the file we call a header and it contains keywords for the data exported.

The following keywords can be found in the header:

The other keywords are: skypeid, rssfeed, email, phone, location, photo, snapshot, bio and nts. They are analogous to the tags in the XML file.

This is how a typical CSV file looks like:

 haystack,fname,lname,email,visible,"Organization","Enterprises","Favourite Gun"
 Beast Hunters,Chris,The Master,chris@beast.org,1,"Save The Planet",Consulting;Social Networking,

In this example the first row is the header row. All items there which are different from any of the keywords are haystack categories. The second row contains the actual information. You can see that the haystack is called 'Beast Hunters'. You should pay more attention to the 7-th field in this row since it represents the tags under the "Enterprises" category. Each tag is separated from the next with a semicolon (;) character.

If this example was to be exported in XML format it would have looked like this:

 <hwsapi version="1.0">
   <Data>
     <Profile>
       <FName>Chris</FName>
       <LName>The Master</LName>
       <Email>chris@beast.org</Email>
       <Visible>1</Visible>
       <Haystack name="Beast Hunters">
         <Category name="Organization">
           <Tag name="Save The Planet" />
         </Category>
         <Category name="Enterprises">
           <Tag name="Consulting" />
           <Tag name="Social Networking" />
         </Category>
         <Category name="Favourite Gun" />
         </Category>
       </Haystack>
     </Profile>
   </Data>
 </hwsapi>

If you import the example CSV file into Excel it will look similar to this:

haystack fname lname email visible Organization Enterprises Favourite Gun
Beast Hunters ChrisThe Masterchris@beast.org1 Save The PlanetConsulting;Social Networking 

Note:
You can export in the XML format and use your own XML transformation sheet to generate your custom CSV file if you find the format of the CSV export not very convenient.

Import

While you can export profiles from a haystack as well as single profiles, you are offered to import profiles only if you are haystack administrator. Furthermore you can import profiles only in the haystacks which you administer.

Importing has the following limitations:

You can import profiles using either XML or CSV files. The format is exactly the same as the format of the export files.

In the XML file if your specify xml tags which cannot be recognized, they are silently ignored. The system will import only those tags which it recognizes. XML parsing erros though (e.g.: not preprly closed tags or invalid XML symbols) will be reported.

In the CSV file the first line is considered a header which identifies the information in the subsequent lines. Any field in the header which is different from the header keywords defined in the CSV section is considered to be a category name. Be careful what you write in the header.

Note:
If you are using an XML or CSV file to perform an import of multiple profiles you can first import information for one profile only. Once you have achieved a correct file format you can add records for all the profiles you want to import.

Generated on Fri Sep 15 14:08:26 2006 for Haystack API by  doxygen 1.4.7