Difference between revisions of "Ipkg API"

From WebOS Internals
Jump to navigation Jump to search
Line 15: Line 15:
 
=Prototype description=
 
=Prototype description=
  
All API requests will include a serial (seconds since epoch) and only results that were created or modified after that serial will be returned.
+
*All API requests will include a serial (seconds since epoch) and only results that were created or modified after that serial will be returned.
You will be able to specify a set of Filters as key/value pairs, only results matching these filters will be returned.
+
*You will be able to specify a set of Filters as key/value pairs, only results matching these filters will be returned.
You will be able to specify what data you are requesting and only that data (plus anything else required to uniquely identify the package) will be returned.
+
*You will be able to specify what data you are requesting and only that data (plus anything else required to uniquely identify the package) will be returned.
If you omit the array of requested data, all data for the matching packages will be returned.
+
*If you omit the array of requested data, all data for the matching packages will be returned.
  
 
=Prototype demo=
 
=Prototype demo=

Revision as of 05:43, 1 July 2011

Overview

Currently Preware populates it's data by pulling the entire packages index from each feed and doing a slow parsing of the text files. This is, as mentioned, slow, as well as wasteful since the majority of the data in the Packages index is already known (anything that wasn't updated since the last feed update). What is proposed is an API to help deal with these limitations. This API spec will be in flux as it is discussed.

Requirements

There are a few requirements that this API should be able to meet:

  • It must accept and return properly formatted JSON
  • It must be capable of giving only information after a provided time index
  • It must return the time index of when the result set was queried
  • It must allow for arbitrary queries based on any combination of data available
  • It must allow for limiting the amount of data returned (only version numbers, only appid's etc)
  • It must return enough data that every package returned can be uniquely identified (appid, architecture, feed, version)

Prototype description

  • All API requests will include a serial (seconds since epoch) and only results that were created or modified after that serial will be returned.
  • You will be able to specify a set of Filters as key/value pairs, only results matching these filters will be returned.
  • You will be able to specify what data you are requesting and only that data (plus anything else required to uniquely identify the package) will be returned.
  • If you omit the array of requested data, all data for the matching packages will be returned.

Prototype demo

Here is a demo query requesting the version number and description of armv7 preware newer than 1234567890 seconds since epoch Please note that this would return results that match the appid and arch from any feed

{"Serial":"1234567890","Filter":{"appid":"org.webosinternals.preware","arch":"armv7"},"Request":["version","description"]}


Here is a demo response that would be returned, notice that the Filters are returned as well At a minimum, all package responses will include the appid, feed, arch and download URL (URL encoded) A new serial is returned that corresponds with the time since epoch that this data was pulled

{"Serial":"2244668800","Response":[{"appid":"org.webosinternals.org","feed":"webos-internals","arch":"armv7","ipkurl":"http%3A%2F%2Fipkg.preware.org%2Ffeeds%2Fwebos-internals%2Farmv7%2Forg.webosinternals.preware_1.7.0_arm.ipk","version":"1.7.0","description":"Prewares package description (URL encoded)"},{"appid":"org.webosinternals.org","feed":"webos-internals-testing","arch":"armv7","ipkurl":"http%3A%2F%2Fipkg.preware.org%2Ffeeds%2Fwebos-internals%2Ftesting%2Farmv7%2Forg.webosinternals.preware_1.7.2_arm.ipk","version":"1.7.2","description":"Prewares package description (URL encoded)"}]}


A serial will be required with ALL API requests, if you want a full data set, just use a serial of 0 Failure to include a serial will result in no response from the API server


Using the serials, you can get partial responses for updates, if you already know that your package data for the webos-internals armv7 feed is up-to-date as of serial 55667788 you can query for updates to it

{"Serial":"55667788","Filter":{"feed":"webos-internals","arch":"armv7"}}


The return would be very similar to the one shown above with the exception that it would have all packages updated after the serial that is provided, limited to packages in the webos-internals armv7 feed... and most importantly... Because you did not provide a Request stating what pieces of data you want, you get everything the API server has about those packages, this is most likely the way that Preware would pull it's updates