Sugester system API

Sugesters API is realized by REST (JSON or XML)

A new API description is available on the following page https://github.com/sugester/API

After login into Sugester in the menu Settings > API you will find examples which will work on the given account. They can also be found here http://api.sugester.pl

Authentication

Every request must must be varified using the users login and passowrd. Additionally, the URL has to contain a link to the suggestion forum i.e. https://YOUR_FORUM.sugester.com. Example:


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

Parameters

Parameters can be redirected using XML (required by 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

Extracting Your Data

GET http://NAME_FORUM.sugester.com/app/users/me.xml

result:


	
	 <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>
	

 

 

Extracting employee list

 

 

GET http://NAME_FORUM.sugester.com/app/users/team.xml

Result:


  
	
	<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

Extracting the suggestions from the main category. Parameters (order, page) can be redirect just like in the HTML version.

GET http://NAME_FORUM.sugester.com/ - first category
GET http://NAME_FORUM.sugester.com/NAZWA_KATEGORII - selected category
GET http://NAE_FORUM.sugester.com/?order=new&page=2 - parameter example

Result:


	
	<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>
	

 

 

Cats from forum

 

 

GET http://NAME_FORUM.sugester.com/app/categories.xml

Result:



	<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>


 

 

Displaying a single suggestions along with comments

 

 

GET http://NAME_FORUM.sugester.com/app/posts/POST_ID.xml

Result:



	<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://NAZME_FORUM.sugester.com/app/posts.xml
 

extract example:



	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>'



Result:



	<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://NAME_FORUM.sugester.com/app/posts/POST_ID.xml
 

 

 

 

 

Adding a user

 

 

 

 

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>'