API Debugging

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
{{Logo}}
{{Logo}}
[[API Home Page]]
[[API Home Page]]
 +
 +
For debugging and testing connectivity purposes, ePrize provides these resources that will demonstrate that known responses can be retrieved and data can be sent to ePrize web services.
<div class="api_table">
<div class="api_table">
Line 28: Line 30:
</div>
</div>
-
TODO: background on debugging HTTP communication with wireshark, firebug. links to tools. examples of using API with curl.
+
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.
 +
 
 +
ePrize 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:
-
<pre>
+
%curl -i -H "Accept: application/json" -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication
-
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
+
-
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
+
-
curl -i -H "Accept: application/json" -d value=TEST%2F%E2%99%A1ING http://localhost:8080/v1/solution/ews/test/communication
+
-
</pre>
+

Revision as of 15:59, 8 April 2011

API Home Page

For debugging and testing connectivity purposes, ePrize provides these resources that will demonstrate that known responses can be retrieved and data can be sent to ePrize 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.

ePrize 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