How to get the application data through the CoSync REST API #
The getApplication function will retrieve the application name and data from the application record. This function does not require that a user be logged in to the application. The function will also return the application two-factor verification type. It will also return the password filtering parameters set at the application level.
A mobile app should check whether the status is ‘migrated’, if it is, the mobile app should inform the user that he/she needs to update their app from the store because the app’s authentication point has been migrated to a new (possibly self-hosted) app. Only by downloading the new app will the user be able to authenticate.
This function will also return the list of locales supported by the application.
URL #
/api/appuser/getApplication
Method #
GET
Headers #
app-token: "<App Token>"
Data Parameter #
None
Response: #
Success: #
StatusCode: #
200 (OK)
Contents: #
{
name: <application name>,
twoFactorVerification: <'none' | 'google' | 'phone'>,
passwordFilter: 0 | 1,
passwordMinLength: <integer>,
passwordMinUpper: <integer>,
passwordMinLower: <integer>,
passwordMinDigit: <integer>,
passwordMinSpecial: <integer>,
appData: {
CosyncJWTVersion : <version string>,
},
realmAppId: <realm app id>,
signupEnabled: 0 | 1,
metaData: [
{
path: <path>,
canEdit: 0 | 1,
required: 0 | 1,
fieldName: <field name>
}
],
metaDataInvite: [
{
path: <path>,
canEdit: 0 | 1,
required: 0 | 1,
fieldName: <field name>
}
],
metaDataEmail: 0 | 1,
signupFlow: <'code','link','none'>,
userJWTExpiration: <hours to expiration>,
invitationEnabled: 0 | 1,
jwtEnabled: 0 | 1,
userNamesEnabled: 0 | 1,
emailExtension: 0 | 1,
anonymousLoginEnabled: 0 | 1,
appleLoginEnabled: 0 | 1,
googleLoginEnabled: 0 | 1,
status: <'active' | 'inactive' | 'migrated'>,
locales: ['EN', 'FR', ..]
}
Error: #
StatusCode: #
400 (BAD REQUEST)
500 (INTERNAL SERVER ERROR)
Contents: #
{
code: "<internal error code>",
message: "<readable error description>"
}
The internal codes are integers:
- 400 - invalid app token
- 401 - app no longer exists
- 402 - app is suspended
- 403 - missing parameter
- 404 - user account is suspended
- 413 - app is migrated
- 500 - internal server error
- 602 - invalid data