Consumer guide

This guide is for rental portals, aggregators and anyone else who builds a housing service on ledigt.org files. It summarises the specification; where they differ, the specification applies.

The specification is a draft, and ledigt.org is new: expect few publishers so far. Landlords publish because the rules below promise them three things: the listing links back to their own page, applications are made their way, and a listing they take down disappears. A service that keeps those promises is what makes them publish.

1. Find a publisher's index file

Every publisher has one entry point, the index file. You find it from the landlord's domain (spec section 4):

  1. Try https://<domain>/.well-known/ledigt.json.
  2. If it is not there, fetch the home page https://<domain>/ and look for <link rel="ledigt" href="…">. A relative href is resolved against the home page.

Remember the index URL and the domain that pointed to it. Fetch the index URL from then on; do not rediscover on every cycle. Show listings as belonging to that domain.

There is no central list of publishers today, so you need to know the domains: ask the landlords you work with, or let them submit their domain to you. An open registry of publishers may be added later.

2. Fetch index and feed files

  • Fetch each file at most every 15 minutes, and at least once every 24 hours for as long as you show the publisher's listings.
  • Use conditional requests: send If-None-Match (the last ETag) or If-Modified-Since (the last Last-Modified). A 304 Not Modified means nothing changed.
  • Follow up to 3 redirects. Accept gzip.
  • Identify yourself with a descriptive User-Agent that includes contact information, e.g. ExamplePortal/1.0 (+https://portal.example/bot; bot@portal.example).
  • An index file has either feeds (fetch every URL; the same category may appear several times when a large set is split) or inline listings. Ignore feed references with a category you do not know.
curl -s --compressed \
  -A 'ExamplePortal/1.0 (+https://portal.example/bot; bot@portal.example)' \
  -H 'If-None-Match: "5f2b…"' \
  https://exempel-fastigheter.se/.well-known/ledigt.json

3. Update your copy

Key listings by the publisher's domain and the listing's id. id is unique across all feeds of a publisher. If you see the same id twice, use the occurrence with the latest updated.

  • available – publish or update the listing.
  • reserved – a tenant has been chosen; you may show it as reserved.
  • let – a tombstone. Take the listing down as part of handling that fetch. Publishers keep tombstones for at least 7 days.

Taking listings down

These are requirements (spec section 11). Together they mean that a listing a landlord has let or removed is gone from your service within 24 hours, and that everything from a landlord whose files are gone is taken down within 72 hours.

  • Gone from the files: you must take down a listing that is no longer in the publisher's files, also when there was no tombstone.
  • Judge disappearance over the union of all feeds and inline listings of the index file, not per feed file. A listing that moves between files of a split set has not disappeared. Listings of a feed entry that was removed from the index file count as disappeared.
  • Only judge disappearance after the index file and every feed in it were fetched successfully in the same cycle. If any fetch fails, take nothing down for that publisher in that cycle because it is missing.
  • Not reachable: you must stop showing a listing when 72 hours have passed since you last successfully fetched both the index file and the file that contained it. A 304 counts as success. No answer in time, a final status other than 200 or 304, or a body that is not a JSON object is a failure.

4. Show the listing the publisher's way

Requirements from spec sections 4, 7.1, 9 and 16:

  • Link back. Show a link to the listing's url and show the publisher's domain with every listing.
  • How to apply. Show applicationMethod and applicationDeadline when they are present.
  • Applications go to the publisher. Send applicants to applyUrl, or to url when there is none. When the listing has applyUrl, applicationMethod or applicationDeadline, do not accept applications or expressions of interest yourself.
  • Requirements. You should show residential.requirements, so applicants know the conditions before they contact the landlord.
  • Media. You may show the files behind media[].url together with the listing, by link or from a copy, for as long as the listing is in the publisher's files. Stop when the listing is taken down. Do not use media for anything else: the license field does not cover them.
  • Contact details. Use contact, publisher.email and publisher.phone only to show them with the listing and to contact the publisher about its listings or files. Never for marketing.
  • License. license in the index file is the publisher's choice and applies to the data in the files. Not every publisher uses CC-BY-4.0: check the value, and do not use data whose license you cannot follow (for example a non-commercial license in a commercial service).

A publisher and a service can agree on something else between themselves. That is outside the specification.

5. Be liberal in what you accept

  • Ignore unknown fields. Fields starting with x- are extensions.
  • An unknown value in an array (features, incomeTypes) or an unknown key in utilities is ignored; use the rest.
  • An unknown value in an optional enum field (e.g. applicationMethod) makes you ignore that field.
  • An unknown rent.period or extraCosts[].period makes that amount unknown. Do not assume month.
  • An unknown status means the listing is not available. Do not publish it.
  • An omitted utility means unknown, not included. An omitted availableFrom means by agreement.

6. Security

  • Attribute listings to the domain that points to the index file, not to the host of the feed files. Feed files may be hosted anywhere.
  • Listings can be copied by others, like any public web page. Only treat a listing as a ledigt.org listing when you fetched it from the publisher's own domain.
  • All text is untrusted. Escape HTML when you show it.
  • Limit response size and fetch time, and refuse URLs that resolve to private, loopback or link-local addresses.

7. Validation API

GET /api/validate?url=<domain or URL> runs the same check as the web validator and returns JSON: valid, discovery, index, counts, feeds and lists of errors, warnings and tips. Each item has file, path (e.g. listings[3].rent) and a Swedish message where `backticks` mark code. Requests are rate limited per IP address.

curl -s 'https://ledigt.org/api/validate?url=exempel-fastigheter.se'