qtproject/qt-apps-neptune-appstore

Name: qt-apps-neptune-appstore

Owner: Qt Project

Description: null

Created: 2016-05-03 14:00:45.0

Updated: 2017-02-28 13:10:36.0

Pushed: 2017-11-02 07:50:11.0

Homepage: null

Size: 44

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

This is a PoC appstore server, which can be used together with the Neptune IVI UI and the Pelagicore Application Manager.

This is a development server only - do NOT use in production.

Architecture

The server is based on Python/Django. The reference platform is Debian Jessie and the packages needed there are:

Before running the server, make sure to adapt the APPSTORE_* settings in appstore/settings.py to your environment.

Since package downloads are done via temporary files, you need to setup a cron-job to cleanup these temporary files every now and then. The job should be triggerd every (settings.APPSTORE_DOWNLOAD_EXPIRY / 2) minutes and it just needs to execute:

manage.py expire-downloads

Commands

HTTP API

The appstore server exposes a HTTP API to the world. Arguments to the functions need to be provided using the HTTP GET syntax. The returned data will be JSON, PNG or text, depending on the function

Basic workflow:

  1. Send a "hello" request to the server to get the current status and check whether your platform is compatible with this server instance:

    ://<server>/hello?platform=AM&version=1
    

    Returns:

    tatus": "ok" }
    
  2. Login as user 'user' with password 'pass':

    ://<server>/login?username=user&password=pass
    

    Returns:

    tatus": "ok" }
    
  3. List all applications

    ://<server>/app/list
    

    Returns:

    category": "Entertainment",
    rating": 5.0,
    name": "Nice App",
    price": 0.42,
    vendor": "Pelagicore",
    briefDescription": "Nice App is a really nice app.",
    category_id": 4,
    id": "com.pelagicore.niceapp"},
    
    
    
  4. Request a download for a App:

    ://<server>/app/purchase?device_id=12345&id=com.pelagicore.niceapp
    

    Returns:

    tatus": "ok",
    rl": "http://<server>/app/download/com.pelagicore.niceapp.2.npkg",
    xpiresIn": 600
    
    
  5. Use the 'url' provided in step 4 to download the application within 'expiresIn' seconds.

API Reference

hello

Checks whether you are using the right Platform and the right API to communicate with the Server.

| Parameter | Description | | ———- | ———– | | platform | The platform the client is running on, this sets the architecture of the packages you get. (see settings.APPSTORE_PLATFORM) | | version | The Appstore Server HTTP API version you are using to communicate with the server. (see settings.APPSTORE_VERSION) |

Returns a JSON object:

| JSON field | Value | Description | | ———- | ——— | ———– | | status | ok | Successfull. | | | maintenance | The Server is in maintenance mode and can't be used at the moment. | | | incompatible-platform | You are using an incompatible Platform. | | | incompatible-version | You are using an incompatible Version of the API. |

login

Does a login on the Server with the given username and password. Either a imei or a mac must be provided. This call is needed for downloading apps.

| Parameter | Description | | ———- | ———– | | username | The username. | | password | The password for the given username |

Returns a JSON object:

| JSON field | Value | Description | | ———- | ——— | ———– | | status | ok | Successfull. | | | missing-credentials | Forgot to provided username and/or password. | | | account-disabled | The account is disabled. | | | authentication-failed | Failed to authenticate with given username and password. |

logout

Does a logout on the Server for the currently logged in user.

Returns a JSON object:

| JSON field | Value | Description | | ———- | ——— | ———– | | status | ok | Successfull. | | | failed | Not logged in. |

app/list

Lists all apps. The returned List can be filtered by using the category_id and the filter argument.

| Parameter | Description | | ————- | ———– | | category_id | Only lists apps, which are in the category with this id. | | filter | Only lists apps, whose name matches the filter. |

Returns a JSON array (not an object!). Each field is a JSON object:

| JSON field | Description | | —————— | ———– | | id | The unique id of the application | | name | The name of the application | | vendor | The name of the vendor of this application | rating | The rating of this application | price | The price as floating point number | briedDescription | A short (one line) description of the application | category | The name of the category the application is in | category_id | The id of the category the application is in

app/icon

Returns an icon for the given application id.

| Parameter | Description | | ———- | ———– | | id | The application id |

Returns a PNG image or a 404 error

app/description

Returns a description for the given application id.

| Parameter | Description | | ———- | ———– | | id | The application id |

Returns text - either HTML or plain

app/purchase

Returns an url which can be used for downloading the requested application for certain period of time (configurable in the settings)

| Parameter | Description | | ———– | ———– | | device_id | The unique device id of the client hardware. | | id | The application Id. |

Returns a JSON object:

| JSON field | Value | Description | | ———– | ——— | ———– | | status | ok | Successfull. | | | failed | Something went wrong. See the error field for more information. | | error | text | An error description, if status is failed. | |url| **url** | The url which can now be used for downloading the application. | |expiresIn` | int | The time in seconds the url remains valid. |

category/list

Lists all the available categories. It uses the rank stored on the server for ordering.

Returns a JSON array (not an object!). Each field is a JSON object:

| JSON field | Description | | ———- | ———– | | id | The unique id of the category | | name | The name of the category |

category/icon:

Returns an icon for the given category id.

| Parameter | Description | | ———- | ———– | | id | The id of the category |

Returns a PNG image or a 404 error


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.