Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

JSON: usernotes

Enigma edited this page Aug 11, 2015 · 10 revisions

Usernotes are stored in /r/subreddit/wiki/usernotes

  • Any implementation where this page is created or modified should include setting the page to be visible for moderators only.
  • Any implementation should check for the schema version used and never write an older schema than indicated in the json.
  • Usernotes as of version schema 6 also make use of zlib to increase the amount of notes that can be stored.

Current schema version is 6. Supported read-only schema versions are 4-5.

Example

{  
    "ver":6,
    "constants": {  
        "users": [  
            "creesch"
        ],
        "warnings": [  
            "none"
        ]
    },
    "blob":"eJyrVkouSk0tTs5QsqpWyitWsooGUkpWSiEZmcUKQJSokJdfkqqko1SiZGVoYmxpZGhuZmmqo5SrZGWgo5QDVJmjY2SQZp6ZA1RTDhSsja2tBQA4HBgB"
}
Decompressed blob
{
    "TheEnigmaBlade": {
        "ns": [
            {
                "n": "The coolest toolbox dev",
                "t": 1430842947,
                "m": 0,
                "l": "l,2oaecb",
                "w": 0
            }
        ]
    }
}

Structure

Top-level structure
  • ver: The schema version used
  • constants: For storing mod names and note types
    • users: An array of mod username constants
    • warnings: An array of note type constants
  • blob: A base64-encoded and zlib-compressed json object containing note data

The blob is decompressed into the data object used in schema 5, which is the format used internally by toolbox (see the source code for more information). This object contains a set of notes objects associated with noted users' names.

Notes object structure
  • ns: A list of note objects on a user, short for "notes"
Note object structure
  • n: The note text, short for "note"
  • l: The thing information to which the note links, short for "link"
  • t: The time the note was made in seconds (schema 4 uses milliseconds), short for "time"
  • m: An index from the users constants array, short for "mod"
  • w: An index from the warnings constants array, short for "warning" ("type" used internally)

Thing information (l) has three possible formats depending on thing type:

  1. Post: l,POST_ID
  2. Comment: l,POST_ID,COMMENT_ID
  3. Modmail: m,MESSAGE_ID
Clone this wiki locally