Tell Friends
From ePrize Developers Wiki
(Difference between revisions)
(New page: ==== Tell Friends ====) |
|||
Line 1: | Line 1: | ||
==== Tell Friends ==== | ==== Tell Friends ==== | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=http://127.0.0.1:10001/v1/solution/instantwinv2/profile/1.QYXTJRSBCXZWTCSS \ | ||
+ | -dto_name1='john smith' \ | ||
+ | -dto_email1='john.smith@sample.com' \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 200 (OK) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 19:49:37 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 77 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 19:49:37 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result> | ||
+ | <told>1</told> | ||
+ | </result> | ||
+ | |||
+ | |||
+ | Example of telling 2 friends and using the short form of the profile ID | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=1.QYXTJRSBCXZWTCSS \ | ||
+ | -dto_name1='jane smith' \ | ||
+ | -dto_email1='jane.smith@sample.com' \ | ||
+ | -dto_name2='fred smith' \ | ||
+ | -dto_email2='fred.smith@sample.com' \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 200 (OK) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 19:53:10 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 77 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 19:53:10 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result> | ||
+ | <told>2</told> | ||
+ | </result> | ||
+ | |||
+ | Example with fields missing and formatting errors: | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=1.QYXTJRSBCXZWTCSS \ | ||
+ | -dto_email1='john.smith_sample.com' \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 400 (Bad Request) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 19:55:41 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 233 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 19:55:41 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result> | ||
+ | <input_error> | ||
+ | <name>to_email1</name> | ||
+ | <error>VALIDATION</error> | ||
+ | </input_error> | ||
+ | <input_error> | ||
+ | <name>to_name1</name> | ||
+ | <error>NULL</error> | ||
+ | </input_error> | ||
+ | </result> | ||
+ | |||
+ | Example with invalid profile: | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=1 \ | ||
+ | -dto_name1='john smith' \ | ||
+ | -dto_email1='john.smith@sample.com' \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 403 (Forbidden) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 19:57:24 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 59 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 19:57:24 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result></result> | ||
+ | |||
+ | Example of telling someone a profile has already told before: | ||
+ | |||
+ | (If one duplicate is detected the nobody will be told.) | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=1.QYXTJRSBCXZWTCSS \ | ||
+ | -dto_name1='jane smith' \ | ||
+ | -dto_email1='jane.smith@sample.com' \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 400 (Bad Request) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 20:00:07 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 156 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 20:00:07 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result> | ||
+ | <input_error> | ||
+ | <name>to_email1</name> | ||
+ | <error>ALREADY_REFERRED</error> | ||
+ | </input_error> | ||
+ | </result> | ||
+ | |||
+ | Example of telling the same person more than once in the same request: | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=1.QYXTJRSBCXZWTCSS \ | ||
+ | -dto_name1='ben smith' \ | ||
+ | -dto_email1='ben.smith@sample.com' \ | ||
+ | -dto_name2='ben smith' \ | ||
+ | -dto_email2='ben.smith@sample.com' \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 400 (Bad Request) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 20:02:14 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 325 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 20:02:14 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result> | ||
+ | <input_error> | ||
+ | <name>to_email2</name> | ||
+ | <error>DUPLICATE</error> | ||
+ | </input_error> | ||
+ | <input_error> | ||
+ | <name>to_email1</name> | ||
+ | <error>DUPLICATE</error> | ||
+ | </input_error> | ||
+ | <input_error> | ||
+ | <name>duplicate_email</name> | ||
+ | <error>2</error> | ||
+ | </input_error> | ||
+ | </result> | ||
+ | |||
+ | Example of telling nobody: | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=1.QYXTJRSBCXZWTCSS \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 400 (Bad Request) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 20:04:44 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 312 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 20:04:44 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result> | ||
+ | <input_error> | ||
+ | <name>min_referrals</name> | ||
+ | <error>1</error> | ||
+ | </input_error> | ||
+ | <input_error> | ||
+ | <name>to_email1</name> | ||
+ | <error>NULL</error> | ||
+ | </input_error> | ||
+ | <input_error> | ||
+ | <name>to_name1</name> | ||
+ | <error>NULL</error> | ||
+ | </input_error> | ||
+ | </result> | ||
+ | |||
+ | Example of exceeding limits: | ||
+ | |||
+ | $ curl -i -X POST -H "Accept: text/xml" \ | ||
+ | -dprofile=1.QYXTJRSBCXZWTCSS \ | ||
+ | -dto_name1='ben smith7' \ | ||
+ | -dto_email1='ben.smith7@sample.com' \ | ||
+ | http://test.url.eprize.com/v1/eprize/ews12/viral | ||
+ | |||
+ | HTTP 400 (Bad Request) | ||
+ | Cache-Control: no-cache | ||
+ | Connection: close | ||
+ | Date: Fri, 23 Jul 2010 20:12:38 GMT | ||
+ | Pragma: no-cache | ||
+ | Server: POE HTTPD Component/0.09 (5.008008) | ||
+ | Content-Length: 139 | ||
+ | Content-Type: text/xml; charset=utf-8 | ||
+ | Expires: Fri, 23 Jul 2010 20:12:38 GMT | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" ?> | ||
+ | <result> | ||
+ | <input_error> | ||
+ | <name>limited</name> | ||
+ | <error>1</error> | ||
+ | </input_error> | ||
+ | </result> |
Current revision
Tell Friends
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=http://127.0.0.1:10001/v1/solution/instantwinv2/profile/1.QYXTJRSBCXZWTCSS \ -dto_name1='john smith' \ -dto_email1='john.smith@sample.com' \ http://test.url.eprize.com/v1/eprize/ews12/viral HTTP 200 (OK) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 19:49:37 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 77 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 19:49:37 GMT <?xml version="1.0" encoding="UTF-8" ?> <result> <told>1</told> </result>
Example of telling 2 friends and using the short form of the profile ID
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1.QYXTJRSBCXZWTCSS \ -dto_name1='jane smith' \ -dto_email1='jane.smith@sample.com' \ -dto_name2='fred smith' \ -dto_email2='fred.smith@sample.com' \ http://test.url.eprize.com/v1/eprize/ews12/viral HTTP 200 (OK) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 19:53:10 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 77 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 19:53:10 GMT <?xml version="1.0" encoding="UTF-8" ?> <result> <told>2</told> </result>
Example with fields missing and formatting errors:
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1.QYXTJRSBCXZWTCSS \ -dto_email1='john.smith_sample.com' \ http://test.url.eprize.com/v1/eprize/ews12/viral
HTTP 400 (Bad Request) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 19:55:41 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 233 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 19:55:41 GMT <?xml version="1.0" encoding="UTF-8" ?> <result> <input_error> <name>to_email1</name> <error>VALIDATION</error> </input_error> <input_error> <name>to_name1</name> <error>NULL</error> </input_error> </result>
Example with invalid profile:
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1 \ -dto_name1='john smith' \ -dto_email1='john.smith@sample.com' \ http://test.url.eprize.com/v1/eprize/ews12/viral HTTP 403 (Forbidden) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 19:57:24 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 59 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 19:57:24 GMT <?xml version="1.0" encoding="UTF-8" ?> <result></result>
Example of telling someone a profile has already told before:
(If one duplicate is detected the nobody will be told.)
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1.QYXTJRSBCXZWTCSS \ -dto_name1='jane smith' \ -dto_email1='jane.smith@sample.com' \ http://test.url.eprize.com/v1/eprize/ews12/viral HTTP 400 (Bad Request) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 20:00:07 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 156 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 20:00:07 GMT <?xml version="1.0" encoding="UTF-8" ?> <result> <input_error> <name>to_email1</name> <error>ALREADY_REFERRED</error> </input_error> </result>
Example of telling the same person more than once in the same request:
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1.QYXTJRSBCXZWTCSS \ -dto_name1='ben smith' \ -dto_email1='ben.smith@sample.com' \ -dto_name2='ben smith' \ -dto_email2='ben.smith@sample.com' \ http://test.url.eprize.com/v1/eprize/ews12/viral HTTP 400 (Bad Request) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 20:02:14 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 325 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 20:02:14 GMT <?xml version="1.0" encoding="UTF-8" ?> <result> <input_error> <name>to_email2</name> <error>DUPLICATE</error> </input_error> <input_error> <name>to_email1</name> <error>DUPLICATE</error> </input_error> <input_error> <name>duplicate_email</name> <error>2</error> </input_error> </result>
Example of telling nobody:
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1.QYXTJRSBCXZWTCSS \ http://test.url.eprize.com/v1/eprize/ews12/viral HTTP 400 (Bad Request) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 20:04:44 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 312 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 20:04:44 GMT <?xml version="1.0" encoding="UTF-8" ?> <result> <input_error> <name>min_referrals</name> <error>1</error> </input_error> <input_error> <name>to_email1</name> <error>NULL</error> </input_error> <input_error> <name>to_name1</name> <error>NULL</error> </input_error> </result>
Example of exceeding limits:
$ curl -i -X POST -H "Accept: text/xml" \ -dprofile=1.QYXTJRSBCXZWTCSS \ -dto_name1='ben smith7' \ -dto_email1='ben.smith7@sample.com' \ http://test.url.eprize.com/v1/eprize/ews12/viral HTTP 400 (Bad Request) Cache-Control: no-cache Connection: close Date: Fri, 23 Jul 2010 20:12:38 GMT Pragma: no-cache Server: POE HTTPD Component/0.09 (5.008008) Content-Length: 139 Content-Type: text/xml; charset=utf-8 Expires: Fri, 23 Jul 2010 20:12:38 GMT <?xml version="1.0" encoding="UTF-8" ?> <result> <input_error> <name>limited</name> <error>1</error> </input_error> </result>