App guidelines
General guidelines for writing applications and libraries for Pryv.io platforms.
Web applications should be implemented to be platform agnostic, so they can be run on your production environment as well as your staging one.
Our example applications can be run on our Pryv Lab platform as well as your own.
Auto-configuration
Applications should retrieve configuration parameters from the service information.
For this we suggest to implement the following ways to load its configuration:
- pryvApiEndpoint query param
An URL in the Basic HTTP Authorization form.
Example:https://cdtasdjhashdsa@testuser.pryv.me
as API endpoint (URL encoded)
https://sample.domain/app/index.html?pryvApiEndpoint=https%3A%2F%2Fcdtasdjhashdsa%40testuser.pryv.me
Note: service information should be retrieved by appending the path /service/info
to the value given by pryvApiEndpoint
.
- pryvServiceInfoUrl query param
Example: https://reg.pryv.me/service/info
as service information URL (URL encoded)
https://sample.domain/app/index.html?pryvServiceInfoUrl=https%3A%2F%2Freg.pryv.me%2Fservice%2Finfo
Prevalence
If multiple parameters are provided, the following order of priority should be used:
pryvServiceInfoUrl
as query parameterpryvApiEndpoint
as query parameterpryvServiceInfoUrl
as default value
Authorization
Using a pryvApiEndpoint
to load an app allows to load data directly as it usually contains credentials. For cases where you require authentication, it is preferred to use pryvServiceInfoUrl
:
authProcess=>operation: Auth Process:>/reference/#authenticate-your-app
condApiEndPoint=>condition: pryvApiEndpoint? condServiceInfo=>condition: pryvServiceInfoUrl?
st->condApiEndPoint condApiEndPoint(yes)->ready condApiEndPoint(no)->condServiceInfo condServiceInfo(no, bottom)->fail condServiceInfo(yes, right)->authProcess authProcess(top)->condApiEndPoint