Skip to content

publish

Create a new listing from a JSON template file.

Usage

bash
willhaben publish <file> [options]

Arguments

ArgumentDescription
<file>Path to JSON template file

Options

OptionDescription
--jsonOutput as JSON

Template Format

Required Fields

FieldTypeDescription
titlestringListing title (max 100 chars)
descriptionstringDetailed description
pricenumberPrice in EUR
postCodestringPostal code (e.g., "1010")
locationIdnumberWillhaben location ID
locationstringDistrict/city name
categoryPathstring[]Category path from root to leaf

Optional Fields

FieldTypeDescription
conditionstring"neu", "gebraucht", or "defekt"
deliverystring[]["PICKUP"], ["Versand"], or both
attributesobjectCategory-specific attributes

Example Template

Create my-item.json:

json
{
  "title": "iPhone 14 Pro - Excellent Condition",
  "description": "Selling my iPhone 14 Pro 256GB in excellent condition. Always used with a case and screen protector.",
  "price": 799,
  "postCode": "1010",
  "locationId": 900,
  "location": "Wien",
  "categoryPath": ["MOBILE_ELECTRONICS", "MOBILE_PHONES", "IPHONE"],
  "condition": "gebraucht",
  "delivery": ["PICKUP", "Versand"]
}

Then publish:

bash
willhaben publish my-item.json
# Listing created successfully!
# ID: 123456789
# URL: https://willhaben.at/iad/object?adId=123456789

Category Examples

Electronics - Printer
json
{
  "title": "HP LaserJet Pro - wie neu",
  "description": "Verkaufe meinen HP LaserJet Pro Drucker...",
  "price": 120,
  "postCode": "8010",
  "locationId": 117458,
  "location": "Graz",
  "categoryPath": [
    "COMPUTER_SOFTWARE",
    "PRINTER_MONITORS_SPEAKER",
    "PRINTER",
    "LASER_PRINTER"
  ],
  "condition": "gebraucht",
  "delivery": ["PICKUP", "Versand"],
  "attributes": {
    "BRAND_PRINTER": "HP"
  }
}
Books
json
{
  "title": "Clean Code - Robert C. Martin",
  "description": "Buch in sehr gutem Zustand...",
  "price": 15,
  "postCode": "5020",
  "locationId": 30501,
  "location": "Salzburg",
  "categoryPath": [
    "BOOKSFILMANDMUSIC",
    "NON_FICTION_BOOKS"
  ],
  "condition": "gebraucht",
  "delivery": ["Versand"]
}

Common Location IDs

CityLocation ID
Wien900
Graz117458
Salzburg30501
Linz40101
Innsbruck70101

Requires Authentication

You must be logged in to use this command.

Released under the MIT License. Not affiliated with willhaben.