5.12 APIs that can be used with JavaScript Plugin Parts
The following table describes the APIs (JavaScript APIs) that can be used with JavaScript Plugin Parts.
|
Category |
Class name |
Description |
|---|---|---|
|
Plugin manager |
This class provides objects that allow JavaScript to perform processing provided by Navigation Platform. |
|
|
REST caller |
This class invokes a URL from JavaScript. |
To use an API, you have to acquire the JavaScriptPluginManager object by using the reserved variable ucnpJavaScriptPluginManager from JavaScript. Furthermore, if REST is to be invoked, you have to acquire the RestClient object by using the getRestClient method of the reserved variable ucnpJavaScriptPluginManager.
-
Coding example
var client = ucnpJavaScriptPluginManager.getRestClient();
Because the methods (except the execute method) of the RestClient object return the RestClient object of the caller, they can be invoked with a method chain.
-
Coding example
var result = client .addHeader("Accept-Encoding", "deflate") .setAuthentication("user1", "pass1") .setMethod(client.METHOD_POST) .setPostContentType("text/json") .setPostContent("{ \"operation\": \"start\" }") .setReturnType(client.RETURNTYPE_JSON) .execute();
You can acquire the constant to be specified as the argument of the method of the RestClient object from the RestClient instance.
-
Coding example
var client = ucnpJavaScriptPluginManager.getRestClient(); var result = client .setMethod(client.METHOD_POST) .setReturnType(client.RETURNTYPE_STRING) .execute();
- Organization of this section