Standorte

Standorte über client.locations auflisten, erstellen, aktualisieren, archivieren, suchen und abrufen.

Alle Standortmethoden sind unter client.locations verfügbar. Installieren Sie das SDK und konfigurieren Sie Ihren Schlüssel, bevor Sie diese verwenden; siehe Installation und Schnellstart.

Standort-IDs

Methoden mit dem Parameter location_id akzeptieren entweder eine numerische ID (16808) oder deren base64-kodierte Entsprechung ("TG9jYXRpb246MTY4MDg="). Das SDK kodiert numerische IDs automatisch, sodass beide Formen austauschbar sind:

Python
# These are equivalentclient.locations.retrieve(16808)client.locations.retrieve("TG9jYXRpb246MTY4MDg=")

locations.add

Erstellen Sie einen Standort mit einem einzigen Aufruf und übergeben Sie jedes Pflichtfeld als Schlüsselwortargument. Dies ist die empfohlene Vorgehensweise zum Erstellen von Standorten. Das SDK prüft die Anforderungen der API für die Erstellung clientseitig und löst vor jedem Netzwerkaufruf bei einem Verstoß ValidationError aus, sodass eine ungültige Payload sofort mit einer klaren Meldung abgewiesen wird.

Python
client.locations.add(    *,    name: str,    description: str,    sub_category_id: int,    country_iso: str,    city: str | None = None,    street: str | None = None,    state_iso: str | None = None,    postal_code: str | None = None,    phone: str | None = None,    website: str | None = None,    store_id: str | None = None,    hide_address: bool | None = None,    business_hours: list[dict] | None = None,    service_area: dict | None = None,    place_action_links: list[dict] | None = None,    enabled_site_ids: list[int] | None = None,    additional_fields: dict | None = None,) -> APIObject
ArgumentTypBeschreibung
namestrUnternehmensname, 2-150 Zeichen. Erforderlich.
descriptionstrUnternehmensbeschreibung, mindestens 200 Zeichen. Plattformen verwenden sie als Haupttext des Eintrags. Erforderlich.
sub_category_idintID der primären Unterkategorie. Verwenden Sie client.subcategories(), um gültige IDs abzurufen. Erforderlich.
country_isostrZweistelliger ISO-Ländercode. Verwenden Sie client.countries(), um unterstützte Länder abzurufen. Erforderlich.
citystrStadt. Erforderlich für Länder, deren Adressierung eine Stadtangabe vorsieht; nur bei Unternehmen mit Einzugsgebiet und hide_address=True weglassen.
streetstrStraßenadresse.
state_isostrISO-Code des Bundeslandes oder der Region.
postal_codestrPostleitzahl oder ZIP-Code.
phonestrPrimäre Telefonnummer, deren Gültigkeit für das Land geprüft wird.
websitestrURL der Unternehmenswebsite.
store_idstrIhr eindeutiger Filialcode; muss innerhalb des gesamten Kontos eindeutig sein.
hide_addressboolStraßenadresse ausblenden (Unternehmen mit Einzugsgebiet).
business_hourslist[dict]Wöchentliche Öffnungszeiten, e.g. [{"day": "MONDAY", "slots": [...]}].
service_areadictKonfiguration des Einzugsgebiets: {businessType, regionCode, placeInfos}.
place_action_linkslist[dict]Google-Aktionslinks, e.g. [{"placeActionType": "APPOINTMENT", "uri": "https://...", "isPreferred": True}].
enabled_site_idslist[int]IDs der Websites, auf denen dieser Standort veröffentlicht werden soll, wenn Sie nur einen Teil der Websites Ihres Tarifs nutzen möchten. Verwenden Sie client.plan_sites(), um IDs abzurufen.
additional_fieldsdictZusätzliche camelCase-Felder, die unverändert in die Payload übernommen werden.

Die clientseitige Validierung prüft: name hat 2-150 Zeichen, description hat mindestens 200 Zeichen, sub_category_id und country_iso sind vorhanden und city ist vorhanden, sofern nicht hide_address=True gilt.

Der Rückgabewert ist die Payload der Erstellung: .location enthält den neuen Standort. Sie müssen niemals Erfolgsflags prüfen; das SDK löst ValidationError aus, wenn die API die Payload ablehnt.

Python
result = client.locations.add(  name="Acme Dental",  description=(      "Acme Dental is a family-owned dental practice offering general, "      "cosmetic, and pediatric dentistry in the heart of New York. Our "      "team provides cleanings, fillings, crowns, whitening, and same-day "      "emergency care in a modern, comfortable office with weekend hours "      "and easy online booking for new and returning patients."  ),  sub_category_id=1432,  country_iso="US",  city="New York",  street="123 Jump Street",  state_iso="NY",  postal_code="10013",  phone="6443859313",  website="https://acmedental.example.com",  store_id="NYC-001",  place_action_links=[      {"placeActionType": "APPOINTMENT", "uri": "https://acmedental.example.com/book", "isPreferred": True},  ],  enabled_site_ids=[1, 24, 87],)print("Created:", result.location.id, result.location.name)

locations.list

Listen Sie Standorte mit cursorbasierter Paginierung auf. Gibt ein Objekt vom Typ SyncPage zurück.

Python
client.locations.list(    *,    first: int | None = None,    after: str | None = None,    before: str | None = None,    last: int | None = None,) -> SyncPage
Python
# First page of 25page = client.locations.list(first=25)for loc in page:  print(loc.name, loc.city) # Next page manuallyif page.has_more:  page2 = page.next_page() # Auto-paginate all locationsfor loc in client.locations.list(first=100).auto_paging_iter():  print(loc.name)

locations.retrieve

Rufen Sie einen einzelnen Standort anhand seiner ID ab. Löst NotFoundError aus, wenn die ID nicht existiert.

Python
client.locations.retrieve(location_id: str | int) -> APIObject
Python
loc = client.locations.retrieve(16808)print(loc.name, loc.street, loc.city)

locations.list_by_ids

Rufen Sie mehrere Standorte anhand einer Liste von IDs (numerisch oder base64-kodiert) mit einem einzigen Aufruf ab.

Python
client.locations.list_by_ids(location_ids: list[str | int]) -> list[APIObject]
Python
locs = client.locations.list_by_ids([16808, 16809, "TG9jYXRpb246MTQwMjQ="])for loc in locs:  print(loc.id, loc.name)

locations.list_by_store_codes

Rufen Sie Standorte ab, die den angegebenen Filialcodes entsprechen.

Python
client.locations.list_by_store_codes(store_codes: list[str]) -> list[APIObject]
Python
locs = client.locations.list_by_store_codes(["SF-001", "NYC-042"])for loc in locs:  print(loc.storeId, loc.name)

locations.search

Durchsuchen Sie Standorte anhand eines Suchbegriffs in Name, Adresse oder Filial-ID. Gibt ein Objekt vom Typ SyncPage zurück.

Python
client.locations.search(    query: str,    *,    fields: list[str] | None = None,    first: int | None = None,    after: str | None = None,    before: str | None = None,    last: int | None = None,) -> SyncPage
Python
# Search all fieldspage = client.locations.search("downtown dental", first=10) # Restrict to name onlypage = client.locations.search("Acme Dental", fields=["name"], first=10) for loc in page:  print(loc.name, loc.city)

locations.create

Erstellen Sie einen Standort aus einem unverarbeiteten Eingabe-Dictionary mit camelCase-Feldnamen. Verwenden Sie vorzugsweise locations.add für Schlüsselwortargumente und clientseitige Validierung; verwenden Sie create, wenn Sie bereits eine camelCase-Payload haben.

Python
client.locations.create(input: dict) -> APIObject

Von der API vorgeschrieben: name, description (mindestens 200 Zeichen), subCategoryId, countryIso und city (für Länder, deren Adressierung eine Stadtangabe vorsieht).

Python
result = client.locations.create({  "name": "Acme Dental Brooklyn",  "description": (      "Acme Dental Brooklyn is a family-owned dental practice offering "      "general, cosmetic, and pediatric dentistry. Our team provides "      "cleanings, fillings, crowns, whitening, and same-day emergency "      "care in a modern, comfortable office with weekend hours and easy "      "online booking for new and returning patients across Brooklyn."  ),  "subCategoryId": 1432,  "countryIso": "US",  "city": "Brooklyn",  "street": "88 Court St",  "stateIso": "NY",  "postalCode": "11201",  "phone": "6443859314",  "storeId": "NYC-002",})print("Created:", result.location.id)

locations.update

Aktualisieren Sie einen Standort. Übergeben Sie id sowie alle zu ändernden Felder (camelCase). Der Wert von id kann numerisch oder base64-kodiert sein; das SDK kodiert ihn automatisch.

Python
client.locations.update(input: dict) -> APIObject
Python
result = client.locations.update({  "id": 16808,  "phone": "6443859399",  "street": "125 Jump Street",})print("Updated:", result.location.id)

locations.archive

Archivieren Sie einen oder mehrere Standorte.

Python
client.locations.archive(location_ids: list[str | int]) -> APIObject
Python
result = client.locations.archive([16808, 16809])print(result.to_dict())

locations.cancel_archive

Brechen Sie eine geplante Archivierung ab.

Python
client.locations.cancel_archive(    location_ids: list[str | int],    selection_type: str,    changed_by: str,) -> APIObject
Python
client.locations.cancel_archive(  [16808],  selection_type="manual",  changed_by="admin@example.com",)

Siehe auch

  • Beiträge: Ankündigungen, Veranstaltungen und Angebote veröffentlichen
  • Einträge: Synchronisierungsstatus pro Standort prüfen
  • Bewertungen: Bewertungen auflisten und beantworten
  • Analysen: Profilanalysen für Google, Bing und Facebook