Skip to content

Read data

Include prefs.us Javascript library in your project

    <script src="https://prefs.us/prefs.us.js"></script>

Read Method

.read() method can return data either with a Promise or via a provided callback.

[Promise promise = ] .read( [callback] )

prefs_us.read( (data) => {
    if (data.status == 'success') {
        var mydata = incoming.values;
    }
});
prefs_us.read()
    .then( (response) => response.json())
    .then((data) => {
        console.log(data.values);
    })
    .catch( (error) => {
        console.log(error);
    });
import com.gorny.prefsus;

PrefsUs.using(apitoken).read((response) -> {
    System.out.println("Received: "+response);
});
import prefus

String apiKey = prefsus.using(apitoken);

def callback(R):
    print("Received: ", R)

prefsus.read(callback)

HTTP GET

Endpoint: /read

Data can be retrieved via a basic HTTP Get call by supplying the API Key and (optional) grouping parameters such as: project, domain, and subdomain.

Retrieve all data stored under an API token

https://prefs.us/read?key=abcd...

Retrieve all data stored under a project name:

https://prefs.us/read?key=abcd...&project=project_name

Note

All data is returned as content-type: text/plain