Cambra de la Propietat Urbana de Badalona — Developer & Agent API

Integrate Cambra's content and services into your application or AI agent. The public API exposes services, news, practical guides, and property listings in a machine-readable format.

REST API

All endpoints are read-only and require no authentication. Responses are JSON.

Method Endpoint Description
GET/wp-json/cambra/v1/infoSite info, contact details, API links
GET/wp-json/cambra/v1/servicesList services (paginated, searchable)
GET/wp-json/cambra/v1/services/{id}Single service
GET/wp-json/cambra/v1/newsList news articles
GET/wp-json/cambra/v1/news/{id}Single news article
GET/wp-json/cambra/v1/practical-infoList practical info guides
GET/wp-json/cambra/v1/practical-info/{id}Single guide
GET/wp-json/cambra/v1/propertiesList property listings (with meta)
GET/wp-json/cambra/v1/properties/{id}Single property listing
GET/wp-json/cambra/v1/search?q={query}Full-text search across all content

Example: List services

GET https://cambrabadalona.com/wp-json/cambra/v1/services

# Response
{
  "items": [
    {
      "id": 42,
      "title": "Administració de Finques",
      "excerpt": "Gestió integral de comunitats de propietaris...",
      "url": "https://cambrabadalona.com/serveis/administracio-finques/",
      "date": "2024-01-15T10:00:00+01:00",
      "type": "servicio"
    }
  ],
  "total": 12,
  "totalPages": 1
}

Example: Search

GET https://cambrabadalona.com/wp-json/cambra/v1/search?q=lloguer+habitatge

Common query parameters

Parameter Type Default Description
langstring(all)Language filter: ca (Catalan) or es (Spanish). Omit to return content in all languages.
per_pageinteger10–20Number of items per page (max 100 for most endpoints).
pageinteger1Page number for pagination.
searchstringKeyword filter applied to title and content (max 200 chars).

Pagination

Collection endpoints that return lists of items support cursor-based page navigation via ?page= and ?per_page=. The API follows the same convention as the WordPress REST API: pagination metadata is returned both in the response body and as HTTP response headers.

Paginated endpoints

  • /wp-json/cambra/v1/news
  • /wp-json/cambra/v1/services
  • /wp-json/cambra/v1/practical-info
  • /wp-json/cambra/v1/properties
  • /wp-json/cambra/v1/topics/{cluster}

Response headers

Header Example Description
X-WP-Total47Total number of items matching the query (before pagination).
X-WP-TotalPages5Total number of pages at the current per_page size.
X-WP-Page2The current page number that was returned.
Linkrel="next", rel="prev"RFC 5988 link relations for the next and previous pages (omitted on first/last page).

Body pagination fields

Every paginated response also includes these fields at the top level of the JSON body:

Field Type Description
itemsarrayThe list of results for this page.
totalintegerTotal number of items across all pages.
totalPagesintegerTotal number of pages at the current per_page size.
pageintegerCurrent page number.
perPageintegerNumber of items per page used for this request.

Example — fetching page 2

# Request page 2, 5 items per page
GET https://cambrabadalona.com/wp-json/cambra/v1/news?per_page=5&page=2

# Response headers
X-WP-Total: 47
X-WP-TotalPages: 10
X-WP-Page: 2
Link: <https://cambrabadalona.com/wp-json/cambra/v1/news?per_page=5&page=1>; rel="prev",
      <https://cambrabadalona.com/wp-json/cambra/v1/news?per_page=5&page=3>; rel="next"

# Response body
{
  "items": [ ... ],
  "total": 47,
  "totalPages": 10,
  "page": 2,
  "perPage": 5
}

Reading the Link header is the recommended way to walk through all pages without hardcoding URL patterns:

# Python example — walk all pages
import requests

url = "https://cambrabadalona.com/wp-json/cambra/v1/news?per_page=20&lang=ca"
while url:
    r = requests.get(url)
    data = r.json()
    process(data["items"])
    # Follow the Link header for the next page
    links = requests.utils.parse_header_links(r.headers.get("Link", ""))
    url = next((l["url"] for l in links if l.get("rel") == "next"), None)

Language filtering

The site is bilingual (Catalan / Spanish, managed by Polylang). Each piece of content exists as a separate post per language. By default every collection endpoint returns items in all languages mixed together. Use ?lang=ca or ?lang=es to restrict results to a single language. Every response item includes a lang field so you can detect the language without filtering.

# Catalan services only
GET https://cambrabadalona.com/wp-json/cambra/v1/services?lang=ca

# Spanish news only
GET https://cambrabadalona.com/wp-json/cambra/v1/news?lang=es

# Search in Catalan
GET https://cambrabadalona.com/wp-json/cambra/v1/search?q=administracio&lang=ca

Response items include "lang": "ca" or "lang": "es", plus a translations map with the URL of the equivalent post in the other language.

OpenAPI Specification

A machine-readable OpenAPI 3.1 specification is published at /openapi.json. Use it to auto-generate client SDKs, import into Postman, or let AI agents discover the full API surface.

GET https://cambrabadalona.com/openapi.json

Compatible with Swagger UI, Redoc, Postman, and any OpenAPI 3.1 toolchain.

MCP Server (AI Agent Integration)

An MCP (Model Context Protocol) server is available at /mcp using Streamable HTTP transport (JSON-RPC 2.0 over HTTPS POST). Compatible with Claude, ChatGPT, and any MCP-capable AI agent.

Available tools

  • get_site_info — Organization info and contact details
  • search_content — Full-text search across all content
  • list_services — Services offered to property owners
  • list_news — Latest news and announcements
  • list_practical_info — Legal and practical guides
  • list_properties — Property listings (Bolsa Inmobiliaria)
  • get_property — Full details for a single property

Quick start (cURL)

# 1. Handshake
curl -X POST https://cambrabadalona.com/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"my-agent","version":"1.0"}}}'

# 2. List tools
curl -X POST https://cambrabadalona.com/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

# 3. Call a tool
curl -X POST https://cambrabadalona.com/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_content","arguments":{"query":"lloguer habitatge"}}}'

Claude Desktop configuration

{
  "mcpServers": {
    "cambrabadalona": {
      "type": "streamable-http",
      "url": "https://cambrabadalona.com/mcp"
    }
  }
}

Resource Index

Questions & Support

For API questions or integration support, contact cambra@cambrabadalona.com.