Advanced API - struct-by-lightning/wpi-suite GitHub Wiki

Introduction

The advanced API consists of three methods that were purposefully left to be flexible. The three methods are known as advancedGET, advancedPUT, and advancedPOST. While they are addressed by GET, PUT and POST, they may be made to do anything.

These methods can be accessed by sending the corresponding HTTP request to 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 Advanced/core/user. For more information on addressing in WPI Suite, see Networking with janeway.

## Advanced GET The advanced GET function passes the parameters of its URL to the corresponding function. For example, the HTTP GET request 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]. You may use any number of arguments and do anything with those arguments.

Those arguments get passed into: public String advancedGet(Session s, String[] args) throws WPISuiteException;

## 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.

Those arguments get passed into: public String advancedPut(Session s, String[] args, String content) throws WPISuiteException;

## 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 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

Those arguments get passed into: public String advancedPost(Session s, String string, String content) throws WPISuiteException;