Services/Sync/Server/Archived/0.3/API: Difference between revisions

From MozillaWiki
< Services‎ | Sync‎ | Server‎ | Archived
Jump to navigation Jump to search
Line 82: Line 82:
= Response Codes =
= Response Codes =


The API uses the standard [[Weave Response Codes]]
The API uses the standard [https://wiki.mozilla.org/Labs/Weave/0.3/ResponseCodes Weave Response Codes]


= Payloads =
= Payloads =

Revision as of 00:05, 8 November 2008

Weave 0.3 API

Release Date: TBD

Weave Basic Object (WBO)

A Weave Basic Object is the generic wrapper around all items passed into and out of the Weave server. The Weave Basic Object has the following fields:

Parameter Default Max Description
id required 64 An identifying string. For a user, the id must be unique for a WBO within a collection, though objects in different collections may have the same ID.
parentid none 64 The id of a parent object in the same collection. This allows for the creation of hierarchical structures (such as folders).
modified time submitted 16 The last-modified date, in Julian date format.
encryption none 256 The URL of a Weave Encryption Record (WER) that defines how the payload is encrypted. No URL means that the payload is being sent unencrypted.
encoding utf-8 16 The character set of the decrypted payload.
payload none 256K The (possibly encrypted) JSON structure encapsulating the data of the record. This structure is defined separately for each WBO type.

Sample:

{
	"id": "B1549145-55CB-4A6B-9526-70D370821BB5",
	"parentid": "88C3865F-05A6-4E5C-8867-0FAC9AE264FC",
	"modified": "2454725.98283",
	"encryption": "http://server/prefix/version/user/crypto-meta/B1549145-55CB-4A6B-9526-70D370821BB5",
	"encoding": "shift-JIS",
	"payload": "a89sdmawo58aqlva.8vj2w9fmq2af8vamva98fgqamff..."
}

URL Semantics

Term Description
server The name of the Weave server.
prefix Any added path prefix that defines the Weave namespace on that server.
version The Weave API version.
user The userid of the Weave user.
collection A defined grouping of objects into a set. All basic objects will be a member of one collection, and it will be the access point for those objects.
id The Weave Basic Object id.

Response Codes

The API uses the standard Weave Response Codes

Payloads

Payloads are a hash with a required "type" key that defines the object type of the payload. Other keys will be required based on this type.

Here are some defined Payload Structures:

Bookmarks

(needs defining)

History

(needs defining)

Private Key

Public Key payloads must be unencrypted. Note that the key itself is still passphrase protected.

Parameter Default Description
key_data required The private key, passphrase encrypted.
public_key required The URI to the public key associated with this private key.

Sample

  "payload": 
  {
    "type: "private_key",
    "key_data": "nviuwc023nd210o3idn120x283cm...",
    "public_key": "A24349145-5AB-2YX-9526"
  }


Public Key

Public Key objects must be unencrypted.

Parameter Default Description
key_data required The public key
private_key required The URI to the private key associated with this private key.

Sample

  "payload": 
  {
    "type: "public_key",
    "key_data": "nviuwc023nd210o3idn120x283cm...",
    "private_key": "B24349145-5AB-2YX-9526"
  }

Cryptometa

Cryptometa objects must be unencrypted.

Parameter Default Description
algorithm required A hash, containing a "name" key and associated value, and any additional data required for the algorithm, such as "salt" or "iv".
keyring empty A hash in which the keys are URLs to publickey WERs and the values are the encryption string used with that key to encrypt this record. The keys may be fully qualified URLs, or relative to the id level (thus, just the id is acceptable)

Sample

  "payload": 
  {
    "type: "cryptometa",
    "algorithm": 
    {
      "name": "aes-256-cbc",
      "salt": "234imasd9f8w23m7",
      "iv": "2w3kmv9821maz985"
    }
    "keyring": 
    {
	  "B24349145-5AB-2YX-9526": "m29f2mnvwiecvnw0ev...",
    }
  }