Skip to content

Advanced API

Robrowski edited this page Mar 19, 2014 · 4 revisions

**

These methods can be accessed by sending the corresponding HTTP request to /WPISuite/API/Advanced/module/model where module and model correspond to the module and model you would like to access.

For example, to access the advancedGET functionality of core users, you would send an HTTP GET request to /WPISuite/API/Advanced/core/user

Implementation

The function prototypes for the three advanced Introduction** The advanced API consists of three module defined methods that were purposefully left to be flexible. The three methods are known as advancedGET, advancedPUT, and advancedPOST.

SyntaxAPI methods are:

public String advancedGet(Session s, String[] args) throws WPISuiteException; public String advancedPut(Session s, String[] args, String content) throws WPISuiteException; public String advancedPost(Session s, String string, String content) throws WPISuiteException; The implementation of these methods is specific to each module. Suggested usage is listed below.

Advanced GET

The advanced GET function passes the parameters of its URL to the corresponding function. For example, the HTTP GET request http://example.com/WPISuite/API/Advanced/module/model/arg1/arg2/arg3 would generate a call to the advancedGet method of the the model's manager. The contents of args would be ["module","model","arg1","arg2","arg3",null]

Advanced PUT

Advanced PUT functions in a very similar way to Advanced GET. The URL string is still broken apart and passed as a String[] to the method implementation.
Advanced PUT also sends the content body of the PUT request as the argument String content. Please note that only the first line of the content body will be read. Anything after the first line break will not be transmitted

Advanced POST

Advanced POST functions similarly to Advanced PUT, except that where Advanced PUT transmits the entire URL as a String[], Advanced POST only transmits the first argument after module/model/ For example, in the HTTP POST request http://example.com/WPISuite/API/Advanced/module/model/arg1/arg2/arg3. Advanced POST would receive "arg1" as it's String string argument. Please note that only the first line of the content body will be read. Anything after the first line break will not be transmitted