API Debugging

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
Current revision (14:19, 31 March 2014) (edit) (undo)
 
(11 intermediate revisions not shown.)
Line 1: Line 1:
-
TODO: background on debugging HTTP communication with wireshark, firebug. links to tools. examples of using API with curl.
+
{{Logo}}
 +
[[API Home Page]]
 +
For debugging and testing connectivity purposes, HelloWorld provides these resources that will demonstrate that known responses can be retrieved and data can be sent to HelloWorld web services.
 +
 +
<div class="api_table">
{|
{|
-
| Self Tests ||
 
|-
|-
-
| [[Output communication test]] || GET /v1/{apikey}/test/communication
+
| [[Output communication test]]
 +
| GET
 +
| /v1/{apikey}/test/communication
|-
|-
-
| [[Input communication test]] || POST /v1/{apikey}/test/communication
+
| [[Output communication test (structured data)]]
 +
| GET
 +
| /v1/{apikey}/test/structured
|-
|-
-
| [[Input URL communication test]] || PUT /v1/{apikey}/test/communication/{value}
+
| [[Input communication test]]
 +
| POST
 +
| /v1/{apikey}/test/communication
 +
|-
 +
| [[Input URL communication test]]
 +
| PUT
 +
| /v1/{apikey}/test/communication/{value}
 +
|-
 +
| [[Error response test]]
 +
| PUT
 +
| /v1/{apikey}/test/communication
|-
|-
-
| [[Error response test]] || PUT /v1/{apikey}/test/communication
 
|}
|}
 +
</div>
 +
 +
Testing the webservices prior to deployment, or during development is best done with a tool that will display the full HTTP communication interaction with the server, including all headers for the request and response. While certain resources can be viewed with a normal browser, it is not a recommended way to test or learn about the APIs since there is not enough information displayed.
 +
 +
HelloWorld developers often use cURL (http://en.wikipedia.org/wiki/CURL), or Wireshark (http://en.wikipedia.org/wiki/Wireshark) to examine the communication between the client and server. Some specific curl commands are listed here:
 +
 +
Basic communication testing:
 +
 +
%curl -i -T /dev/null http://localhost:8080/v1/solution/ews/test/communication/TEST%2F%E2%99%A1ING
 +
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication
 +
%curl -i http://localhost:8080/v1/solution/ews/test/communication
 +
 +
Passing form parameters with curl, also request certain content types:
 +
 +
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.xml
 +
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.json
 +
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.yaml
 +
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.txt
 +
 +
Passing Accept: Headers with curl:
 +
 +
%curl -i -H "Accept: application/json" -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication

Current revision

API Home Page

For debugging and testing connectivity purposes, HelloWorld provides these resources that will demonstrate that known responses can be retrieved and data can be sent to HelloWorld web services.

Output communication test GET /v1/{apikey}/test/communication
Output communication test (structured data) GET /v1/{apikey}/test/structured
Input communication test POST /v1/{apikey}/test/communication
Input URL communication test PUT /v1/{apikey}/test/communication/{value}
Error response test PUT /v1/{apikey}/test/communication

Testing the webservices prior to deployment, or during development is best done with a tool that will display the full HTTP communication interaction with the server, including all headers for the request and response. While certain resources can be viewed with a normal browser, it is not a recommended way to test or learn about the APIs since there is not enough information displayed.

HelloWorld developers often use cURL (http://en.wikipedia.org/wiki/CURL), or Wireshark (http://en.wikipedia.org/wiki/Wireshark) to examine the communication between the client and server. Some specific curl commands are listed here:

Basic communication testing:

%curl -i -T /dev/null http://localhost:8080/v1/solution/ews/test/communication/TEST%2F%E2%99%A1ING
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication
%curl -i http://localhost:8080/v1/solution/ews/test/communication

Passing form parameters with curl, also request certain content types:

%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.xml 
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.json
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.yaml
%curl -i -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication.txt

Passing Accept: Headers with curl:

%curl -i -H "Accept: application/json" -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication
Personal tools