Przejdź do głównej zawartości

OData API

Standaryzowane API do operacji CRUD na encjach.

Dostępne encje

EncjaEndpoint
Klienci/odata/Clienttts
Kontakty/odata/Contacts
Leady/odata/Leads
Opportunities/odata/Opportunities
Tickety/odata/Tickets
Faktury/odata/Invoices
Artykuły KB/odata/KbArticles
Dokumenty/odata/Documents
Zadania/odata/Tasks
Projekty/odata/Projects

Operacje CRUD

GET - Pobieranie

# Lista wszystkich klientów
GET /odata/Clients

# Pojedynczy klient
GET /odata/Clients(123)

# Z relacjami
GET /odata/Clients(123)?$expand=Contacts,Invoices

POST - Tworzenie

POST /odata/Clients
Content-Type: application/json

{
"name": "Nowy Klient",
"email": "kontakt@nowyklient.pl",
"taxId": "1234567890"
}

PUT/PATCH - Aktualizacja

PATCH /odata/Clients(123)
Content-Type: application/json

{
"email": "nowy@email.pl"
}

DELETE - Usuwanie

DELETE /odata/Clients(123)

Filtrowanie

# Równość
GET /odata/Clients?$filter=status eq 'Active'

# Wyszukiwanie tekstu
GET /odata/Clients?$filter=contains(name, 'ABC')

# Zakres dat
GET /odata/Clients?$filter=createdAt gt 2025-01-01

# Złożone warunki
GET /odata/Clients?$filter=status eq 'Active' and revenue gt 10000

Sortowanie

GET /odata/Clients?$orderby=name asc
GET /odata/Clients?$orderby=revenue desc, name asc

Paginacja

GET /odata/Clients?$top=20&$skip=40

Relacje ($expand)

# Jedno rozszerzenie
GET /odata/Clients?$expand=Contacts

# Wiele rozszerzeń
GET /odata/Clients?$expand=Contacts,Invoices

# Zagnieżdżone
GET /odata/Clients?$expand=Invoices($expand=LineItems)

Projekcja ($select)

GET /odata/Clients?$select=id,name,email

Liczenie

GET /odata/Clients/$count
GET /odata/Clients?$count=true