Network API
The Network API provides functions for network calls via HTTP or HTTPS. The Network API enables your app to request data from remote sources, such as your data servers, over the Internet. In also enables you to validate that the data requests and the responses have not been tampered with as they traveled between the client app and the server. The Network API comprises of the following modules:
The Network API uses the kony.net
namespace and the following API elements
Function | Description |
---|---|
kony.net.cancel
|
Cancels only async network calls. Synchronous calls have a platform-specific cancellation mechanism provided by the platform |
kony.net.clearCookies
|
Removes cookies from the client that are associated with the specified domain. |
kony.net.FormData
|
Call this function to create a FormData object. |
kony.net.getActiveNetworkType
|
Retrieves the currently-active network type. |
kony.net.getCookies
|
Retrieves cookies associated with the specified domain. |
kony.net.hasNetworkCapablity
|
Determines whether the device has the specified capability. |
kony.net.HttpRequest
|
Creates an HttpRequest object. |
kony.net.isNetworkAvailable
|
Enables you to check whether a network is available for data transport on a device. |
kony.net.loadClientCertificate
|
Sets a client certificate to be used for HTTPS client authentication. |
kony.net.mfintegrationsecureinvokerasync
|
Invokes a Quantum Fabric service asynchronously. |
kony.net.removeClientCertificate
|
Removes already loaded client certificate. |
kony.net.removeAllCachedResponses
|
Clears the default cache of an application by removing all responses received from URLs. |
kony.net.removeIntegrityCheck
|
Disables intregity checks for HTTP calls between the client and the server. |
kony.net.set5GNetworkListener
|
Determines if the device has a 5G network connection to the app. |
kony.net.setCookies
|
Adds cookies, or replaces an existing cookie in the cookie storage. |
kony.net.setIntegrityCheck
|
Enables the addition of checksums to HTTP calls for HTTP integrity checking. |
kony.net.setNetworkCallbacks
|
Allows the developer to register for network status changes. |
kony.net.setResponse
|
Sets a callback function that handles network events. |
kony.net.unregister5GNetworkListener
|
Unregister from the 5G Network Listener. |
kony.net.urlDecode
|
Converts a URL string from application/x-www-form-urlencoded format in the UTF-8 encoding. |
kony.net.urlEncode
|
Converts a URL string into application/x-www-form-urlencoded format using the UTF-8 encoding. |
To verify the identity of the server and establish a secure network connection through HTTPS, use the kony.net.loadClientCertificate
function. A client certificate for HTTPS client authentication is set. You can remove the client certificate by using the kony.net.removeClientCertificate
function.
To start with establishling a connection using HTTP, create an Http request object by using the kony.net.HttpRequest
function. After creating an object, invoke a required Quantum Fabric service by using the kony.net.mfintegrationsecureinvokerasync
function. Then use the kony.net.setIntegrityCheck
function to validate HTTP messages passing between the client app and the servers. To disable the HTTP integrity checking, use the kony.net.removeIntegrityCheck
function.
Further, a URLs can be sent over the internet in ASCII format only. To convert a URL into valid ASCII format, use the kony.net.urlEncode
function. Then use the kony.net.urlDecode
function to convert the ASCII characters to readable format.
Please note that the kony.net.invokeServiceAsync
and kony.net.invokeservice
are deprecated and should not be used in new software. However, documentation for them is still available to help with the maintenance of legacy software.
NOTE: From V8 SP4 onwards, for etag caching of Network APIs, the data in a Quantum App child app is stored in child app data and not under the parent app. This feature is applicable for iOS and Android platforms.