Ad Import Tool

From GG API Documentation

Ad import tool

Tool hosted on Annonsera.se site which allows users to import ads from different formats into own account. It's available after you login on this page.

Highlights

Charset

Import files must be in UTF-8 charset without BOM. If your file is in different charset, please convert it before submission.

It's a good idea to validate your XML file before submission. Online validators: http://www.w3schools.com/XML/xml_validator.asp, http://www.xmlvalidation.com/

Multi-line text

If CSV is used, make sure that multi-line fields are enclosed in quotes.

Sample:

Some;Text;"Line 1
Line 2"

Quotes within text must be escaped with double-quotes.

Fields

List of fields that can be used to describe an ad in import file:

  • city (Required) City where to post ad. City name must be in format: "City, Municipality, Province", example: "Pajala, Pajala kommun, Norrbottens län". Values for cities can be seen on [ads page]
  • category (Required) Name of category where to post ad. Category name must be in format: Category/Subcategory, example: FORDON/Bilar.
  • type (Optional) Ad type. One of: sell, buy, rent, wish-to-rent, swap, giveaway, job-available, seeking-job, lost, found. Defaults to sell.
  • term (Required) Term to show ad. Specified in months. E.g. 1, 2, 3, 6, 12.
  • title (Required) Ad title.
  • description (Optional) Ad description. Defaults to title.
  • price (Optional) Examples: "123", "123,45", "1 234 567,89", "123,45 Kr", "123,45 :-".
  • advertiserType (Optional) One of: person, company. Defaults to person.
  • advertiserName (Optional) Name of advertiser. By default your profile name will be used.
  • phone (Optional) Phone of advertiser. Defaults to phone from your profile.
  • showPhone (Optional) 1 to show phone number on the ad page, 0 to not. Defaults to 0.
  • imageUrl (Optional) URL of ad image.
  • youtube (Optional) URL of YouTube Video or EMBED HTML code of YouTube video.
  • link (Optional)
  • linkTitle (Optional)
  • eCommerce (Optional) 1 to display "Buy now" button (links to your e-Commerce site or add to shopping cart on Annonsera.se) on the ad page, 0 to not. Defaults to 0.

File formats

Ads can be imported from files in CSV (.csv, .txt) or XML (.xml) formats.

CSV. File structure

Field value must be separated from the next with a semicolon character (;) like in next example:

title;price;type

Field value can be enclosured with a double-quote character ("). It allows you to use line breaks and field separator character in field value. Example:

Some;Text;"Line breaks
and semicolons ; can be
used here"

Fields with embedded double-quote characters must be enclosed within double-quote characters, and each of the embedded double-quote characters must be represented by a pair of double-quote characters. Example:

Ford E350;"Super ""luxurious"" truck"

The 1-st row of the CSV import file must describe the sequence of fields in next rows. Such structure gives you more flexibility in describing ads in import file and lets you to be not tied to a field sequence and a count of optional fields. Here are some examples.

Example A:

title;price;type
Apple;2;sell
Pear;3;buy

The 1-st row tells that in next 2 lines an each ad is described in such sequence: First goes its title (Apple, Pear), than its price (2, 3) and than a type of an ad (sell, buy).

Example B:

type;title;price
sell;Apple;2
buy;Pear;3

The 1-st row tells that in next 2 lines an each ad is described in such sequence: First goes a type of an ad (sell, buy), than its title (Apple, Pear) and than its price (2, 3).

NOTE: Previous examples are not valid to import. They are shortened and fictional to let you understand specific principles of writing import files.

CSV. Example

Samples of CSV file

Sample.csv

Sample+video.csv

You may use this file as basis for your own import files. It can be opened with Excel, OpenOffice or other kind of spreadsheet editing software.

Sample Excel file

Sample.xls

Important! This file must be first converted to CSV:

1. Open file in Excel

2. Run "Save as" and choose CSV (coma separated values) format.

3. Excel saves in local charsets. Most probably your file will be saved in Western European charset (iso-8859-1). You will need to convert it to UTF-8. This may be done using any online of desktop converter. For example using this online converter.

4. Upload CSV file

Sample OpenOffice Spreadsheet file

Sample.ods

Important! This file must be first converted to CSV:

1. Open file in OpenOffice

2. Run "Save as" and choose CSV (coma separated values) format. On the next step choose Character Set: UTF-8, Field delimiter ;, Text delimiter: ".

3. That's it. Upload resulting CSV file

CSV text sample

city;category;title;description;price;imageUrl;term;phone
Pajala, Pajala kommun, Norrbottens län;Bostad/Utland;Tomato;The red tomato.;5;http://farm4.static.flickr.com/3519/3773953521_3cdec661eb.jpg;3;0634578912
Östersund, Östersunds kommun, Jämtlands län;Bostad/Utland;Cucumber;The green cucumber.;3;http://farm5.static.flickr.com/4007/4432871243_fae6782870.jpg;6;0984554381

XML. File structure

Each XML import file must has similar structure:

<?xml version="1.0" encoding="UTF-8" ?>
<ads>
	<ad>
		<!-- Ad_1 fields here. -->
	</ad>
	<!-- As many ads as you need. -->
	<ad>
		<!-- Ad_n fields here. -->
	</ad>
</ads>


Use "CDATA":http://en.wikipedia.org/wiki/CDATA to be able to pass text that contains special XML characters (like <, >, &, ' and "). Example:

<?xml version="1.0" encoding="UTF-8" ?>
<ads>
	<ad>
		<title>XML CDATA</title>
		<description><![CDATA[There can be 
line breaks as many 
as we need.

And corner chars (< and > and </) also can be here.]]></description>
		<price>5</price>
	</ad>
</ads>

NOTE: Previous examples are not valid to import. They are shortened and fictional to let you understand specific principles of writing import files.

XML. Example

<?xml version="1.0" encoding="UTF-8" ?>
<ads>
	<ad>
		<city>Pajala, Pajala kommun, Norrbottens län</city>
		<category>Bostad/Utland</category>
		<title>Tomato</title>
		<description>The red tomato.</description>
		<price>5</price>
		<imageUrl>http://farm4.static.flickr.com/3519/3773953521_3cdec661eb.jpg</imageUrl>
		<term>3</term>
		<phone>0634578912</phone>
	</ad>
	<ad>
		<city>Östersund, Östersunds kommun, Jämtlands län</city>
		<category>Bostad/Utland</category>
		<title>Cucumber</title>
		<description>The green cucumber.</description>
		<price>3</price>
		<imageUrl>http://farm5.static.flickr.com/4007/4432871243_fae6782870.jpg</imageUrl>
		<term>6</term>
		<phone>0984554381</phone>
	</ad>
</ads>

Got a Question?

Contact us at clientapi@annonsera.se

See also

Annonsera API