API

Sugester API is implemented by REST. Data is sent and received via HTTP and XML.

API only works with PRO and MAX accounts

Authentication

Each request must include authentication by login and password. Additionally, the url must refer to a specific forum, for example http://YOUR_FORUM.helpocean.com. Example:


  
	curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u TWOJ_LOGIN:TWOJE_HASLO \
	     http://sugester.sugester.pl/app/users/me.xml
					

Parameters

Parameters can be passed by the XML (required for POST):

  
  
	curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u TWOJ_LOGIN:TWOJE_HASLO \
	     http://sugester.sugester.pl/ -d '<order>rejected</order>'
		

or in the URL:

  
  
	curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u TWOJ_LOGIN:TWOJE_HASLO \
	     http://sugester.sugester.pl/?order=rejected'
		

Users

Download your data

GET http://NAZWA_FORUM.sugester.pl/app/users/me.xml

resoult:


	
	 <user>
	  <created-at type="datetime">2009-01-26T18:06:53+01:00</created-at>
	  <description>administrator sugestera...</description>
	  <email>email@email.pl</email>
	  <login>sugester</login>
	  <name>Sugester</name>
	  <notification>all</notification>
	  <updated-at type="datetime">2009-02-02T00:34:02+01:00</updated-at>
	  <www>www.sugester.pl</www>
	</user>
	


Download of colleague lists

GET http://NAZWA_FORUM.sugester.pl/app/users/team.xml

resoult:


  
	
	<users type="array">
	  <user>
		  <created-at type="datetime">2009-01-26T18:06:53+01:00</created-at>
		  <description>administrator sugestera...</description>
		  <email>email@email.pl</email>
		  <login>sugester</login>
		  <name>Sugester</name>
		  <notification>all</notification>
		  <updated-at type="datetime">2009-02-02T00:34:02+01:00</updated-at>
		  <www>www.sugester.pl</www>
	  </user>
	  <user>
		  <created-at type="datetime">2009-01-26T18:06:53+01:00</created-at>
		  <description>administrator sugestera...</description>
		  <email>email2@email.pl</email>
		  <login>sugester2</login>
		  <name>Sugester</name>
		  <notification>all</notification>
		  <updated-at type="datetime">2009-02-02T00:34:02+01:00</updated-at>
		  <www>www.sugester2.pl</www>
	  </user>
	</users>
	
	

Suggestions

Download of suggestions list from the main category. Parameters (order, page) can be transmitted as with HTML.

GET http://NAZWA_FORUM.sugester.pl/ - first category
GET http://NAZWA_FORUM.sugester.pl/NAZWA_KATEGORII - selected category
GET http://NAZWA_FORUM.sugester.pl/?order=new&page=2 - an example parameterization

resoult:


	
	<posts type="array">
	 <post>
	    <agent>Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2</agent>
	    <comments-cache type="integer">0</comments-cache>
	    <content>tak aby by&#322;a podobna do strony / produktu kt&#243;rej dotyczy </content>
	    <created-at type="datetime">2009-08-17T00:26:10+02:00</created-at>
	    <id type="integer">10464</id>
	    <title>zmiana wygl&#261;du forum sugestii i buttona</title>
	    <updated-at type="datetime">2009-09-07T13:32:49+02:00</updated-at>
	    <votes-cache type="integer">2</votes-cache>
	  </post>
	 <post>
	    <agent>Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2</agent>
	    <comments-cache type="integer">0</comments-cache>
	    <content>tak aby by&#322;a podobna do strony / produktu kt&#243;rej dotyczy22 </content>
	    <created-at type="datetime">2009-08-17T00:26:10+02:00</created-at>
	    <id type="integer">104641</id>
	    <title>zmiana wygl&#261;du forum sugestii i buttona</title>
	    <updated-at type="datetime">2009-09-07T13:32:49+02:00</updated-at>
	    <votes-cache type="integer">2</votes-cache>
	  </post>
	</posts>
	


translation missing: en.activerecord.attributes.api.cats_from_forum

GET http://NAZWA_FORUM.sugester.pl/app/categories.xml

resoult:



	<categories type="array">
	  <category>
	    <id type="integer">1</id>
	    <name>sugestie u&#380;ytkownik&#243;w</name>
	  </category>
	  <category>
	    <id type="integer">785</id>
	    <name>nasze plany...</name>
	  </category>
	</categories>




Display of a single suggestion, along with comments

GET http://NAZWA_FORUM.sugester.pl/app/posts/POST_ID.xml

resoult:



	<hash>
	  <comments type="array">
	    <comment>
	      <agent>Mozilla/5.0</agent>
	      <comment>i super !!:)</comment>
	      <created-at type="datetime">2009-09-19T17:33:57+02:00</created-at>
	      <id type="integer">89011</id>
	      <kind nil="true"></kind>
	      <updated-at type="datetime">2009-09-19T17:33:57+02:00</updated-at>
	    </comment>
	    <comment>
	      <agent>Mozilla/5.0 </agent>
	      <comment>zaromb</comment>
	      <created-at type="datetime">2009-10-12T17:08:17+02:00</created-at>
	      <id type="integer">89654</id>
	      <kind nil="true"></kind>
	      <updated-at type="datetime">2009-10-12T17:08:17+02:00</updated-at>
	    </comment>
	    <comment>
	      <agent>Mozilla/5.0 </agent>
	      <comment>i to taz</comment>
	      <created-at type="datetime">2009-10-12T17:12:42+02:00</created-at>
	      <id type="integer">89656</id>
	      <kind nil="true"></kind>
	      <updated-at type="datetime">2009-10-12T17:12:42+02:00</updated-at>
	    </comment>
	  </comments>
	  <post>
	    <agent>Mozilla/5.0</agent>
	    <category-id type="integer">1</category-id>
	    <comments-cache type="integer">3</comments-cache>
	    <content>Powinno tez by&#263; SPA i tam cy by&#322;y maseczki , gor&#261;ce &#380;r&#243;d&#322;a , ora i to by 
			podwy&#380;sza&#322;o energie</content>
	    <created-at type="datetime">2009-09-10T19:01:53+02:00</created-at>
	    <id type="integer">12934</id>
	    <kind>suggestion</kind>
	    <responsible-id type="integer" nil="true"></responsible-id>
	    <status>new</status>
	    <title>SPA</title>
	    <updated-at type="datetime">2009-11-13T19:06:41+01:00</updated-at>
	    <votes-cache type="integer">5</votes-cache>
	  </post>
	</hash>




Adding a post

POST http://NAZWA_FORUM.sugester.pl/app/posts.xml

example of call:



	curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u LOGIN:HASLO
	  http://sugester.sugester.pl/app/posts 
	  -d '<post><title>temat sugestii</title><content>tresc sugestii</content></post>'



resoult:



	<post>
	  <agent>curl/7.16.1 (i386-apple-darwin8.11.1) libcurl/7.16.1 OpenSSL/0.9.8e zlib/1.2.3</agent>
	  <category-id type="integer">1</category-id>
	  <comments-cache type="integer">0</comments-cache>
	  <content>tresc sugestii</content>
	  <created-at type="datetime">2009-01-05T23:12:02+01:00</created-at>
	  <id type="integer">20871</id>
	  <kind>suggestion</kind>
	  <responsible-id type="integer" nil="true"></responsible-id>
	  <status>new</status>
	  <title>temat sugestii</title>
	  <updated-at type="datetime">2009-01-05T23:12:02+01:00</updated-at>
	  <votes-cache type="integer">0</votes-cache>
	</post>



Deleting a post

DELETE http://NAZWA_FORUM.sugester.pl/app/posts/POST_ID.xml





Dodanie użytkownika

POST http://NAZWA_FORUM.sugester.pl/app/users.xml



	curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u LOGIN:HASLO
	  http://sugester.sugester.pl/app/users.xml 
	  -d '<user><login>login1</login><email>email1@sugester.pl</email><password>password1</password></user>'