Annonsera API

From GG API Documentation

Contents

What is Annonsera API?

Annonsera API is very simple and flexible mechanism which allows users to acquire various information about advertisements directly from Annonsera.se and then display it somewhere in the Internet (personal web-pages, blogs, company websites and so forth).

How to use Annonsera API?

There are several ways to obtain and display information you are interested in:

  • usage of library of predefined widgets;
  • usage of HTTP requests and retrieval of information in various formats (JSON, XML or RSS);

Usage of Annonsera API via library of predefined widgets

Ordinary users who are not familiar with web-technologies can in a very simple manner gain benefits from using predefined set of widgets which were specially developed for quick setup and easy usage.

We host a number of sample widgets. Such widgets may be easily customized and used at your website(s).

Just try_it! It is very easy (basically it only takes several minutes to select, customize and setup desired widget).


Usage of Annonsera API via HTTP requests

If you are an advanced WEB user (or developer) then you can obtain required information by means of Annonsera API calls.

In order to continue deeper Annonsera API consideration it is required to get acquainted with a couple of terms.

Annonsera API Call - HTTP request of special format which is charge of information retrieval from Annonsera.se. Actually typical Annonsera API Call is an URL like bellows:

http://www.annonsera.se/api/SPACE/NAME.FORMAT[?PARAM_1=VALUE_1[&PARAM_N=VALUE_N]]

where:

  • SPACE - Annonsera API method space;
  • NAME - Annonsera API method name;
  • FORMAT - Annonsera API response format;
  • PARAM_N=VALUE_N - additional Annonsera API request parameters.

Annonsera API format - format in which data is sent upon request. Currently there are 3 formats supported:

  • json (JavaScript Object Notation format)
  • xml (eXensible Markup Language format)
  • rss (Really Simple Syndication format)


Response formats

There are samples of responses in different formats below.

JSON
With JSON format any method can accept an additional request parameter
callback
- a JavaScript callback function.
http://www.annonsera.se/api/ad/get.json?callback=displayAd&iad=21866
displayAd({
   "ad":{
      "id":21866,
      "title":"Audi TT",
      "text":"Audi TT",
      "publisher":"Daniel",
      "category":"FORDON\/Bilar",
      "region":"V\u00e4stra G\u00f6taland",
      "city":"G\u00f6teborg",
      "person":"p",
      "term":"1 m\u00e5nad",
      "type":"S\u00e4ljes",
      "price":85000,
      "actual":"Y",
      "expired":"Fri, 07 Aug 2009 10:20:41 +0200",
      "expired_unixtime":1249633241,
      "URL":"http:\/\/www.annonsera.se\/v%C3%A4stra-g%C3%B6taland-g%C3%B6teborg\/fordon-bilar\/audi-tt.html",
      "images":[
         {
            "imageURL":"http:\/\/www.annonsera.se\/images\/00001\/0\/audi-tt.jpg",
            "thumbnailURL":"http:\/\/www.annonsera.se\/images\/00001\/1\/audi-tt.jpg",
            "height":425,
            "width":640
         }
      ]
   }
})

There is a very simple example of callback function displayAd available. Please, check it (ad.js) if you are intrested in more detailed examples of usage and how to render simple widget using Annonsera API.

XML
http://www.annonsera.se/api/ads/get.xml?category=fordon&count=1
<?xml version="1.0" encoding="UTF-8"?>
<ads>
  <item>
    <ad>
      <id>93765</id>
      <title>Gammal båtmotor</title>
      <name>Gammal båtmotor</name>
      <text>Renoveringsobjekt för intresserade. kom med bud.</text>
      <publisher>Jennifer Andersson</publisher>
      <category>FORDON/Båtdelar & tillbehör</category>
      <categoryId>15</categoryId>
      <region>Örebro</region>
      <regionId>29</regionId>
      <city>Örebro</city>
      <cityId>149</cityId>
      <person>p</person>
      <term>3 månader</term>
      <type>Säljes</type>
      <price>0</price>
      <actual>Y</actual>
      <published>Thu, 26 Aug 2010 16:20:57 +0200</published>
      <publishedUnixtime>1282832457</publishedUnixtime>
      <expired>Sat, 27 Nov 2010 15:20:57 +0100</expired>
      <expired_unixtime>1290867657</expired_unixtime>
      <expiredUnixtime>1290867657</expiredUnixtime>
      <URL>http://www.annonsera.se/%C3%B6rebro-%C3%B6rebro/fordon-b%C3%A5tdelar-_-tillbeh%C3%B6r/gammal-b%C3%A5tmotor.html</URL>
      <url>http://www.annonsera.se/%C3%B6rebro-%C3%B6rebro/fordon-b%C3%A5tdelar-_-tillbeh%C3%B6r/gammal-b%C3%A5tmotor.html</url>
      <images>
        <item>
          <id>78912</id>
          <url>http://www.annonsera.se/images/00093/0/gammal-btmotor.jpg</url>
          <thumbUrl>http://www.annonsera.se/images/00093/1/gammal-btmotor.jpg</thumbUrl>
          <imageURL>http://www.annonsera.se/images/00093/0/gammal-btmotor.jpg</imageURL>
          <thumbnailURL>http://www.annonsera.se/images/00093/1/gammal-btmotor.jpg</thumbnailURL>
          <width>360</width>
          <height>480</height>
        </item>
      </images>
    </ad>
  </item>
</ads>
RSS
http://www.annonsera.se/api/ads/get.rss?category=fordon&count=1
<rss version="2.0">
  <channel>
    <title>GG RSS</title>
    <description>GG RSS</description>
    <link>http://www.annonsera.se/api/ads/get.rss?category=fordon&count=1</link>
    <copyright>InnovateIt.com</copyright>
    <docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
    <generator>GAPI</generator>
    <language>sv</language>
    <lastBuildDate>Thu, 26 Aug 2010 14:28:23 GMT</lastBuildDate>
    <pubDate>Thu, 26 Aug 2010 14:28:23 GMT</pubDate>
    <ttl>15</ttl>
    <item>
      <title>Gammal båtmotor</title>
      <description>Renoveringsobjekt för intresserade. kom med bud.</description>
      <link>http://www.annonsera.se/%C3%B6rebro-%C3%B6rebro/fordon-b%C3%A5tdelar-_-tillbeh%C3%B6r/gammal-b%C3%A5tmotor.html</link>
      <author>Jennifer Andersson</author>
      <guid>http://www.annonsera.se/%C3%B6rebro-%C3%B6rebro/fordon-b%C3%A5tdelar-_-tillbeh%C3%B6r/gammal-b%C3%A5tmotor.html</guid>
      <pubDate>Thu, 26 Aug 2010 16:28:23 +0200</pubDate>
    </item>
  </channel>
</rss>

Annonsera API errors handling

Whenever errors are occured Annonsera API provides you with meaningful information regarding what actually happen so you can deal with it according to your policy of handling errors. Errors are returned exactly in the same format the request was sent.

Below listed example requests that contain errors. Bad parameters are underlined.

JSON
http://www.annonsera.se/api/ad/get.json?callback=displayAd&adId=XYZ
displayAd({"error":{"code":400,"text":"invalid parameter: adId"}})
XML
http://www.annonsera.se/api/ads/get.xml?category=nonexistent&count=1
<?xml version="1.0" encoding="UTF-8"?>
  <error>
    <code>400</code>
    <text>invalid parameter: category</text>
  </error>
RSS
http://www.annonsera.se/api/ads/get.rss
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Annonsera RSS</title>
    <description>Annonsera RSS</description>
    <link>http://www.annonsera.se/api/ads/get.rss</link>
    <copyright>InnovateIt.com</copyright>
    <docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
    <generator>GAPI</generator>
    <language>sv</language>
    <lastBuildDate>Tue, 07 Jul 2009 09:28:48 GMT</lastBuildDate>
    <pubDate>Tue, 07 Jul 2009 09:28:48 GMT</pubDate>
    <ttl>15</ttl>
    <item>
      <title>error 400</title>
      <description>unsufficient paramters set for request</description>
      <author>GAPI</author>
      <pubDate>Tue, 07 Jul 2009 11:28:48 +0200</pubDate>
    </item>
  </channel>
</rss>

Authorization

For services that require authorization OAuth 1.0a must be used.

Request token URL
http://www.annonsera.se/oauth/request_token
Authorize URL
http://www.annonsera.se/oauth/authorize
Access token URL
http://www.annonsera.se/oauth/access_token
Consumer key and consumer secret

Consumer key and consumer secret can be obtained by creating a new application or you can list already created applications.

Signing requests

Requests must be signed with HMAC-SHA1 signature method.


API Calls

List categories

http://www.annonsera.se/api/categories/list

Returns list of categories of one level (without children).

Authentication

Not required.

Arguments
  • parentCategoryId or parentCategory (Optional) ID or name of parent category. If specified, then list of child categories will be returned.
  • withChildren (Optional) 1 to return categories with its children, 0 to not. Defaults to 0.
Examples
http://www.annonsera.se/api/categories/list.json?parentCategory=BOSTAD
{
    "categories": [
        {
            "id": 110,
            "name": "Utland",
            "url": "http://www.annonsera.se/bostad-utland/"
        },
        {
            "id": 111,
            "name": "Tomter & Gårdar",
            "url": "http://www.annonsera.se/bostad-tomter-_-g%C3%A5rdar/"
        },
        {
            "id": 112,
            "name": "Fritidshus",
            "url": "http://www.annonsera.se/bostad-fritidshus/"
        }
    ]
}
http://www.annonsera.se/api/categories/list.json?withChildren=1
{
    "categories": [
        {
            "id": 10,
            "name": "BOSTAD",
            "url": "http://www.annonsera.se/bostad/",
            "children": [
                {
                    "id": 110,
                    "name": "Utland",
                    "url": "http://www.annonsera.se/bostad-utland/"
                },
                {
                    "id": 111,
                    "name": "Tomter & Gårdar",
                    "url": "http://www.annonsera.se/bostad-tomter-_-g%C3%A5rdar/"
                },
                {
                    "id": 112,
                    "name": "Fritidshus",
                    "url": "http://www.annonsera.se/bostad-fritidshus/"
                }
            ]
        },
        {
            "id": 11,
            "name": "FORDON",
            "url": "http://www.annonsera.se/fordon/",
            "children": []
        },
        {
            "id": 12,
            "name": "ELEKTRONIK",
            "url": "http://www.annonsera.se/elektronik/",
            "children": []
        }
    ]
}

List regions

http://www.annonsera.se/api/regions/list

Returns list of regions.

Authentication

Not required.

Arguments

None.

Examples
http://www.annonsera.se/api/regions/list.json
{
    "regions": [
        {
            "id": 10,
            "name": "Norrbotten",
            "url": "http://www.annonsera.se/norrbotten/"
        },
        {
            "id": 11,
            "name": "Västerbotten",
            "url": "http://www.annonsera.se/v%C3%A4sterbotten/"
        },
        {
            "id": 12,
            "name": "Jämtland",
            "url": "http://www.annonsera.se/j%C3%A4mtland/"
        }
    ]
}

List cities

http://www.annonsera.se/api/cities/list

Returns list of cities.

Authentication

Not required.

Arguments
  • region or regionId (Optional) ID or name of region.

If specified, then list of cities from that region will be returned. Otherwise list of all cities will be returned.

Examples
http://www.annonsera.se/api/cities/list.json?region=Norrbotten
{
    "cities": [
        {
            "id": 110,
            "name": "Kiruna",
            "url": "http://www.annonsera.se/norrbotten-kiruna/"
        },
        {
            "id": 111,
            "name": "Pajala",
            "url": "http://www.annonsera.se/norrbotten-pajala/"
        },
        {
            "id": 112,
            "name": "Jokkmokk",
            "url": "http://www.annonsera.se/norrbotten-jokkmokk/"
        }
    ]
}

Post ad

http://www.annonsera.se/api/ads/new

Posts a new ad.

Authentication

Required OAuth.

HTTP method

POST.

Arguments
  • cityId or city (Required) Name of city where to post ad. City name must be in format: Region/City, example: Norrbotten/Pajala.
  • categoryId or category (Required) ID or 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 (Required) Ad description.
  • price (Optional)
  • advertiserType (Optional) One of: person, company. Defaults to person.
  • advertiserName (Optional) Name of advertiser. By default your profile name will be used.
  • phone (Required) Phone of advertiser.
  • showPhone (Optional) 1 to show phone number on the ad page, 0 to not. Defaults to 0.
  • imageDatas[] (Optional) Contents of ad images. Every image file must be read, encoded with Base64 and at last URL-encoded.
  • imageUrls[] (Optional) URLs of ad images.
  • youtube (Optional) URL of YouTube Video or EMBED HTML code of YouTube video.
  • pdfData (Optional) Content of PDF file. File must be read, encoded with Base64 and at last URL-encoded.
  • pdfUrl (Optional) URL of PDF file.
  • 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.
Examples

Example result:

{
    "ad": {
        "id": "86476",
        "name": "Utebord + 4 stolar",
        "url": "http://www.annonsera.se/uppsala-uppsala/hem-_-hush%C3%A5ll-tr%C3%A4dg%C3%A5rd/utebord-4-stolar.html"
    }
}

Get Ad

http://www.annonsera.se/api/ad/get

Get ad info.

Authentication

Not required.

Arguments
  • adId (Required) Ad ID.
Examples
http://www.annonsera.se/api/ad/get.json?adId=21866
{
    "ad":{
        "id": 21866,
        "name": "Audi TT",
        "text": "Audi TT",
        "publisher": "Daniel",
        "category": "FORDON\/Bilar",
        "categoryId": 12,
        "region": "V\u00e4stra G\u00f6taland",
        "regionId": 34,
        "city": "G\u00f6teborg",
        "cityId": 45,
        "person": "p",
        "term": "1 m\u00e5nad",
        "type": "S\u00e4ljes",
        "price": 85000,
        "actual": "Y",
        "published": "Tue, 07 Jul 2009 08:20:41 +0200",
        "publishedUnixtime": 1246954841,
        "expired": "Fri, 07 Aug 2009 10:20:41 +0200",
        "expiredUnixtime": 1249633241,
        "url":" http:\/\/www.annonsera.se\/v%C3%A4stra-g%C3%B6taland-g%C3%B6teborg\/fordon-bilar\/audi-tt.html",
        "youtubeVideo":{
            "code":"Pnc4AoLoQn0",
            "url":"http:\/\/www.youtube.com\/watch?v=Pnc4AoLoQn0",
            "thumbnailURL":"http:\/\/www.annonsera.se\/yi\/Pnc4AoLoQn0.jpg"
        },
        pdf":{
            "url":"http:\/\/www.annonsera.se\/uploads\/00001\/0\/audi-tt.pdf ",
            "thumbnailURL":"http:\/\/s3.annonsera.se\/img\/pdf.png"
        },  
        "images":[
            {
                "id": 12,
                "url": "http:\/\/www.annonsera.se\/images\/00001\/0\/audi-tt.jpg",
                "thumbUrl": "http:\/\/www.annonsera.se\/images\/00001\/1\/audi-tt.jpg",
                "width": 640,
                "height": 425
            }
        ]
    }
}

List ads

http://www.annonsera.se/api/ads/get

List ads.

Authentication

Not required. But if OAuth used then will be listed only ads of current user.

Arguments
  • regionId or region (Optional) ID or name of region. If specified, then list of cities from that region will be returned. Otherwise list of all cities will be returned.
  • cityId or city (Optional) Name of city where to post ad. City name must be in format: Region/City, example: Norrbotten/Pajala.
  • categoryId or category (Optional) ID or name of category where to post ad. Category name must be in format: Category/Subcategory, example: FORDON/Bilar.
  • userId (Optional) ID of ad owner (advertiser).
  • tag (Optional) Search keywords
  • rand (Optional) Y to get random list of ads, N otherwise.
  • page (Optional) Starts from 1. Defaults to 1.
  • count (Optional) Count of ads per page. Defaults to 20.
Examples
http://www.annonsera.se/api/ads/get.json?count=2
{ "ads" : [
      { "ad" : {
            "actual" : "Y",
            "category" : "FORDON/Mopeder",
            "categoryId" : 18,
            "city" : "Boden",
            "cityId" : 47,
            "expired" : "Fri, 17 Jun 2011 11:52:17 +0200",
            "expiredUnixtime" : 1308304337,
            "id" : 80444,
            "name" : "API_test_2",
            "person" : "p",
            "phone" : "9876",
            "price" : 25,
            "published": "Tue, 07 Jul 2009 08:20:41 +0200",
            "publishedUnixtime": 1246954841,
            "publisher" : "Ronald McDonald",
            "region" : "Norrbotten",
            "regionId" : 1,
            "term" : "6 månader",
            "text" : "update_Desc_1",
            "type" : "Säljes",
            "url" : "http://www.annonsera.se/norrbotten-boden/fordon-mopeder/api-test-2.html"
          } },
      { "ad" : {
            "actual" : "Y",
            "category" : "FORDON/Mopeder",
            "categoryId" : 18,
            "city" : "Boden",
            "cityId" : 47,
            "expired" : "Tue, 07 Dec 2010 12:30:16 +0100",
            "expiredUnixtime" : 1291721416,
            "id" : 80442,
            "name" : "API_test_1",
            "person" : "p",
            "price" : 25,
            "published": "Tue, 07 Jul 2009 08:20:41 +0200",
            "publishedUnixtime": 1246954841,
            "publisher" : "John_Smith",
            "region" : "Norrbotten",
            "regionId" : 1,
            "term" : "6 månader",
            "text" : "API_test_1_desc",
            "type" : "Säljes",
            "url" : "http://www.annonsera.se/norrbotten-boden/fordon-mopeder/api-test-1_0002.html"
          } }
    ] }

Update ad

http://www.annonsera.se/api/ads/update

Update existing ad.

Authentication

Required OAuth.

Arguments
  • adId (Required) Ad ID.
  • description (Optional) Ad description.
  • price (Optional)
  • advertiserName (Optional) Name of advertiser. By default your profile name will be used.
  • phone (Optional) Phone of advertiser.
  • showPhone (Optional) 1 to show phone number on the ad page, 0 to not. Defaults to 0.
  • youtube (Optional) URL of YouTube Video or EMBED HTML code of YouTube video.
  • pdfData (Optional) Content of PDF file. File must be read, encoded with Base64 and at last URL-encoded.
  • pdfUrl (Optional) URL of PDF file.
  • 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.
Examples
http://www.annonsera.se/api/ads/update.json?adId=86476&price=400&showPhone=1

Returns an empty success response if it completes without error.


Update ad status

http://www.annonsera.se/api/ads/updateStatus

Set new status for ad.

Authentication

Required OAuth.

Arguments
  • adId (Required) Ad ID.
  • active (Required) 1 to activate ad, 0 to deactivate.
Examples
http://www.annonsera.se/api/ads/updateStatus.json?adId=86476&active=1

Returns an empty success response if it completes without error.


Prolong ad

http://www.annonsera.se/api/ads/prolong

Prolong existing ad.

Authentication

Required OAuth.

Arguments
  • adId (Required) Ad ID.
  • term (Required) Term to show ad. Specified in months. E.g. 1, 2, 3, 6, 12.
Examples
http://www.annonsera.se/api/ads/prolong.json?adId=86476&term=6

Returns an empty success response if it completes without error.

Add images to ad

http://www.annonsera.se/api/ads.images/add

Add new images to existing ad.

Authentication

Required OAuth.

HTTP method

POST.

Arguments
  • adId (Required) Ad ID.
  • imageDatas[] (Optional) Contents of ad images. Every image file must be read, encoded with Base64 and at last URL-encoded.
  • imageUrls[] (Optional) URLs of ad images.
Examples
http://www.annonsera.se/api/ads.images/add.json?adId=86476&images[]={encodedBinaryData1}&images[]={encodedBinaryData2}
Returns URLs of added images.
{
    "images": [
        {
            "id": 10,
            "url": "http://www.annonsera.se/images/00001/0/audi-tt-0001.jpg",
            "thumbUrl": "http://www.annonsera.se/images/00001/1/audi-tt-0001.jpg",
            "width": 600,
            "height": 400
        },
        {
            "id": 11,
            "url": "http://www.annonsera.se/images/00001/0/audi-tt-0002.jpg",
            "thumbUrl": "http://www.annonsera.se/images/00001/1/audi-tt-0002.jpg",
            "width": 500,
            "height": 250
        }
    ]
}

Get ad image

http://www.annonsera.se/api/ads.images/get

Get image info.

Authentication

Required OAuth.

Arguments

imageId (Optional) ID of image uploaded by you.

Examples
http://www.annonsera.se/api/ads.images/get.json?imageId=10
{
    "image": {
        "id": 10,
        "url": "http://www.annonsera.se/images/00001/0/audi-tt-0001.jpg",
        "thumbUrl": "http://www.annonsera.se/images/00001/1/audi-tt-0001.jpg",
        "width": 600,
        "height": 400
    }
}

List ad images

http://www.annonsera.se/api/ads.images/list

Returns list of ad images.

Authentication

Required OAuth.

Arguments
  • adId (Required) Ad ID.
  • page (Optional) Starts from 1. Defaults to 1.
  • count (Optional) Count of ads per page. Defaults to 20.
Examples
http://www.annonsera.se/api/ads.images/list.json?adId=86476
{
    "images": [
        {
            "id": 10,
            "url": "http://www.annonsera.se/images/00001/0/audi-tt-0001.jpg",
            "thumbUrl": "http://www.annonsera.se/images/00001/1/audi-tt-0001.jpg",
            "width": 600,
            "height": 400
        },
        {
            "id": 11,
            "url": "http://www.annonsera.se/images/00001/0/audi-tt-0002.jpg",
            "thumbUrl": "http://www.annonsera.se/images/00001/1/audi-tt-0002.jpg",
            "width": 500,
            "height": 250
        }
    ]
}


Delete images from ad

http://www.annonsera.se/api/ads.images/delete

Delete images from ad.

Authentication

Required OAuth.

Arguments
  • adId (Required) Ad ID.
  • imageIds (Optional) IDs of ad images to delete separated by semicolon (;). If omitted then all ad images will be deleted.
Examples
http://www.annonsera.se/api/ads.images/delete.json?adId=86476&imageIds=10;11

Returns an empty success response if it completes without error.

Mail advertiser

http://www.annonsera.se/api/ads/mailAdvertiser

Post message to ad owner (advertiser).

Authentication

Required captcha.

Arguments
  • adId (Required) Ad ID.
  • fromEmail (Required) Your contact email.
  • fromName (Optional) Your contact name. Defaults to your profile name.
  • message (Required) Message to post.
Examples
http://www.annonsera.se/api/ads/mailAdvertiser.json?{captcha_params}&adId=86476&email=john@example.com&name=John+Smith&message=Cool+ad!

Returns an empty success response if it completes without error.


User profile. Create

http://www.annonsera.se/api/profile/new

Create user profile.

Authentication

Required captcha.

Arguments
  • email (Required)
  • password (Required)
  • name (Optional)
  • address (Optional)
  • type (Optional) One of: person, company. Defaults to person.
  • allowNotices (Optional) 1 if you want to receive notices/announcements, 0 to not. Defaults to 1.
Examples
http://www.annonsera.se/api/profile/new.json?{captcha_params}&email=john@example.com&password=123456&name=John+Smith&address=London
{
    "profile": {
        "id": 3456
    }
}

User profile. Get

http://www.annonsera.se/api/profile/get

Get info about user profile.

Authentication

Required OAuth.

Arguments

None.

Examples
http://www.annonsera.se/api/profile/get.json
{
    "profile": {
        "id": 3456,
        "email": "john@example.com",
        "name": "John Smith",
        "address": "London",
        "type": "person",
        "allowNotices": 1
    }
}

User profile. Update

http://www.annonsera.se/api/profile/update

Update user info.

Authentication

Required OAuth.

Arguments
  • name (Optional)
  • address (Optional)
Examples
http://www.annonsera.se/api/profile/update.json?name=John+Smith&address=Hollywood

Returns an empty success response if it completes without error.

User profile. Change password

http://www.annonsera.se/api/profile/changePassword

Change user password.

Authentication

Required OAuth.

Arguments
  • currentPassword (Required) Current password.
  • newPassword (Required) New password.
Examples
http://www.annonsera.se/api/profile/changePassword.json?currentPassword=123456&newPassword=qwerty

Returns an empty success response if it completes without error.

User profile. Change email

http://www.annonsera.se/api/profile/changeEmail

Change user email.

Authentication

Required OAuth.

Arguments
  • currentEmail (Required) Current email.
  • newEmail (Required) New email.
Examples
http://www.annonsera.se/api/profile/changeEmail.json?currentEmail=123456@example.com&newEmail=qwerty@example.com

Returns an empty success response if it completes without error.


Subscriptions. Annonsera news

http://www.annonsera.se/api/subscriptions.news/update

Subscribe or unsubscribe to/from Annonsera news.

Authentication

Required OAuth.

Arguments
  • subscribe (Required) 1 to subscribe, 0 to unsubscribe.
Examples
http://www.annonsera.se/api/subscriptions.news/update.json?subscribe=1

Returns an empty success response if it completes without error.


Subscriptions. Create

http://www.annonsera.se/api/subscriptions/new

Create new subscription.

Authentication

Required OAuth.

Arguments
  • categoryId (category) or cityId (city) or adId (Required) Category or city to find ads within. Or ID of pattern ad to find similar ads to. Category name must be in format: Category/Subcategory, example: FORDON/Bilar. City name must be in format: Region/City, example: Norrbotten/Pajala.
  • adTypes (Required) Ad types separated by semicolon (;). Available types: sell, buy, rent, wish-to-rent, swap, giveaway, job-available, seeking-job, lost, found. Examples: sell;rent.
  • periodicity (Required) Periodicity of checking for the new ads in seconds. Examples: every hour: 3600; every day: 86400; every 7 days: 604800.
Examples
http://www.annonsera.se/api/subscriptions/new.json?categoryId=110&adTypes=sell;rent&periodicity=86400
{
    "subscription": {
        "id": 23,
        "name": "Sell, Rent in category FORDON/Bilar, every day",
        "category": "FORDON/Bilar",
        "categoryId": 110,
        "adTypes": "sell;rent",
        "periodicity": 86400
    }
}


Subscriptions. Get

http://www.annonsera.se/api/subscriptions/get

Get subscription info.

Authentication

Required OAuth.

Arguments
  • subscriptionId (Required) ID of your subscription.
Examples
http://www.annonsera.se/api/subscriptions/get.json?subscriptionId=23
{
    "subscription": {
        "id": 23,
        "name": "Sell, Rent in category FORDON/Bilar, every day",
        "category": "FORDON/Bilar",
        "categoryId": 110,
        "adTypes": "sell;rent",
        "periodicity": 86400
    }
}

Subscriptions. List

http://www.annonsera.se/api/subscriptions/list

List all subscriptions.

Authentication

Required OAuth.

Arguments

None.

Examples
http://www.annonsera.se/api/subscriptions/list.json
{
    "subscriptions": [
        {
            "id": 23,
            "name": "Sell, Rent in category FORDON/Bilar, every day",
            "category": "FORDON/Bilar",
            "categoryId": 110,
            "adTypes": "sell;rent",
            "periodicity": 86400
        },
        {
            "id": 45,
            "name": "Buy in city Norrbotten/Pajala, every hour",
            "city": "Norrbotten/Pajala",
            "cityId": 56,
            "adTypes": "buy",
            "periodicity": 3600
        },
        {
            "id": 67,
            "name": "Sell, Buy, Rent related to "Utebord + 4 stolar", every week",
            "ad": "Utebord + 4 stolar",
            "adId": 86476,
            "adTypes": "sell;buy;rent",
            "periodicity": 7200
        }
    ]
}

Subscriptions. Update

http://www.annonsera.se/api/subscriptions/update

Update subscription.

Authentication

Required OAuth.

Arguments
  • subscriptionId (Required) ID of your subscription to update.
  • adTypes (Optional) Ad types separated by semicolon (;). Available types: sell, buy, rent, wish-to-rent, swap, giveaway, job-available, seeking-job, lost, found. Examples: sell;rent.
  • periodicity (Optional) Periodicity of checking for the new ads in seconds. Examples: every hour: 3600; every day: 86400; every 7 days: 604800.
Examples
http://www.annonsera.se/api/subscriptions/update.json?subscriptionId=23&adTypes=buy&periodicity=3600

Returns an empty success response if it completes without error.


Subscriptions. Delete

http://www.annonsera.se/api/subscriptions/delete

Delete subscription(s).

Authentication

Required OAuth.

Arguments
  • subscriptionIds (Required) IDs of your subscriptions to delete separated by semicolon (;).
Examples
http://www.annonsera.se/api/subscriptions/delete.json?subscriptionIds=23

Returns an empty success response if it completes without error.


Using of captcha

  • Request captcha ID and image URL.
  • Post captcha ID and text from image among with other method params.

Indeed captcha ID is ID of PHP session.

Request new captcha session
http://www.annonsera.se/api/captcha/new

No authentication required.

Example response:
{
    "captcha": {
        "id": "ca83eec01e85ccfce435ff8b0cd172e7",
        "imageUrl": "http://www.annonsera.se/captcha.html?captchaId=d801036882a46484a80e8ae74d8c0b59"
    }
}
Captcha params

To execute method that requires captcha such parameters must be posted:

  • captchaId (Required)
  • captchaText (Required) Text from captcha image.


Client Libraries and Samples

Annonsera PHP API - API wrapper classes in PHP with samples of calls made to API.

Got a Question?

Contact us at clientapi@annonsera.se

See also

Annonsera widgets

Ad Import Tool