Award sweepstakes entry

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
Current revision (14:20, 31 March 2014) (edit) (undo)
 
Line 3: Line 3:
|summary=Awards the profile an [[Sweepstakes Entry|entry]] into the sweepstakes. The pool of entries will be used to select a winner at the end of the sweepstakes game.
|summary=Awards the profile an [[Sweepstakes Entry|entry]] into the sweepstakes. The pool of entries will be used to select a winner at the end of the sweepstakes game.
-
If an entry has been successfully created, a ''201 Created'' response code will be received along with some information about the entry itself. This entry information does not need to be kept and does not need to be provided back to Helloworld.
+
If an entry has been successfully created, a ''201 Created'' response code will be received along with some information about the entry itself. This entry information does not need to be kept and does not need to be provided back to HelloWorld.
Other error scenarios are listed in the examples on this page.
Other error scenarios are listed in the examples on this page.
Line 10: Line 10:
|resourceargs='''apikey''': Your [[API Key]].
|resourceargs='''apikey''': Your [[API Key]].
-
'''gameId''': Game Identifier for the Sweepstakes into which the entry will be awarded. (A constant value provided to you by Helloworld)
+
'''gameId''': Game Identifier for the Sweepstakes into which the entry will be awarded. (A constant value provided to you by HelloWorld)
|paramsrequired='''profile''': Canonical Location of a user profile. See: [[Fetch_profile_by_key|Fetch Profile by Key]].
|paramsrequired='''profile''': Canonical Location of a user profile. See: [[Fetch_profile_by_key|Fetch Profile by Key]].

Current revision

API Home Page :: Games and Awards

Summary

Awards the profile an entry into the sweepstakes. The pool of entries will be used to select a winner at the end of the sweepstakes game.

If an entry has been successfully created, a 201 Created response code will be received along with some information about the entry itself. This entry information does not need to be kept and does not need to be provided back to HelloWorld.

Other error scenarios are listed in the examples on this page.

Resource

/v1/{apikey}/game/{gameid}/sweeps

Valid Methods

POST

Resource Arguments

Note: resource arguments are always required.

apikey: Your API Key.

gameId: Game Identifier for the Sweepstakes into which the entry will be awarded. (A constant value provided to you by HelloWorld)

Parameters Required

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

event: Name of an event to award a sweepstakes entry for (must begin with "api-", e.g. "api-poll" or "api-register") If "event" is not provided, it will default to "sw" which was the former default.



Example: Successfully Awarding a Sweeps Entry

Summary

This demonstrates successfully awarding a sweepstakes entry to a user.

Request

profile: http://{client}.api.promo.eprize.com/v1/{apikey}/profile/{uid}.{webkey}

Response

HTTP Status Code: 201 Created


<?xml version="1.0" encoding="UTF-8" ?>
<result ver="1.0">
  <sweepsEntry>
    <whenEarned>{date-time}</whenEarned>
    <game>{gameid}</game>
  </sweepsEntry>
</result>

Notes

The {profile} value that is seen in the request and response of this call is the canonical URL of the profile that the token should be awarded to.

This URL can be easily attacked by the owner of a profile because the owner knows his own canonical profile URL. Award limits create an upper bound on the attack damage.

Example: Awarding Sweeps Entry to Invalid Profile

Summary

This demonstrates attempting to award a sweepstakes entry to a profile resource that doesn't exist.

Request

profile: foo

Response

HTTP Status Code: 400 Bad Request


<?xml version="1.0" encoding="UTF-8"?>
<result ver="1.0">
  <reason>Unable to validate the provided profile.</reason>
  <status>0</status>
</result>


Example: Awarding Sweeps Entry to a Limited Profile

Summary

This demonstrates attempting to overaward sweepstakes entries to a user. For example, the promotion is setup to give out 3 sweeps entries per day per user, and this would be a users 4th attempt in one day.


Response

HTTP Status Code: 403 Forbidden


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


Personal tools