|
|
Line 1: |
Line 1: |
| {{RESTfulAPI | | {{RESTfulAPI |
- | |crumbs=[[API Home Page]] :: [[Profiles]] | + | |crumbs=[[API Home Page]] :: [[Configuration]] |
- | |summary=Promotions are always configured with one unique {profile-key} such as email, user_name, or mobile_phone. When creating a profile, the profile must have a {profile-value} for this key and {profile-value} must be unique within the promotion. | + | |summary=Create a promotion owned by the authenticated account. Promotions created this way are pure web service promotions without any custom behavior, without creative, and without flow. |
- | | + | |
- | If profile creation is successful, a unique URL identifying the profile will be returned in the HTTP "Location" header. If tunneling is requested, the URL will be present in the body of the response in the "location" attribute on the top-level element. HTTP responses may pass through additional proxy layers which alter the case of the "Location" header--the HTTP standard requires header names to be case-insensitive.
| + | |
- | | + | |
- | Additional key:value pairs may be submitted. The {apikey} may enforce rules on these pairs such as required vs optional, size limits and validation. Common examples of other keys are address, birthdate and optin. The name of a key must begin with a letter and consist of only lowercase ASCII letters, numbers and underscores. The specific behavior depends entirely on a promotion's configuration.
| + | |
- | | + | |
- | Typically the {apikey} will be configured to require a CAPTCHA challenge/response in the request headers of an untrusted create profile request. A failed CAPTCHA is the same as a failed validation, resulting in a response of 400 Bad Request.
| + | |
- | | + | |
- | This URL is an entry point. It may be easily attacked because valid URLs are easy to guess. CAPTCHA protects against automated attacks.
| + | |
| }} | | }} |
| | | |
| {{RESTfulExample | | {{RESTfulExample |
- | |title=Profile Created | + | |title=Promotion Created |
- | |summary=This demonstrates a successful profile creation. | + | |summary=This demonstrates a successful promotion creation. |
- | |request=Form Post Variables | + | |request=XML configuration for promotion |
- | email:some.email@address.com
| + | <?xml version="1.0" encoding="utf-8"?> |
- | public1:public-value1
| + | <prizekin |
- | public2:public-value2
| + | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
- | ... | + | xsi:type="com.eprize.Prizekin"> |
- | publicN:public-valueN
| + | </prizekin> |
- | private1:private-value1
| + | |
- | private2:private-value2
| + | |
- | ...
| + | |
- | privateN:private-valueN
| + | |
| |responsecode=201 Created | | |responsecode=201 Created |
- | |responseloc=/v1/{apikey}/profile/{uid} | + | |responseloc=/v1/{apikey} |
- | |response=<?xml version="1.0" encoding="UTF-8" ?> | + | |response= |
- | <result ver="1.0">
| + | |
- | <profile>
| + | |
- | <id>{profile-number}</id>
| + | |
- | <email>some.email@address.com</email>
| + | |
- | <public1>public-value1</public1>
| + | |
- | <public2>public-value2</public2>
| + | |
- | ...
| + | |
- | <publicN>public-valueN</publicN>
| + | |
- | </profile>
| + | |
- | </result>
| + | |
- | }}
| + | |
- | | + | |
- | {{RESTfulExample
| + | |
- | |title=Profile Already Exists
| + | |
- | |summary=This demonstrates an attempted profile creation that got rejected because a profile with the unique id (email in most cases) already exists.
| + | |
- | |responsecode=409 Conflict
| + | |
- | |response=<?xml version="1.0" encoding="UTF-8" ?>
| + | |
- | <result ver="1.0">
| + | |
- | <terminal_error>duplicate_account</terminal_error>
| + | |
- | </result>
| + | |
- | }}
| + | |
- | | + | |
- | {{RESTfulExample
| + | |
- | |title=Invalid Request - Errors
| + | |
- | |responsecode=400 Bad Request
| + | |
- | |response=<?xml version="1.0" encoding="UTF-8" ?>
| + | |
- | <result ver="1.0">
| + | |
- | <input_error>
| + | |
- | <error>VALIDATION</error>
| + | |
- | <name>field1</name>
| + | |
- | </input_error>
| + | |
- | <input_error>
| + | |
- | <name>field2</name>
| + | |
- | <error>NULL</error>
| + | |
- | </input_error>
| + | |
- | ...
| + | |
- | <input_error>
| + | |
- | <name>fieldN</name>
| + | |
- | <error>NULL</error>
| + | |
- | </input_error>
| + | |
- | </result>
| + | |
- | }}
| + | |
- | | + | |
- | {{RESTfulExample
| + | |
- | |title=Invalid Request - Errors in JSON Format
| + | |
- | |responsecode=400 Bad Request
| + | |
- | |response={
| + | |
- | "result" : {
| + | |
- | "input_error" : [
| + | |
- | {
| + | |
- | "error" : "NULL",
| + | |
- | "name" : "field1"
| + | |
- | },
| + | |
- | {
| + | |
- | "name" : "field2"
| + | |
- | "error" : "VALIDATION",
| + | |
- | },
| + | |
- | ...
| + | |
- | {
| + | |
- | "error" : "NULL",
| + | |
- | "name" : "fieldN"
| + | |
- | },
| + | |
- | ]
| + | |
- | }
| + | |
- | }
| + | |
| }} | | }} |
Create a promotion owned by the authenticated account. Promotions created this way are pure web service promotions without any custom behavior, without creative, and without flow.
This demonstrates a successful promotion creation.