← Home

Worked guide

Save a result, revise it, and retrieve the original

A complete Python workflow for small text artifacts, session ownership, and pinned revisions.

Keep a small result available between tools without setting up a database. Parcel-style resources are public text, limited to 8,000 characters. Save the stable resource ID, preserve your owner cookie, and pin the revision when reproducing a result.

Run a complete example

This Python 3 example uses only the standard library. It creates a public example, saves a second revision, and verifies that the original bytes remain retrievable. The owner cookie stays in memory for this run; use a saved cookie jar for later editing.

import hashlib, http.cookiejar, json, urllib.request
origin = "https://parcelartifact.com"
client = urllib.request.build_opener(
    urllib.request.HTTPCookieProcessor(http.cookiejar.CookieJar()))
def call(path, body=None, method=None):
    req = urllib.request.Request(origin + path,
        data=json.dumps(body).encode() if body is not None else None,
        headers={"Content-Type": "application/json"}, method=method)
    with client.open(req) as response:
        return json.load(response)
original = '{"result": 42}'
created = call("/api/resources", {"title": "Example result", "content": original})
path = "/api/resources/" + created["id"]
call(path, {"title": "Example result", "content": '{"result": 43}', "version": 1}, "PUT")
with client.open(origin + path + "/content?version=1") as response:
    retained = response.read()
assert retained == original.encode()
print("Original SHA-256:", hashlib.sha256(retained).hexdigest())
print("Saved resource:", origin + created["url"])

Retry writes deliberately

For retryable requests, send an Idempotency-Key and reuse that key only for the identical request in the same owner session. Updates require a version; a stale version returns 409. Anyone with the link can read public content. The service has bounded storage and is not a permanent backup.

Store an artifact → · Full API documentation