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.

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]

Note

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

Prefs.us Libraries

Include prefs.us Javascript library in your project

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

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( (data) => {
            if (data.status == 'success') {
                var mydata = incoming.values;
            }
        });
prefs_us.using("apikey...").read()
    .then( (response) => 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)