Output communication test (structured data)

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
(New page: API Home Page :: API Debugging <pre> Request representation: empty XML Response: &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;result&gt; &lt;name&gt;Ken&lt;/name&gt; &lt;...)
Current revision (16:52, 8 April 2011) (edit) (undo)
 
(One intermediate revision not shown.)
Line 1: Line 1:
-
[[API Home Page]] :: [[API Debugging]]
+
{{RESTfulAPI
-
<pre>
+
|crumbs=[[API Home Page]] :: [[API Debugging]]
-
Request representation: empty
+
|summary=This just verifies that the basic output system is working. It will also be useful for verifying different media type support as we introduce media types other then XML. The only fully supported media type across all of the APIs at this time is XML.
 +
|resource=/v1/{apikey}/test/structured.{extension}
 +
|methods=GET
 +
|resourceargs='''apikey''': Your [[API Key]]
-
XML Response:
+
'''extension''': optional parameter. Default is assumed to be XML. Other options are JSON and Yaml. Note: non-testing resources do not all accept other media type extensions.
-
&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+
|paramsrequired=None
-
&lt;result&gt;
+
}}
-
&lt;name&gt;Ken&lt;/name&gt;
+
-
&lt;email&gt;Ken Fox &amp;lt;ken.fox@eprize.com&amp;gt;&lt;/email&gt;
+
-
&lt;favorite&gt;http://www.eprize.com/&lt;/favorite&gt;
+
-
&lt;favorite&gt;http://code.eprize.com/wiki/&lt;/favorite&gt;
+
-
&lt;id&gt;1&lt;/id&gt;
+
-
&lt;/result&gt;
+
-
JSON Response:
+
{{RESTfulExample
-
{
+
|title=Communication Test (GET), with default XML content-type.
 +
|request=Request representation: empty
 +
|responsecode=200 OK
 +
|response=<?xml version="1.0" encoding="UTF-8" ?>
 +
<result>
 +
<name>Ken</name>
 +
<dictionary>
 +
<one>1</one>
 +
<three>3</three>
 +
<two>2</two>
 +
</dictionary>
 +
<email>Ken Fox &lt;ken.fox@eprize.com&gt;</email>
 +
<favorite>http://www.eprize.com/</favorite>
 +
<favorite>http://code.eprize.com/wiki/</favorite>
 +
<id>1</id>
 +
<quoted_utf8>He said, &quot;This is a fine ♥.&quot;</quoted_utf8>
 +
</result>
 +
 
 +
}}
 +
 
 +
{{RESTfulExample
 +
|title=Communication Test (GET), with JSON content-type.
 +
|request=Request representation: empty, add ".json" extension to resource
 +
|responsecode=200 OK
 +
|response={
"result" : {
"result" : {
-
"email" : "Ken Fox &lt;ken.fox@eprize.com&gt;",
+
"quoted_utf8" : "He said, \"This is a fine \u2665.\"",
"name" : "Ken",
"name" : "Ken",
 +
"email" : "Ken Fox <ken.fox@eprize.com>",
 +
"dictionary" : {
 +
"three" : 3,
 +
"two" : 2,
 +
"one" : 1
 +
},
"id" : 1,
"id" : 1,
"favorite" : [
"favorite" : [
Line 24: Line 51:
]
]
}
}
-
}
 
-
YAML Response:
+
}}
-
---
+
 
-
email: Ken Fox &lt;ken.fox@eprize.com&gt;
+
{{RESTfulExample
 +
|title=Communication Test (GET), with Yaml content-type.
 +
|request=Request representation: empty, add ".yaml" extension to resource
 +
|responsecode=200 OK
 +
|response=---
 +
dictionary:
 +
one: 1
 +
three: 3
 +
two: 2
 +
email: Ken Fox <ken.fox@eprize.com>
favorite:
favorite:
- http://www.eprize.com/
- http://www.eprize.com/
Line 34: Line 69:
id: 1
id: 1
name: Ken
name: Ken
-
</pre>
+
quoted_utf8: He said, "This is a fine ♥."
-
 
+
}}
-
This just verifies that the basic output system is working. It is also useful for verifying different media type support.
+

Current revision

API Home Page :: API Debugging

Summary

This just verifies that the basic output system is working. It will also be useful for verifying different media type support as we introduce media types other then XML. The only fully supported media type across all of the APIs at this time is XML.

Resource

/v1/{apikey}/test/structured.{extension}

Valid Methods

GET

Resource Arguments

Note: resource arguments are always required.

apikey: Your API Key

extension: optional parameter. Default is assumed to be XML. Other options are JSON and Yaml. Note: non-testing resources do not all accept other media type extensions.

Parameters Required

None



Example: Communication Test (GET), with default XML content-type.

Request

Request representation: empty

Response

HTTP Status Code: 200 OK


<?xml version="1.0" encoding="UTF-8" ?>
<result>
  <name>Ken</name>
  <dictionary>
    <one>1</one>
    <three>3</three>
    <two>2</two>
  </dictionary>
  <email>Ken Fox <ken.fox@eprize.com></email>
  <favorite>http://www.eprize.com/</favorite>
  <favorite>http://code.eprize.com/wiki/</favorite>
  <id>1</id>
  <quoted_utf8>He said, "This is a fine ♥."</quoted_utf8>
</result>


Example: Communication Test (GET), with JSON content-type.

Request

Request representation: empty, add ".json" extension to resource

Response

HTTP Status Code: 200 OK


{
  "result" : {
    "quoted_utf8" : "He said, \"This is a fine \u2665.\"",
    "name" : "Ken",
    "email" : "Ken Fox <ken.fox@eprize.com>",
    "dictionary" : {
      "three" : 3,
      "two" : 2,
      "one" : 1
    },
    "id" : 1,
    "favorite" : [
      "http://www.eprize.com/",
      "http://code.eprize.com/wiki/"
    ]
  }


Example: Communication Test (GET), with Yaml content-type.

Request

Request representation: empty, add ".yaml" extension to resource

Response

HTTP Status Code: 200 OK


--- 
dictionary: 
  one: 1
  three: 3
  two: 2
email: Ken Fox <ken.fox@eprize.com>
favorite: 
  - http://www.eprize.com/
  - http://code.eprize.com/wiki/
id: 1
name: Ken
quoted_utf8: He said, "This is a fine ♥."


Personal tools