Shared Preference API

Write / Read String Value

Write String Key

POST http://lyour_local_ip:49761/sharedpreference/write/string/

Save a new string value. The following parameters must be in the same JSON in the body.

Request Body

Name
Type
Description

key*

myStringKey

With which key you want to save your string value

value*

myStringValue

The string value you want to save

Read String Key

GET http://lyour_local_ip:49761/sharedpreference/read/string/

Read the string value you saved before.

Query Parameters

Name
Type
Description

key*

myStringKey

Your data key

defaultValue*

myDefaultValue

If key is null return default value

Write / Read Integer Value

Write Integer Key

POST http://lyour_local_ip:49761/sharedpreference/write/int/

Save a new integer value. The following parameters must be in the same JSON in the body.

Request Body

Name
Type
Description

key*

myIntegerKey

With which key you want to save your integer value

value*

myIntegerValue

The integer value you want to save

Read Integer Key

GET http://lyour_local_ip:49761/sharedpreference/read/int/

Read the integer value you saved before.

Query Parameters

Name
Type
Description

key*

myIntKey

Your data key

defaultValue*

myDefaultValue

If key is null return default value

Write / Read Boolean Value

Write Boolean Key

POST http://lyour_local_ip:49761/sharedpreference/write/boolean/

Save a new boolean value. The following parameters must be in the same JSON in the body.

Request Body

Name
Type
Description

key*

myBooleanKey

With which key you want to save your boolean value

value*

myBooleanValue

The boolean value you want to save

Read Boolean Key

GET http://lyour_local_ip:49761/sharedpreference/read/boolean/

Read the boolean value you saved before.

Query Parameters

Name
Type
Description

key*

myBooleanKey

Your data key

defaultValue*

myDefaultValue

If key is null return default value

Remove Key / Remove All Key

Delete Key

DELETE http://lyour_local_ip:49761/sharedpreference/remove

Delete specific key

Query Parameters

Name
Type
Description

key*

myKey

The key you want to delete

Delete All Keys

DELETE http://lyour_local_ip:49761/sharedpreference/remove/all

Delete all keys in preference file

Last updated

Was this helpful?