BaseApi (Basic APIs)

asJSONPrettyString

Transform an object into a neatly formatted JSON string.

BaseApi.asJSONPrettyString(obj)

Parameters

obj: the object that needs to be converted to JSON string (can be a dict)

Sample Code

# Create a dictionary to hold product information
product = {"productId": "11"}
str_json = BaseApi.asJSONPrettyString(product)

Returns

This endpoint will return the formatted string of the dictionary, with indentation         and sorted keys, for better readability and understanding.

asJSONString

Transform an object into a non-formatted JSON string.

BaseApi.asJSONString(obj)

Parameters

obj:  the object that needs to be converted to JSON string (can be a dict)

Sample Code

Returns

fromJSONString

Parse a JSON-formatted string and convert it into a Map object.

Parameters

Sample Code

Returns

fromJSONStringAsArray

Convert a json string​ as a dictionary.

Parameters

Sample Code

Returns

readJSON

Read the JSON from a file name​ located in a specific directory. It is converted into a dictionary

Parameters

Sample Code

Returns

writeJSON

Write a dictionary object into a file​ located on a specific directory.

Parameters

Sample Code

Returns

writePrettyJSON

Write a dictionary object into a file​ located on a specific directory. The JSON information is a formatted inside the file.

Parameters

Sample Code

Returns

successResult

Build and return a successful result dictionary object.​

Parameters

Sample Code

Returns

errorResult

Build and return an error result dictionary object.​

Parameters

Sample Code

Returns

extractMessage

Extract the message from the result object​. The result object has a detailed message in it therefore it will be returned.

Parameters

Returns

isResult

Checking whether the object is a result object​.

Parameters

Sample Code

Returns

isResultOrNull

Checking if result object is a valid one or a just a NuLL

Parameters

Sample Code

Returns

UUID

Generate a universally unique identifier (UUID) string.

Parameters

Sample Code

Returns

uidToClassName

Extract class name​ from an input string.

Parameters

Returns

uidToId

Extract an long id number from a string UID.

Parameters

Returns

uidToIdStr

Retrieves​ the ID as a string from uid.

Parameters

Returns

waitForMillis

Pause execution for the specified number of milliseconds.

Parameters

Sample Code

Returns

remoteCall

Perform a remote method call.

Parameters

Sample Code

Returns

remoteCallAsResult

Perform a remote method call and return the result as a Result object.

Parameters

Sample Code

Returns

remoteCallAsMap

Perform a remote method call and return the result as a dictionary.

Parameters

Sample Code

Returns

remoteCallAsString

Perform a remote method call and return the result as a string.

Parameters

Sample Code

Returns

remoteCallAsList

Perform a remote method call and return the result as a list.

Parameters

Returns

remoteCallAsListOfMaps

Perform a remote method call and return the result as a list of dictionaries.

Parameters

Returns

Last updated