mozilla / apk-factory-service

Web service which converts Open Web Apps into native Android apps
42 stars 18 forks source link

Spec out App Update ping #4

Closed ozten closed 10 years ago

ozten commented 10 years ago

Fennec can use the service to find out which of it's installed apps are out of date.

This bug is to figure out the spec for this API call.

Proposal:

An HTTP POST request is made to https://apk.factory/app_updates with JSON encoding for the body. The JSON document includes a collection of installed apps, specifically their manifest and version number. The response will be a JSON encoded document which is a list of outdated app manifests.

Example:

POST / HTTP/1.1
User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8y zlib/1.2.5
Host: ozten.com
Accept: */*
Content-Type: application/json
Content-Length: 209

{
    installed: {
        "http://guanaco1068.testmanifest.com/manifest.webapp": 23,
        "http://bunny2630.testmanifest.com/manifest.webapp": 504,
        "http://mole3838.testmanifest.com/manifest.webapp": 2
    }
}

HTTP/1.1 200 OK
Date: Thu, 21 Nov 2013 23:09:55 GMT
Server: Apache
Last-Modified: Tue, 02 Jul 2013 06:21:47 GMT
Accept-Ranges: bytes
Content-Length: 145
Vary: Accept-Encoding
Content-Type: application/json

{
    outdated: [
        "http://bunny2630.testmanifest.com/manifest.webapp",
        "http://mole3838.testmanifest.com/manifest.webapp"
    ]
}
mykmelez commented 10 years ago

Over in https://github.com/mykmelez/mock-apk-update-checker I implemented a mock APK update checker service that implements the specified API and simply responds to any request by telling the requester that all installed apps are out-of-date. I stood up an instance of the service via Stackato at http://apk-update-checker.paas.allizom.org/, and there's a simple test script in the repository you can run via node test.js to see it in action.

ozten commented 10 years ago

This is done on master. Boom!

(Not available on AWS yet, will email the team once it is)