Fetch profile by key

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
Current revision (15:48, 6 April 2011) (edit) (undo)
 
(10 intermediate revisions not shown.)
Line 1: Line 1:
-
<pre>
+
{{RESTfulAPI
-
Response if request contains invalid UTF-8:
+
|crumbs=[[API Home Page]] :: [[Profiles]]
-
400 Bad Request
+
|summary=Find a profile by a specific profile field and value. If a profile is found, the canonical location will be returned in the "Location:" response header.
-
</pre>
+
-
Success - Found Profile
+
Example of getting a profile by mobile number:
-
<pre>
+
-
HTTP Status: 303 See Other
+
GET /v1/{apikey}/profile(mobile)/1-888-555-1212
-
Location: /v1/{apikey}/profile/{uid}
+
 
-
<?xml version="1.0" encoding="UTF-8" ?>
+
And email address:
 +
 
 +
GET /v1/{apikey}/profile(email)/person@example.com
 +
 
 +
It is important to not assume the format of the [[API_Request/Response#Canonical_URLs|canonical profile URL]] returned in the Location. Other API calls take the entire URL as a profile identifier, so deconstructing the URL is not necessary. A GET on the URL will fetch the full (safe) representation of the profile. For more information on using URLs, please see the [[API_Request/Response#Follow_the_URLs|API Request/Response Overview]].
 +
 
 +
This URL is an entry point. It may be easily attacked because valid URLs are easy to guess.
 +
|resource=/v1/{apikey}/profile({key})/{value}
 +
|resourceargs='''apikey''': Your [[API Key]]
 +
 
 +
'''key''': Profile field to search for value
 +
 
 +
'''value''': Value to find in the profile field
 +
|methods=GET
 +
|paramsrequired=None required
 +
}}
 +
 
 +
{{RESTfulExample
 +
|title=Bad Request
 +
|summary=This demonstrates a bad request, such as, the request contains invalid UTF-8 characters.
 +
|responsecode=400 Bad Request
 +
|response=<?xml version="1.0" encoding="UTF-8" ?>
<result ver="ePrize Web Services 1.0">
<result ver="ePrize Web Services 1.0">
-
<result>
+
<result></result>
-
<profile>
+
-
<id>{uid}</id>
+
-
<email>some.email@address.com</email>
+
-
<safekey1>safekey1-value</safekey1>
+
-
<safekey2>safekey2-value</safekey2>
+
-
...
+
-
<safekeyN>safekeyN-value</safekeyN>
+
-
</profile>
+
-
</result>
+
<status>1</status>
<status>1</status>
</result>
</result>
-
</pre>
+
}}
-
Failure - Unable to find Profile
+
{{RESTfulExample
-
<pre>
+
|title=Found Profile
-
HTTP Status: 404 Not Found
+
|responsecode=303 See Other
-
<?xml version="1.0" encoding="UTF-8" ?>
+
|responseloc=/v1/{apikey}/profile/{uid}.{webkey}
 +
|response=<?xml version="1.0" encoding="UTF-8" ?>
<result ver="ePrize Web Services 1.0">
<result ver="ePrize Web Services 1.0">
-
<result></result>
+
<profile>
-
<status>1</status>
+
<id>{profile-number}</id>
 +
<email>some.email@address.com</email>
 +
<public1>public-value1</public1>
 +
<public2>public-value2</public2>
 +
...
 +
<publicN>public-valueN</publicN>
 +
</profile>
</result>
</result>
-
</pre>
+
}}
-
Example of getting a profile by mobile number:
+
{{RESTfulExample
-
GET /v1/{apikey}/profile(mobile)/1-888-555-1212
+
|title=Unable to find Profile
-
 
+
|responsecode=404 Not Found
-
The client must not assume the format of the canonical profile URL returned in the Location. Other API calls take the entire URL as a profile identifier, so deconstructing the URL is not necessary. A GET on the URL will fetch the full (safe) representation of the profile.
+
|response=<?xml version="1.0" encoding="UTF-8" ?>
-
 
+
<result ver="ePrize Web Services 1.0">
-
''important to refer back to basic request/response section on URL value restrictions''
+
<status>0</status>
-
 
+
</result>
-
This URL is an entry point. It may be easily attacked because valid URLs are easy to guess.
+
}}

Current revision

API Home Page :: Profiles

Summary

Find a profile by a specific profile field and value. If a profile is found, the canonical location will be returned in the "Location:" response header.

Example of getting a profile by mobile number:

 GET /v1/{apikey}/profile(mobile)/1-888-555-1212

And email address:

 GET /v1/{apikey}/profile(email)/person@example.com

It is important to not assume the format of the canonical profile URL returned in the Location. Other API calls take the entire URL as a profile identifier, so deconstructing the URL is not necessary. A GET on the URL will fetch the full (safe) representation of the profile. For more information on using URLs, please see the API Request/Response Overview.

This URL is an entry point. It may be easily attacked because valid URLs are easy to guess.

Resource

/v1/{apikey}/profile({key})/{value}

Valid Methods

GET

Resource Arguments

Note: resource arguments are always required.

apikey: Your API Key

key: Profile field to search for value

value: Value to find in the profile field

Parameters Required

None required



Example: Bad Request

Summary

This demonstrates a bad request, such as, the request contains invalid UTF-8 characters.


Response

HTTP Status Code: 400 Bad Request


<?xml version="1.0" encoding="UTF-8" ?>
<result ver="ePrize Web Services 1.0">
  <result></result>
  <status>1</status>
</result>


Example: Found Profile

Response

HTTP Status Code: 303 See Other

HTTP Redirect Location: /v1/{apikey}/profile/{uid}.{webkey}

<?xml version="1.0" encoding="UTF-8" ?>
<result ver="ePrize Web Services 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>


Example: Unable to find Profile

Response

HTTP Status Code: 404 Not Found


<?xml version="1.0" encoding="UTF-8" ?>
<result ver="ePrize Web Services 1.0">
  <status>0</status>
</result>


Personal tools