Validate & Consume a Code
From ePrize Developers Wiki
(New page: {{RESTfulAPI |crumbs=API Home Page :: Code Services |summary=TODO: Fill me in. }} {{RESTfulExample |title=Successfully Validate & Consume a Code |summary=This demonstrates success...) |
|||
(2 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
+ | <font style="color: red; font-style: italic;">Code Services API calls will not be available until September 2009.</font> | ||
{{RESTfulAPI | {{RESTfulAPI | ||
|crumbs=[[API Home Page]] :: [[Code Services]] | |crumbs=[[API Home Page]] :: [[Code Services]] | ||
Line 8: | Line 9: | ||
|summary=This demonstrates successfully validating and consuming a code. | |summary=This demonstrates successfully validating and consuming a code. | ||
|request=profile: http://{client}.api.promo.eprize.com/v1/{apikey}/profile/{uid} | |request=profile: http://{client}.api.promo.eprize.com/v1/{apikey}/profile/{uid} | ||
- | |responsecode= | + | codeClass: {codeClass} |
+ | |responsecode=200 OK | ||
|response=<?xml version="1.0" encoding="UTF-8" ?> | |response=<?xml version="1.0" encoding="UTF-8" ?> | ||
- | <result ver="1.0"> | + | <result ver="1.0"></result> |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | </result> | + | |
|extranotes=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. | |extranotes=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. | ||
}} | }} | ||
{{RESTfulExample | {{RESTfulExample | ||
- | |title= | + | |title=Attempting to Validate & Consume a Code with no Profile |
- | |summary=This demonstrates | + | |summary=This demonstrates an unsuccessful attempt at validating & consuming a code without providing a profile (or providing a bad one). |
|request=profile: foo | |request=profile: foo | ||
|responsecode=400 Bad Request | |responsecode=400 Bad Request | ||
Line 29: | Line 24: | ||
<result ver="1.0"> | <result ver="1.0"> | ||
<reason>Unable to validate the provided profile.</reason> | <reason>Unable to validate the provided profile.</reason> | ||
- | <status>0</status> | ||
</result> | </result> | ||
}} | }} | ||
{{RESTfulExample | {{RESTfulExample | ||
- | |title= | + | |title=Attempting to Validate & Consume a Code for a code class that doesn't exist |
- | |summary=This demonstrates | + | |summary=This demonstrates an unsuccessful attempt at validating & consuming a code without providing a code class (or providing a bad one). |
- | |responsecode= | + | |request=profile: http://{client}.api.promo.eprize.com/v1/{apikey}/profile/{uid} |
+ | codeClass: foo | ||
+ | |responsecode=400 Bad Request | ||
+ | |response=<?xml version="1.0" encoding="UTF-8"?> | ||
+ | <result ver="1.0"> | ||
+ | <reason>The specified code class does not exist.</reason> | ||
+ | </result> | ||
+ | }} | ||
+ | |||
+ | {{RESTfulExample | ||
+ | |title=Attempting to Validate & Consume a Code that doesn't exist | ||
+ | |summary=This demonstrates an unsuccessful attempt at validating & consuming a code that doesn't exist. | ||
+ | |responsecode=400 Bad Request | ||
|response=<?xml version="1.0" encoding="UTF-8"?> | |response=<?xml version="1.0" encoding="UTF-8"?> | ||
<result ver="1.0"> | <result ver="1.0"> | ||
+ | <reason>The specified code does not exist.</reason> | ||
</result> | </result> | ||
}} | }} |
Current revision
Code Services API calls will not be available until September 2009.
API Home Page :: Code Services
Summary
TODO: Fill me in.
Example: Successfully Validate & Consume a Code
Summary
This demonstrates successfully validating and consuming a code.
Request
profile: http://{client}.api.promo.eprize.com/v1/{apikey}/profile/{uid} codeClass: {codeClass}
Response
HTTP Status Code: 200 OK
<?xml version="1.0" encoding="UTF-8" ?> <result ver="1.0"></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.
Example: Attempting to Validate & Consume a Code with no Profile
Summary
This demonstrates an unsuccessful attempt at validating & consuming a code without providing a profile (or providing a bad one).
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> </result>
Example: Attempting to Validate & Consume a Code for a code class that doesn't exist
Summary
This demonstrates an unsuccessful attempt at validating & consuming a code without providing a code class (or providing a bad one).
Request
profile: http://{client}.api.promo.eprize.com/v1/{apikey}/profile/{uid} codeClass: foo
Response
HTTP Status Code: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?> <result ver="1.0"> <reason>The specified code class does not exist.</reason> </result>
Example: Attempting to Validate & Consume a Code that doesn't exist
Summary
This demonstrates an unsuccessful attempt at validating & consuming a code that doesn't exist.
Response
HTTP Status Code: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?> <result ver="1.0"> <reason>The specified code does not exist.</reason> </result>