Client API Usage


Greetings, all.

Most of my customers use a WebApp to access their data, but some are more sophisticated and would like to use the client REST API. A customer may have multiple devices assigned to him or her.

That in mind:

  1. How would a customer obtain the DEVICE_PUBLIC_KEYs for each of his/her devices?
  2. If a customer needs to call, how would he/she obtain his/her CUSTOMER_KEY?

To clarify, as the owner/admin I know how to get this info from the mDash dashboard, but not clear how a customer would obtain this information on their own.



A customer gets its key after self-registration.
Similar to admins get their own credentials.

This is a web app login snippet:

There, a customer enters email + password, clicks on login button, and JS code sends a /customer GET request with the basic authorisation header. A response is a customer JSON object with token and list of customer’s devices (their PUBLIC_KEYs).

Hope that helps.


Thanks for these details - it’s clear how one obtains the device PUBLIC_KEYs now.

I am confused, however, regarding the usage of /customer GET endpoint. In the Client API doc it states:

Every request must have a ?access_token=CUSTOMER_KEY query string attached, or a Authorization: Bearer CUSTOMER_KEY header specified.

…but you mention above that username/password authorization should be used with this GET call instead of the CUSTOMER_KEY token approach in the docs. Do both methods apply?



Yes, both methods. If you know the CUSTOMER_KEY, you can use it.
If you don’t know it, you must know email/pass - then, use Basic auth.


Understood on the Basic auth method. Is there a way for a customer to programmatically determine his/her CUSTOMER_KEY?



A customer must know its email + pass.
Make a Basic auth request using email + pass, and get a customer JSON object back. A JSON object contains CUSTOMER_KEY.

1 Like

Sorry to revisit this, but struggling to get this to work.

Attempting the following:
curl --request GET --user '' --url

{"message":"Not Found"}

Am I missing something here?