Definitions

App

App is the model struct for apps

Name Schema

appId
optional

string

appName
optional

string

deletedAt
optional

string

deployedVersions
optional

< Version > array

id
optional

string

numOfAppLaunches
optional

integer (int64)

numOfCurrentInstalls
optional

integer (int64)

numOfDeployedVersions
optional

integer (int64)

Device

Device model

Name Schema

appId
optional

string

deviceId
optional

string

deviceType
optional

string

deviceVersion
optional

string

id
optional

string

version
optional

string

versionId
optional

string

User

User is the model struct for users

Name Schema

email
optional

string

username
optional

string

Version

Version model

Name Schema

appId
optional

string

devices
optional

< Device > array

disabled
optional

boolean

disabledMessage
optional

string

id
optional

string

lastLaunchedAt
optional

string

numOfAppLaunches
optional

integer (int64)

numOfCurrentInstalls
optional

integer (int64)

version
optional

string

Mobile Security Service REST API

This is the server component of the AeroGear Mobile Security Service. It is a RESTful API that allows developers to view, enable and disable specific versions of applications on demand, with the information stored in a PostgreSQL database.

The url prefix is http://<host>:<port>/api

Checking REST Service

Run the following curl command and check the output is as shown.

$ curl localhost:3000/api/apps
[{"id":"0890506c-3dd1-43ad-8a09-21a4111a65a6","appId":"com.aerogear.testapp","appName":"Test App","numOfDeployedVersions":2,"numOfCurrentInstalls":3,"numOfAppLaunches":6000},{"id":"1b9e7a5f-af7c-4055-b488-72f2b5f72266","appId":"com.aerogear.foobar","appName":"Foobar","numOfDeployedVersions":0,"numOfCurrentInstalls":0,"numOfAppLaunches":0}]
This endpoint will return all apps saved in the database. If you do not have data saved locally it will return no data with a 204 No Content response code.
You can install the Postman tool which will be useful to call and test the REST API endpoints of this server. Following an image to show how it works.

Retrieve list of apps

GET /apps

Description

Returns root level information for all apps

$ curl localhost:3000/api/apps
[{"id":"0890506c-3dd1-43ad-8a09-21a4111a65a6","appId":"com.aerogear.testapp","appName":"Test App","numOfDeployedVersions":2,"numOfCurrentInstalls":3,"numOfAppLaunches":6000},{"id":"1b9e7a5f-af7c-4055-b488-72f2b5f72266","appId":"com.aerogear.foobar","appName":"Foobar","numOfDeployedVersions":0,"numOfCurrentInstalls":0,"numOfAppLaunches":0}]

Parameters

Type Name Description Schema

Query

appId
optional

The app_id to filter the app by appId

string

Responses

HTTP Code Description Schema

200

successful operation

App

204

successful operation by no apps were found

No Content

404

App not found

No Content

Produces

  • application/json

Update 1 or more versions of an app

PUT /apps/:id/versions

Description

Update all versions informed of an app using the app id, including updating version information

Parameters

Type Name Description Schema

Path

id
required

The id for the app that will have its versions updated

string

Body

body
required

Updated 1 or more versions of an app

Responses

HTTP Code Description Schema

200

successful update

No Content

400

Invalid app and/or versions supplied

No Content

404

App not found

No Content

Produces

  • application/json

Disable all versions of an app

POST /apps/:id/versions/disable

Description

Disable all versions of an app

Parameters

Type Name Description Schema

Path

id
required

The id for the app that will have all its versions updated

string

Body

body
required

Responses

HTTP Code Description Schema

200

successful update

No Content

400

Invalid app supplied

No Content

404

App not found

No Content

Produces

  • application/json

Get app by id

GET /apps/{id}

Description

Retrieve all information for a single app including all child information

Parameters

Type Name Description Schema

Path

id
required

The id for the app that needs to be fetched.

string

Responses

HTTP Code Description Schema

200

successful operation

App

400

Invalid id supplied

No Content

404

App not found

No Content

Produces

  • application/json

Does a soft delete at in the App

DELETE /apps/{id}

Description

To do a a soft deleted at the App

Parameters

Type Name Description Schema

Path

id
required

The id for the app that needs to be fetched.

string

Responses

HTTP Code Description Schema

204

successful operation

No Content

400

Invalid id supplied

No Content

404

App not found

No Content

Produces

  • application/json

Check if the server can receive requests

GET /healthz

Description

Check the health of the REST SERVICE API

Responses

HTTP Code Description Schema

200

successful operation

No Content

500

Internal Server Error

No Content

Produces

  • application/json

Init call from SDK

POST /init

Description

Capture metrics from device and return if the app version they are using is disabled and has a set disabled message

Parameters

Type Name Description Schema

Body

body
required

Updated app object

Responses

HTTP Code Description Schema

200

successful operation

No Content

400

Invalid id supplied

No Content

404

Data not found

No Content

Produces

  • application/json

Retrieve all metrics for the Go server

GET /metrics

Description

Get the metrics of the service

Responses

HTTP Code Description Schema

200

successful operation

No Content

Produces

  • application/json

Check if the server is running

GET /ping

Description

Check the status of the REST SERVICE API

Responses

HTTP Code Description Schema

200

successful operation

No Content

Produces

  • application/json

Retrieve user

GET /user

Description

Returns user

Responses

HTTP Code Description Schema

200

sucessful operation

No Content

404

No user found

No Content

Produces

  • application/json