# Implementation example This section gives step-by-step examples for fetching data for a My Pages experience. Refer to the API Reference for exact paths and parameters. ### Step 1: Spaces for tenants Fetch spaces (e.g. apartments) for a set of tenants. - From the results you can then load buildings, real estates, communities, etc. **Endpoint:** [GET /objects/spaces/spaces/apartment/list/](/apis/objects) ``` GET .../objects/spaces/spaces/apartment/list/?_page=1&_page_size=500&tenants=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **tenants** — Comma-separated tenant IDs ### Step 2: Contracts for tenants Fetch rentable contracts for a set of tenants. - For other contract types, use the corresponding list with a `tenants` filter where supported. **Endpoint:** [GET /contracts/apartmentcontract/list/](/apis/contracts) ``` GET .../contracts/apartmentcontract/list/?_page=1&_page_size=500&tenants=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **tenants** — Comma-separated tenant IDs ### Step 3: Contract files (signed outside Pigello) Fetch [contracts.signedcontractdocument](/apis/contracts) items for the contracts from step 2. - Use the contract content type (e.g. `contracts.apartmentcontract`) for ``. **Endpoint:** List endpoint for [contracts.signedcontractdocument](/apis/contracts). ``` GET .../contracts/signedcontractdocument/list//?_page=1&_page_size=500&object_id__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **object_id__in** — Comma-separated contract IDs from step 2 ### Step 4: Contract files (signed in Pigello) Fetch [documents.signabledocument](/apis/documents) items for the contracts from step 2. - Document payloads are often ZIPs; unzip to get the final PDF and metadata. **Endpoint:** List endpoint for [documents.signabledocument](/apis/documents). ``` GET .../documents/signing/signabledocument/list//?_page=1&_page_size=500&object_id__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **object_id__in** — Comma-separated contract IDs from step 2 ### Step 5: Notifications for tenants **Endpoint:** [GET /communication/notification/list/](/apis/communication) ``` GET .../communication/notification/list/?_page=1&_page_size=500&sent_to_tenant__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **sent_to_tenant__in** — Comma-separated tenant IDs ### Step 6: Notification distributions From the notifications in step 5, fetch their distributions. **Endpoint:** [GET /communication/notificationdistribution/list/](/apis/communication) ``` GET .../communication/notificationdistribution/list/?_page=1&_page_size=500¬ification__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **notification__in** — Comma-separated notification IDs from step 5 ### Step 7 (optional): Sendouts If a notification's `content_type` is `communication.sendout` and `event_identifier` indicates a sent sendout, get the sendout IDs from `object_id` and fetch [communication.sendout](/apis/communication). **Endpoint:** [GET /communication/sendout/list/](/apis/communication) ``` GET .../communication/sendout/list/?_page=1&_page_size=500&id__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **id__in** — Comma-separated sendout IDs from notifications (object_id) ### Step 8: Attested invoices for tenant **Endpoint:** [GET /accounting/invoices/invoice/list/](/apis/accounting) ``` GET .../accounting/invoices/invoice/list/?_page=1&_page_size=500&tenant=&attested_date__isnull=False ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **tenant** — Tenant ID - **attested_date__isnull** — `False` to only include attested invoices ### Step 9: Attested invoices for sub-tenant **Endpoint:** [GET /accounting/invoices/invoice/list/](/apis/accounting) ``` GET .../accounting/invoices/invoice/list/?_page=1&_page_size=500&sub_tenant=&attested_date__isnull=False ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **sub_tenant** — Sub-tenant (tenant) ID - **attested_date__isnull** — `False` to only include attested invoices ### Step 10: Invoice recipients for tenants - From recipients' `invoice` attribute, build the set of invoice IDs for the next steps. **Endpoint:** [GET /accounting/invoices/invoicerecipient/list/](/apis/accounting) ``` GET .../accounting/invoices/invoicerecipient/list/?_page=1&_page_size=500&tenant__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **tenant__in** — Comma-separated tenant IDs ### Step 11: Invoices by ID **Endpoint:** [GET /accounting/invoices/invoice/list/](/apis/accounting) ``` GET .../accounting/invoices/invoice/list/?_page=1&_page_size=500&id__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **id__in** — Comma-separated invoice IDs from recipients (step 10) ### Step 12: Debt invoices for those invoices **Endpoint:** [GET /accounting/debt/debtinvoice/list/](/apis/accounting) ``` GET .../accounting/debt/debtinvoice/list/?_page=1&_page_size=500&invoice__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **invoice__in** — Comma-separated invoice IDs from step 11 ### Step 13: Payments (various filters) * Payments distributed to invoices * Payments originally matched but not distributed * Payments originally matched or distributed * Unhandled payments for tenants * All Payments for tenants * Payments distributed to debt invoices **Endpoint:** [GET /accounting/payments/invoicepayment/list/](/apis/accounting) **Payments distributed to invoices:** ``` GET .../accounting/payments/invoicepayment/list/?_page=1&_page_size=500&invoice__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **invoice__in** — Comma-separated invoice IDs **Payments originally matched but not distributed:** ``` GET .../accounting/payments/invoicepayment/list/?_page=1&_page_size=500&original_invoice__in=,&invoice__isnull=true&debt_invoice__isnull=true ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **original_invoice__in** — Comma-separated invoice IDs - **invoice__isnull** — `true` (not yet distributed to an invoice) - **debt_invoice__isnull** — `true` (not distributed to a debt invoice) **Payments originally matched or distributed to invoices:** ``` GET .../accounting/payments/invoicepayment/list/?_page=1&_page_size=500&invoices_indirect=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **invoices_indirect** — Comma-separated invoice IDs (matched or distributed) **Unhandled payments for tenants:** ``` GET .../accounting/payments/invoicepayment/list/?_page=1&_page_size=500&tenant__in=,&invoice__isnull=true&original_invoice__isnull=true&debt_invoice__isnull=true ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **tenant__in** — Comma-separated tenant IDs - **invoice__isnull** — `true` - **original_invoice__isnull** — `true` - **debt_invoice__isnull** — `true` **Payments for tenants (all):** ``` GET .../accounting/payments/invoicepayment/list/?_page=1&_page_size=500&tenant__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **tenant__in** — Comma-separated tenant IDs **Payments distributed to debt invoices:** ``` GET .../accounting/payments/invoicepayment/list/?_page=1&_page_size=500&debt_invoice__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **debt_invoice__in** — Comma-separated debt invoice IDs from step 12 ### Step 14: General errands (reported by tenants) Serialization can depend on errand type/sub-type and client; contact support for details. **Endpoint:** [GET /errands/generalerrands/reporting/generalerrand/](/apis/errands) ``` GET .../errands/generalerrands/reporting/generalerrand/?_page=1&_page_size=500&reporter_tenant__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **reporter_tenant__in** — Comma-separated tenant IDs (reported by these tenants) ### Step 15: General errands (created by tenants) **Endpoint:** [GET /errands/generalerrands/reporting/generalerrand/](/apis/errands) ``` GET .../errands/generalerrands/reporting/generalerrand/?_page=1&_page_size=500&creator_tenant__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **creator_tenant__in** — Comma-separated tenant IDs (created by these tenants) ### Step 16: General errands (tenants as reviewers/subscribers) **Endpoint:** [GET /errands/generalerrands/reporting/generalerrand/](/apis/errands) ``` GET .../errands/generalerrands/reporting/generalerrand/?_page=1&_page_size=500&tenant_reviewers__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **tenant_reviewers__in** — Comma-separated tenant IDs (tenants as reviewers/subscribers) ### Step 17: General errand files From the errands in steps 14–16, fetch attached files. **Endpoint:** [GET /errands/generalerrands/reporting/generalerrandfile/](/apis/errands) ``` GET .../errands/generalerrands/reporting/generalerrandfile/?_page=1&_page_size=500&errand__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **errand__in** — Comma-separated errand IDs from steps 14–16 ### Step 18: Inspection errands for apartments **Endpoint:** [GET /errands/inspections/reporting/inspectionerrand/](/apis/errands) ``` GET .../errands/inspections/reporting/inspectionerrand/?_page=1&_page_size=500&apartment__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **apartment__in** — Comma-separated apartment IDs from step 1 ### Step 19: Inspection faults for those inspections **Endpoint:** [GET /errands/inspections/reporting/inspectionerrandfault/](/apis/errands) ``` GET .../errands/inspections/reporting/inspectionerrandfault/?_page=1&_page_size=500&inspection_errand__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **inspection_errand__in** — Comma-separated inspection errand IDs from step 18