Moseycode Web Services

Moseycode is intended to serve as both an application that allows users to create, publish and interact with barcodes and as a platform for software developers to easily integrate barcode functionality into their applications. Software developers can use Moseycode freely within their own applications, choosing the degree of integration they want.

To make it easier for developers to introduce Moseycode into their applications, a number of web services have been made available. At present all services are hosted at http://services.moseycode.com.

Moseycode is currently in a very early stage of development though services can be expected to be stable unless otherwise indicated, provision may be slow, and on rare occasions, interrupted.

Portal Service

This service generates images of barcodes (portals in the parlance of Moseycode).

Requests to the service take one of the following two forms:

  1. http://services.moseycode.com/portal/chamberID/data/dimensions.(jpg|png)
  2. http://services.moseycode.com/portal/chamberID/url/dimensions.(jpg|png)?url=URL

Where

chamberID
is the 32 bit unsigned integer identifier of the chamber to which the portal provides access.*
data
is the data that is encoded in the portal. This may be supplied as a single 48 bit unsigned number, or as two numbers: a 16 bit number and a 32 bit number separated by a '+' character.*
dimensions
is a pair of positive numbers separated by a 'x' character that specify the size of the image in pixels (widthxheight).
URL
is a URL whose hash (see below) provides the data to encode within the portal. Note that supplying a valid URL to this service automatically generates a valid hash for the URL.

* All numbers supplied to the portal service are supplied as unsigned denary integers, or as unsigned hexadecimal integers prefixed by 0x.

In future revisions, this service will provide a number of parameters for customizing the presentation of the barcode that are absent at this time.

Lookup Service

This service is an auxilliary service. It performs a function that is similar to that of TinyURL but tailored to the needs of other Moseycode services.

Requests to the service take one of the following three forms:

  1. http://services.moseycode.com/lookup/hash/URL
  2. http://services.moseycode.com/lookup/url/hash
  3. http://services.moseycode.com/lookup/redirect/hash

In the first case, the service returns an ASCII encoded plain text document that contains single unsigned base 10 number in the range [0, 248) to serve as a permanent and unique hash for the supplied URL.

In the second case, the service returns the URL from which the supplied hash value was generated. The URL is returned in a UTF-8 encoded plain text document.

In the third case, the service responds with a 'moved permanently' (301) redirection to the URL from which the supplied hash was generated.

In all cases, an invalid service call generates a response with status code 404 together with a brief message indicating what was wrong with the request. At the present time, only URLs that use the schemes http and https are supported.

This service is used to in the url data scheme of the portal service.

Chamber Service

This service is very preliminary, access may change in ways that are 'forwardly incompatible'.

Requests to the service are of the form:

http://services.moseycode.com/chamber/chamberID

where chamberID is a 30 bit numeric identifier, expressed in denary, that specifies the chamber definition to be returned. Chamber definitions are UTF-8 encoded XML documents the specifications for which will be detailed separately.

Examples

The following examples (which do not necessarily exhibit valid data) demonstrate various ways of invoking the services. The domain from which the requests are made has been omitted for brevity, it is http://services.moseycode.com in every case.

Request /portal/0x87e83ac9/0/200x200.png
Response an image

Request /portal/10001/0xfffe+0x78f80000/200x200.jpg
Response an image

Request /portal/238432/url/200x200.png?url=http://www.google.com
Response an image

Request /lookup/hash/http://www.google.com
Response 220353061714604

Request /lookup/url/220353061714604
Response http://www.google.com

Request /lookup/redirect/220353061714604
Response redirection to http://www.google.com

Request /lookup/redirect/220353061714604
Response redirection to http://www.google.com

Request /chamber/7
Response an XML document