Rate a Contest Entry

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
(Rate a Contest Entry)
Current revision (19:17, 19 April 2011) (edit) (undo)
 
(4 intermediate revisions not shown.)
Line 1: Line 1:
-
==== Rate a Contest Entry ====
+
{{RESTfulAPI
 +
|crumbs=[[API Home Page]] :: [[Contest API|Contest]]
-
Rate a contest entry with an invalid rating:
+
|summary=Rate a [[Enter Contest|contest entry]]. A rating is provided by a user and must be associated with a profile. The average rating is recomputed with each rate action.
 +
|resource=/v1/{apikey}/contest/entry/{entryId}/rate
 +
|methods=POST
 +
|resourceargs='''apikey''': Your [[API Key]].
-
$ curl -i -X POST -H "Accept: text/xml" \
+
'''entryid''': ID of the entry retrieved from [[Enter Contest|entry creation]] or by viewing the [[Browse_Contest_Gallery|gallery]].
-
-dprofile=http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV \
+
|paramsrequired='''profile''': Canonical Location of a user profile. See: [[Fetch profile by key]]
-
-drating=h \
+
-
http://test.url.eprize.com/v1/solution/contestv2/contest/entry/1/rate
+
-
+
-
HTTP 400 (Bad Request)
+
-
Cache-Control: no-cache
+
-
Connection: close
+
-
Date: Thu, 01 Apr 2010 04:00:00 GMT
+
-
Pragma: no-cache
+
-
Server: POE HTTPD Component/0.09 (5.008008)
+
-
Content-Length: 147
+
-
Content-Type: text/xml; charset=utf-8
+
-
Expires: Mon, 26 Jul 2010 16:56:20 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
-
<result>
+
-
<input_error>
+
-
<name>rating</name>
+
-
<error>VALIDATION</error>
+
-
</input_error>
+
-
</result>
+
-
Rate an entry successfully:
+
'''rating''': numeric rating 1 - 5
 +
}}
-
$ curl -i -X POST -H "Accept: text/xml" \
+
{{RESTfulExample
-
-dprofile=http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV \
+
|title=Rate an entry successfully:
-
-drating=1 \
+
|summary=Demonstrates successful response
-
http://test.url.eprize.com/v1/solution/contestv2/contest/entry/1/rate
+
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
-
+
rating: 1
-
HTTP 200 (OK)
+
|responsecode=200 OK
-
Cache-Control: no-cache
+
|response=<?xml version="1.0" encoding="UTF-8" ?>
-
Connection: close
+
-
Date: Thu, 01 Apr 2010 04:00:00 GMT
+
-
Pragma: no-cache
+
-
Server: POE HTTPD Component/0.09 (5.008008)
+
-
Content-Length: 502
+
-
Content-Type: text/xml; charset=utf-8
+
-
Expires: Mon, 26 Jul 2010 16:56:54 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
<result>
<result>
<entry>
<entry>
Line 62: Line 38:
</entry>
</entry>
</result>
</result>
 +
}}
-
Already reached rating limit:
+
{{RESTfulExample
 +
|title=Rate a contest entry with an invalid rating
 +
|summary=Demonstrates error response
 +
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
 +
rating: h
 +
|responsecode=400 Bad Request
 +
|response=<?xml version="1.0" encoding="UTF-8" ?>
 +
<result>
 +
<input_error>
 +
<name>rating</name>
 +
<error>VALIDATION</error>
 +
</input_error>
 +
</result>
 +
}}
-
$ curl -i -X POST -H "Accept: text/xml" \
+
{{RESTfulExample
-
-dprofile=http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV \
+
|title=Already reached rating limit
-
-drating=1 \
+
|summary=Demonstrates unsuccessful response
-
http://test.url.eprize.com/v1/solution/contestv2/contest/entry/1/rate
+
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
-
+
rating: 1
-
HTTP 400 (Bad Request)
+
|responsecode=400 Bad Request
-
Cache-Control: no-cache
+
|response=<?xml version="1.0" encoding="UTF-8" ?>
-
Connection: close
+
-
Date: Thu, 01 Apr 2010 04:00:00 GMT
+
-
Pragma: no-cache
+
-
Server: POE HTTPD Component/0.09 (5.008008)
+
-
Content-Length: 144
+
-
Content-Type: text/xml; charset=utf-8
+
-
Expires: Mon, 26 Jul 2010 16:57:31 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
<result>
<result>
<input_error>
<input_error>
Line 87: Line 68:
</input_error>
</input_error>
</result>
</result>
 +
}}
-
Rating timeout:
+
{{RESTfulExample
-
 
+
|title=Rating timeout
-
$ curl -i -X POST -H "Accept: text/xml" \
+
|summary=Demonstrates unsuccessful response
-
-dprofile=http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV \
+
|responsecode=400 Bad Request
-
-drating=1 \
+
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
-
http://test.url.eprize.com/v1/solution/contestv2/contest/entry/1/rate
+
rating: 1
-
+
|response=<?xml version="1.0" encoding="UTF-8" ?>
-
HTTP 400 (Bad Request)
+
-
Cache-Control: no-cache
+
-
Connection: close
+
-
Date: Wed, 07 Apr 2010 08:48:00 GMT
+
-
Pragma: no-cache
+
-
Server: POE HTTPD Component/0.09 (5.008008)
+
-
Content-Length: 155
+
-
Content-Type: text/xml; charset=utf-8
+
-
Expires: Mon, 26 Jul 2010 17:32:09 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
<result>
<result>
<input_error>
<input_error>
Line 112: Line 83:
</input_error>
</input_error>
</result>
</result>
 +
}}
-
Rating in wrong phase:
+
{{RESTfulExample
-
 
+
|title=Rating in wrong phase:
-
$ curl -i -X POST -H "Accept: text/xml" \
+
|summary=Demonstrates unsuccessful response
-
-dprofile=http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV \
+
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
-
-drating=1 \
+
rating: 1
-
http://test.url.eprize.com/v1/solution/contestv2/contest/entry/1/rate
+
|responsecode=400 Bad Request
-
+
|response=<?xml version="1.0" encoding="UTF-8" ?>
-
HTTP 400 (Bad Request)
+
-
Cache-Control: no-cache
+
-
Connection: close
+
-
Date: Thu, 25 Mar 2010 04:00:00 GMT
+
-
Pragma: no-cache
+
-
Server: POE HTTPD Component/0.09 (5.008008)
+
-
Content-Length: 108
+
-
Content-Type: text/xml; charset=utf-8
+
-
Expires: Mon, 26 Jul 2010 17:47:23 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
<result>
<result>
<terminal_error>OUT_OF_PHASE</terminal_error>
<terminal_error>OUT_OF_PHASE</terminal_error>
</result>
</result>
 +
}}
-
Rating non-existent entry:
+
{{RESTfulExample
-
 
+
|title=Rating non-existent entry
-
$ curl -i -X POST -H "Accept: text/xml" \
+
|summary=Demonstrates unsuccessful response
-
-dprofile=http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV \
+
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
-
-drating=1 \
+
rating: 1
-
http://test.url.eprize.com/v1/solution/contestv2/contest/entry/5/rate
+
|responsecode=404 Not Found
-
+
|response=<?xml version="1.0" encoding="UTF-8" ?>
-
HTTP 404 (Not Found)
+
-
Cache-Control: no-cache
+
-
Connection: close
+
-
Date: Thu, 01 Apr 2010 04:00:00 GMT
+
-
Pragma: no-cache
+
-
Server: POE HTTPD Component/0.09 (5.008008)
+
-
Content-Length: 81
+
-
Content-Type: text/xml; charset=utf-8
+
-
Expires: Mon, 26 Jul 2010 17:48:16 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
<result>
<result>
<status>0</status>
<status>0</status>
</result>
</result>
 +
}}

Current revision

API Home Page :: Contest

Summary

Rate a contest entry. A rating is provided by a user and must be associated with a profile. The average rating is recomputed with each rate action.

Resource

/v1/{apikey}/contest/entry/{entryId}/rate

Valid Methods

POST

Resource Arguments

Note: resource arguments are always required.

apikey: Your API Key.

entryid: ID of the entry retrieved from entry creation or by viewing the gallery.

Parameters Required

profile: Canonical Location of a user profile. See: Fetch profile by key

rating: numeric rating 1 - 5



Example: Rate an entry successfully:

Summary

Demonstrates successful response

Request

profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
rating: 1

Response

HTTP Status Code: 200 OK


<?xml version="1.0" encoding="UTF-8" ?>
 <result>
   <entry>
     <body>this is the body of my essay</body>
     <category></category>
     <city></city>
     <description></description>
     <entry_id></entry_id>
     <entry_state>approved</entry_state>
     <first_name></first_name>
     <last_name></last_name>
     <rating_ave>0.667</rating_ave>
     <rating_count>3</rating_count>
     <state></state>
     <title>this is the title of my essay</title>
     <views>0</views>
     <votes>0</votes>
   </entry>
 </result>


Example: Rate a contest entry with an invalid rating

Summary

Demonstrates error response

Request

profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
rating: h

Response

HTTP Status Code: 400 Bad Request


<?xml version="1.0" encoding="UTF-8" ?>
 <result>
   <input_error>
     <name>rating</name>
     <error>VALIDATION</error>
   </input_error>
 </result>


Example: Already reached rating limit

Summary

Demonstrates unsuccessful response

Request

profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
rating: 1

Response

HTTP Status Code: 400 Bad Request


<?xml version="1.0" encoding="UTF-8" ?>
 <result>
   <input_error>
     <name>rating</name>
     <error>LIMITED</error>
   </input_error>
 </result>


Example: Rating timeout

Summary

Demonstrates unsuccessful response

Request

profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
rating: 1

Response

HTTP Status Code: 400 Bad Request


<?xml version="1.0" encoding="UTF-8" ?>
 <result>
   <input_error>
     <name>profile_id</name>
     <error>RATING_TIMEOUT</error>
   </input_error>
 </result>


Example: Rating in wrong phase:

Summary

Demonstrates unsuccessful response

Request

profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
rating: 1

Response

HTTP Status Code: 400 Bad Request


<?xml version="1.0" encoding="UTF-8" ?>
 <result>
   <terminal_error>OUT_OF_PHASE</terminal_error>
 </result>


Example: Rating non-existent entry

Summary

Demonstrates unsuccessful response

Request

profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
rating: 1

Response

HTTP Status Code: 404 Not Found


<?xml version="1.0" encoding="UTF-8" ?>
 <result>
   <status>0</status>
 </result>


Personal tools