Skip to content

Read data

Endpoint: /read

Supported HTTP methods: Get

HTTP GET

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. All data is returned at content-type: text/plain


Retrieve all data stored under an API key

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

Retrieve all data stored under a project name

https://prefs.us/read?key=abcd...&project=[project_id]

Prefs.us Libraries

Read Method

You can choose for the .read() method to return a Promise or provide a callback.

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

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

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

String apiKey = prefsus.using("apikey...");

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

prefsus.read(callback)