Vote on a Contest Entry

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
(New page: ==== Vote on a Contest Entry ==== Voting during wrong phase: $ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1.5J4L55FNLN2CZZDV \ http://127.0.0.1:10001/v1/solution/contestv2/...)
Current revision (19:34, 19 April 2011) (edit) (undo)
 
(One intermediate revision not shown.)
Line 1: Line 1:
-
==== Vote on a Contest Entry ====
+
{{RESTfulAPI
 +
|crumbs=[[API Home Page]] :: [[Contest API|Contest]]
 +
|summary=Vote on a [[Enter Contest|contest entry]]. The vote count can be retrieved later and displayed with an entry or in the gallery.
 +
|resource=/v1/{apikey}/contest/entry/{entryId}/vote
 +
|methods=POST
 +
|resourceargs='''apikey''': Your [[API Key]].
-
Voting during wrong phase:
+
'''entryid''': ID of the entry retrieved from [[Enter Contest|entry creation]] or by viewing the [[Browse_Contest_Gallery|gallery]].
 +
|paramsrequired='''reason''': reason for flagging this entry.
-
$ curl -i -X POST -H "Accept: text/xml" \
+
'''profile''': Canonical Location of a user profile. See: [[Fetch_profile_by_key|Fetch Profile by Key]]
-
-dprofile=1.5J4L55FNLN2CZZDV \
+
}}
-
http://127.0.0.1:10001/v1/solution/contestv2/contest/entry/1/vote
+
{{RESTfulExample
-
+
|title=Successful vote
-
HTTP 400 (Bad Request)
+
|summary=Demonstrates successful response
-
Cache-Control: no-cache
+
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
-
Connection: close
+
|responsecode=200 OK
-
Date: Thu, 01 Apr 2010 04:00:00 GMT
+
|response=<?xml version="1.0" encoding="UTF-8" ?>
-
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 18:23:04 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
-
<result>
+
-
<terminal_error>OUT_OF_PHASE</terminal_error>
+
-
</result>
+
-
 
+
-
Voting timeout:
+
-
 
+
-
$ curl -i -X POST -H "Accept: text/xml" \
+
-
-dprofile=1.5J4L55FNLN2CZZDV \
+
-
http://127.0.0.1:10001/v1/solution/contestv2/contest/entry/1/vote
+
-
+
-
HTTP 400 (Bad Request)
+
-
Cache-Control: no-cache
+
-
Connection: close
+
-
Date: Tue, 20 Jul 2010 12:38: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 18:25:24 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
-
<result>
+
-
<input_error>
+
-
<name>profile_id</name>
+
-
<error>VOTING_TIMEOUT</error>
+
-
</input_error>
+
-
</result>
+
-
 
+
-
Successful vote:
+
-
 
+
-
$ curl -i -X POST -H "Accept: text/xml" \
+
-
-dprofile=1.5J4L55FNLN2CZZDV \
+
-
http://127.0.0.1:10001/v1/solution/contestv2/contest/entry/1/vote
+
-
+
-
HTTP 200 (OK)
+
-
Cache-Control: no-cache
+
-
Connection: close
+
-
Date: Sat, 10 Jul 2010 10:49: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 18:27:03 GMT
+
-
+
-
<?xml version="1.0" encoding="UTF-8" ?>
+
<result>
<result>
<entry>
<entry>
Line 81: Line 35:
</entry>
</entry>
</result>
</result>
 +
}}
 +
{{RESTfulExample
 +
|title=Vote out of phase
 +
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
 +
|responsecode=400 Bad Request
 +
|response=<?xml version="1.0" encoding="UTF-8" ?>
 +
<result>
 +
<terminal_error>OUT_OF_PHASE</terminal_error>
 +
</result>
 +
}}
 +
{{RESTfulExample
 +
|title=Voting timeout
 +
|request=profile: http://test.url.eprize.com/v1/solution/contestv2v2/profile/1.5J4L55FNLN2CZZDV
 +
|responsecode=400 Bad Request
 +
|response=<?xml version="1.0" encoding="UTF-8" ?>
 +
<result>
 +
<input_error>
 +
<name>profile_id</name>
 +
<error>VOTING_TIMEOUT</error>
 +
</input_error>
 +
</result>
 +
}}

Current revision

API Home Page :: Contest

Summary

Vote on a contest entry. The vote count can be retrieved later and displayed with an entry or in the gallery.

Resource

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

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

reason: reason for flagging this entry.

profile: Canonical Location of a user profile. See: Fetch Profile by Key



Example: Successful vote

Summary

Demonstrates successful response

Request

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

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>MI</entry_state>
     <first_name></first_name>
     <last_name></last_name>
     <rating_ave>0.857</rating_ave>
     <rating_count>7</rating_count>
     <state></state>
     <title>this is the title of my essay</title>
     <views>0</views>
     <votes>1</votes>
   </entry>
 </result>


Example: Vote out of phase

Request

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

Response

HTTP Status Code: 400 Bad Request


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


Example: Voting timeout

Request

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

Response

HTTP Status Code: 400 Bad Request


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


Personal tools