# Kontakty- osoby
#### 1. Pobranie listy kontaktów- osób zapisanych w CRM
Metoda pozwala na pobranie kontaktów (osób) zapisanych w bazie CRM.
Metoda: **GET** Adres URL: **{twoja\_nazwa}.ccrm.pl/publicApi/people**
Metoda stosuje stronicowanie powyżej 1000 rekordów. API zwróci zawsze maksymalnie 1000 rekordów, a o resztę należy zapytać dodając do adresu page={numer\_strony}. Przykładowo, dla sytuacji gdzie jest więcej niż 1000 rekordów stosujemy:
```JSON
{twoja_nazwa}.ccrm.pl/publicApi/people?page=2
```
**Struktura odpowiedzi**
**Właściwość**
| **Wartość**
| **Opis**
|
success
| bool
| |
data.uuid
| uuid
| Wartość identyfikująca rekord.
|
data.firstName
| string | null
| Pierwsze imię.
|
data.middleName
| string | null
| Drugie imię.
|
data.lastName
| string | null
| Nazwisko.
|
data.pesel
| string | null
| PESEL.
|
data.avatar
| string | null
| Nazwa pliku z avatarem.
|
data.description
| string | null
| Opis.
|
data.phone1
| string | null
| Numer telefonu.
|
data.phone1Name
| string | null
| Nazwa numeru telefonu.
|
data.phone2
| string | null
| Numer telefonu.
|
data.phone2Name
| string | null
| Nazwa numeru telefonu.
|
data.phone3
| string | null
| Numer telefonu.
|
data.phone3Name
| string | null
| Nazwa numeru telefonu.
|
data.email1
| string | null
| Adres e-mail.
|
data.email1Name
| string | null
| Nazwa adresu e-mail.
|
data.email2
| string | null
| Adres e-mail.
|
data.email2Name
| string | null
| Nazwa adresu e-mail.
|
data.email3
| string | null
| Adres e-mail.
|
data.email3Name
| string | null
| Nazwa adresu e-mail.
|
data.idDocType
| string | null | in:Dowód osobisty, Paszport, Karta pobytu, Prawo jazdy, Inny
| Typ dokumentu
|
data.idDocTypeName
| string | null
| Nazwa dokumentu.
|
data.idDocNumber
| string | null
| Numer dokumentu.
|
data.idDocIssuer
| string | null
| Organ wydający dokument.
|
otherData.totalCount
| int
| Ilość osób.
|
message
| string
| |
data.address1
| object
| Tabela pomocnicza: address.
|
data.address2
| object
| Tabela pomocnicza: address.
|
data.address3
| object
| Tabela pomocnicza: address.
|
data.organisations
| array
| Tabela pomocnicza: organisation.
|
data.flags
| array
| Tabela pomocnicza: flag.
|
data.supervisors
| array
| Tabela pomocnicza: supervisor.
|
data.CustomValue
| array
| Tabela pomocnicza: customValue.
|
**Tabela pomocnicza: address**
**Właściwość**
| **Wartość**
| **Opis**
|
uuid
| uuid
| Wartość identyfikująca rekord.
|
name
| string
| Nazwa adresu.
|
street
| string | null
| Ulica.
|
buildingNo
| string | null
| Budynek.
|
localNo
| string | null
| Lokal.
|
postcode
| string | null
| Kod pocztowy.
|
city
| string | null
| Miasto.
|
voivodeship
| string | null
| Województwo.
|
country
| string | null
| Kraj.
|
district
| string | null
| Powiat.
|
**Tabela pomocnicza: organisation**
**Właściwość**
| **Wartość**
| **Opis**
|
uuid
| uuid
| Wartość identyfikująca rekord.
|
name
| string
| Nazwa organizacji.
|
phone1
| string | null
| Numer telefonu.
|
phone1Name
| string | null
| Nazwa numeru telefonu.
|
phone2
| string | null
| Numer telefonu.
|
phone2Name
| string | null
| Nazwa numeru telefonu.
|
phone3
| string | null
| Numer telefonu.
|
phone3Name
| string | null
| Nazwa numeru telefonu.
|
email1
| string | null
| Adres e-mail.
|
email1Name
| string | null
| Nazwa adresu e-mail.
|
email2
| string | null
| Adres e-mail.
|
email2Name
| string | null
| Nazwa adresu e-mail.
|
email3
| string | null
| Adres e-mail.
|
email3Name
| string | null
| Nazwa adresu e-mail.
|
role
| string | null
| Rola jaką pełni osoba kontaktowa w danej organizacji.
|
**Tabela pomocnicza: flag**
**Właściwość**
| **Wartość**
| **Opis**
|
uuid
| uuid
| Wartość identyfikująca rekord.
|
name
| string
| Nazwa flagi.
|
color
| string
| Kolor flagi.
|
reluuid
| uuid
| Wartość identyfikująca powiązanie flagi z osobą kontaktową.
|
**Tabela pomocnicza: supervisor**
**Właściwość**
| **Wartość**
| **Opis**
|
uuid
| uuid
| Wartość identyfikująca rekord.
|
role
| string in:watcher,manager
| Pełniona funkcja (watcher- obserwator, manager- opiekun).
|
useruuid
| uuid
| Wartość identyfikująca użytkownika.
|
firstName
| string
| Imię.
|
lastName
| string
| Nazwisko.
|
extension
| int
| Numer SIP.
|
workNumber
| string
| Numer służbowy.
|
email
| string
| Adres email.
|
**Tabela pomocnicza: customValue**
**Właściwość**
| **Wartość**
| **Opis**
|
uuid
| uuid
| Wartość identyfikująca rekord.
|
type
| string
| Typ własnego pola.
|
value
| string
| Wartość własnego pola.
|
Przykład odpowiedzi
```JSON
{
"success":true,
"data":[
{
"uuid":"2b4a0a5d-292c-4d3a-8ef4-60707f70b49c",
"firstName":"Jadwiga",
"middleName":null,
"lastName":"Testowa",
"pesel":null,
"avatar":null,
"description":null,
"phone1":"+48 777 888 999",
"phone1Name":null,
"phone2":"",
"phone2Name":null,
"phone3":"",
"phone3Name":null,
"email1":"jadwigatestowa@op.pl",
"email2":null,
"email3":null,
"email1Name":"Służbowy",
"email2Name":null,
"email3Name":null,
"idDocType":null,
"idDocTypeName":null,
"idDocNumber":null,
"idDocIssuer":null,
"address1":{
"uuid":"e49e3994-7aa4-40d4-9e36-02e955ee75ee",
"name":"Adres",
"street":"Katowicka",
"buildingNo":"12",
"localNo":"2",
"postcode":"44-199",
"city":"Jastrzębie-Zdrój",
"voivodeship":"śląskie",
"country":"Polska",
"district":"jastrzębski"
},
"address2":{
"uuid":"45ab0f18-755b-440f-8277-4513713262f0",
"name":"Adres",
"street":null,
"buildingNo":null,
"localNo":null,
"postcode":null,
"city":null,
"voivodeship":null,
"country":null,
"district":null
},
"address3":{
"uuid":"9a5c9a06-5e8a-4533-9ed3-be023e6f662d",
"name":"Adres",
"street":null,
"buildingNo":null,
"localNo":null,
"postcode":null,
"city":null,
"voivodeship":null,
"country":null,
"district":null
},
"organisations":[
{
"uuid":"74a39828-b179-4c9e-bcfe-884a4702ff80",
"name":"Firma XYZ",
"phone1":"+48 444 555 666",
"phone1Name":"Służbowy",
"phone2":"",
"phone2Name":null,
"phone3":"",
"phone3Name":null,
"email1":"test1@gmail.com",
"email1Name":null,
"email2":"test2@gmail.com",
"email2Name":null,
"email3":"test3@gmail.com",
"email3Name":null,
"role":null
}
],
"flags":[
{
"name":"Indywidualny",
"uuid":"787179de-895c-43f7-be17-0e3dac027041",
"color":"#a67341",
"reluuid":"9d6f429f-c1e8-4394-afd2-0b96d31d22ef"
},
],
"supervisors":[
{
"uuid":"ff6abb0b-e9d4-4fd2-98fa-b62a0c77535b",
"role":"manager",
"useruuid":"a06c5ace-5cc6-4583-a7f3-a942d72e1c0c",
"firstName":"Jan",
"lastName":"Kowalski",
"extension":888,
"workNumber":"+48 22 113 14 15",
"email":"jkowalski@firmaxyz.pl"
},
],
"customValue":[
{
"uuid":"81b120cf-8e98-480b-acb9-790c420029d1",
"type":"text",
"param":{
"type":"text",
"name":"Produkt",
"required":false,
"contactType":[
"person"
],
"isLink":false,
"isMultiline":false,
"minLength":0,
"maxLength":50,
"uuid":"81b120cf-8e98-480b-acb9-790c420029d1"
},
"value":"Produkt1"
},
]
},
],
"otherData":{
"totalCount":655330
},
"message":"OK"
}
```
#### 2. Dodanie nowego kontaktu- osoby
Metoda pozwala na dodanie osoby do bazy kontaktów w CRM.
Metoda: **POST** Adres URL: **{twoja\_nazwa}.ccrm.pl/publicApi/people**
**Struktura żądania**
**Właściwość**
| **Wartość**
| **Opis**
|
firstName
| required | max:100 | string
| Pierwsze imię.
|
middleName
| null | max:100 | string
| Drugie imię.
|
lastName
| required | max:100 | string
| Nazwisko.
|
pesel
| null | PESEL
| PESEL.
|
description
| null | max:65535 | string
| Opis.
|
phone1
| null | phone
| Numer telefonu.
|
phone1Name
| null | string | max:128
| Nazwa numeru telefonu.
|
phone2
| null | phone
| Numer telefonu.
|
phone2Name
| null | string | max:128
| Nazwa numeru telefonu.
|
phone3
| null | phone
| Numer telefonu.
|
phone3Name
| null | string | max:128
| Nazwa numeru telefonu.
|
email1
| null | max:128 | email
| Adres e-mail.
|
email1Name
| null | string | max:128
| Nazwa adresu e-mail.
|
email2
| null | max:128 | email
| Adres e-mail.
|
email2Name
| null | string | max:128
| Nazwa adresu e-mail.
|
email3
| null | max:128 | email
| Adres e-mail.
|
email3Name
| null | string | max:128
| Nazwa adresu e-mail.
|
idDocType
| null | string | in:"Dowód osobisty","Paszport","Karta pobytu","Prawo jazdy","Inny" | required\_with:idDocNumber
| Nazwa dokumentu.
|
idDocNumber
| null | string | required\_with:idDocType
| Numer dokumentu.
|
idDocIssuer
| null | string
| Organ wydający dokument.
|
addresses
| null | array
| Tabela pomocnicza: address - request data.
|
organisations
| null | array
| Tabela pomocnicza: organisation - request data.
|
supervisors
| null | array
| Tabela pomocnicza: supervisor - request data.
|
customFields
| null | array
| Tabela pomocnicza: customField - request data.
|
avatar
| null | string | uuid
| uuid avataru.
|
**Tabela pomocnicza: address - request data**
**Właściwość**
| **Wartość**
| **Opis**
|
name
| required | max:128 | string
| Nazwa adresu.
|
street
| null | max:128 | string
| Ulica.
|
city
| null | max:64 | string
| Miasto.
|
postcode
| null | max:16 | string
| Kod pocztowy.
|
building\_no
| null | max:16 | string
| Budynek.
|
local\_no
| null | max:16 | string
| Lokal.
|
voivodeship
| null| max:64 | string
| Województwo.
|
country
| null | max:64 | string
| Kraj.
|
name
| required | max:128 | string
| Nazwa adresu.
|
street
| null | max:128 | string
| Ulica.
|
district
| null | max:64 | string
| Powiat.
|
**Tabela pomocnicza: organisation - request data**
**Właściwość**
| **Wartość**
| **Opis**
|
.
| uuid
| Uuid organizacji.
|
**Tabela pomocnicza: supervisor - request data**
**Właściwość**
| **Wartość**
| **Opis**
|
user
| uuid
| Uuid użytkownika CRM.
|
role
| required | string | in: watcher, manager
| Rola przypisanego użytkownika.
|
**Tabela pomocnicza: customField - request data**
**Właściwość**
| **Wartość**
| **Opis**
|
uuid
| uuid
| Uuid własnego pola.
|
Przykład żądania
```JSON
{
"description":"Opis Bartosza",
"phone1":"48999666333",
"phone1Name":"Numer 1",
"email1":"bartosz@bartosz.pl",
"email1Name":"Email 1",
"firstName":"Bartosz",
"lastName":"Nowak",
"middleName":"Adam",
"customFields":[
{
"uuid":"81b120cf-8e98-480b-acb9-790c420029d1",
"value":"Produkt 1"
},
{
"uuid":"78488c2c-95e1-4c51-b3d2-2674b93a1372",
"value":"12"
},
{
"uuid":"183619e0-af10-4584-b260-bd81324a6ec2",
"value":[
"cd"
]
},
{
"uuid":"5e4d85b1-5e37-4cd9-8fd5-21e8e5ed4e0f",
"value":"12"
}
],
"organisations":[
"69861ece-9b84-4d6d-afc7-90f63317b5f4"
],
"addresses":[
{
"buildingNo":"15",
"city":"Gliwice",
"country":"Polska",
"localNo":"4",
"postcode":"44-100",
"street":"Makoszowska",
"voivodeship":"śląskie",
"district":"miasto Tychy",
"name":"Adres główny"
},
{
"buildingNo":"8",
"city":"Gliwice",
"country":"Polska",
"localNo":"2",
"postcode":"44-100",
"street":"Bydgoska",
"voivodeship":"śląskie",
"district":"miasto Tychy",
"name":"Adres korespondencyjny"
},
{
"buildingNo":"99",
"city":"Gliwice",
"country":"Polska",
"localNo":"1",
"postcode":"44-100",
"street":"Podkarpacka",
"voivodeship":"śląskie",
"district":"miasto Tychy",
"name":"Adres dodatkowy"
}
],
"supervisors":[
{
"role":"manager",
"user":"f6e4999b-6292-45ab-bb02-20b2e9284280"
},
{
"role":"watcher",
"user":"34b1f634-65e9-4b9a-bec8-b8de541a580a"
}
]
}
```
---
**Struktura odpowiedzi**
Jak w przypadku metody na pobranie pobranie listy kontaktów- osób zapisanych w CRM (pkt 1).
Przykład odpowiedzi
```JSON
{
"success":true,
"data":{
"uuid":"0330dbf9-a34a-4220-8be9-69551ef8c91a",
"firstName":"Bartosz",
"middleName":"Adam",
"lastName":"Nowak",
"pesel":null,
"avatar":null,
"description":"Opis Bartosza",
"phone1":"+48 999 666 333",
"phone1Name":"Numer 1",
"phone2":"",
"phone2Name":null,
"phone3":"",
"phone3Name":null,
"email1":"bartosz@bartosz.pl",
"email2":null,
"email3":null,
"email1Name":"Email 1",
"email2Name":null,
"email3Name":null,
"idDocType":"",
"idDocTypeName":null,
"idDocNumber":null,
"idDocIssuer":null,
"address1":{
"uuid":"651ce08f-2a36-4f07-bf47-8e516c0bc915",
"name":"Adres główny",
"street":"Makoszowska",
"buildingNo":15,
"localNo":4,
"postcode":"44-100",
"city":"Gliwice",
"voivodeship":"śląskie",
"country":"Polska",
"district":"miasto Tychy"
},
"address2":{
"uuid":"fed78150-9e4d-4997-8aca-33132aa9eb38",
"name":"Adres korespondencyjny",
"street":"Bydgoska",
"buildingNo":8,
"localNo":2,
"postcode":"44-100",
"city":"Gliwice",
"voivodeship":"śląskie",
"country":"Polska",
"district":"miasto Tychy"
},
"address3":{
"uuid":"3349bbb7-b714-40aa-973c-b4aa95a765bb",
"name":"Adres dodatkowy",
"street":"Podkarpacka",
"buildingNo":99,
"localNo":1,
"postcode":"44-100",
"city":"Gliwice",
"voivodeship":"śląskie",
"country":"Polska",
"district":"miasto Tychy"
},
"organisations":[
{
"uuid":"69861ece-9b84-4d6d-afc7-90f63317b5f4",
"name":"Firma XYZ",
"phone1":"+48 888 555 222",
"phone1Name":null,
"phone2":"",
"phone2Name":null,
"phone3":"",
"phone3Name":null,
"email1":"firmaxyz@firmaxyz.pl",
"email1Name":"Email firmowy",
"email2":null,
"email2Name":null,
"email3":null,
"email3Name":null,
"role":null
}
],
"supervisors":[
{
"uuid":"7c42b8a4-5184-4a6a-8c7b-c47eac063802",
"role":"manager",
"useruuid":"f6e4999b-6292-45ab-bb02-20b2e9284280",
"firstName":"Marian",
"lastName":"Nowak",
"extension":null,
"workNumber":"",
"email":"mnowak@firmatestowa.pl"
},
{
"uuid":"02b363d3-714b-49e3-91b4-91a7d8ca085c",
"role":"watcher",
"useruuid":"34b1f634-65e9-4b9a-bec8-b8de541a580a",
"firstName":"Adam",
"lastName":"Wasik",
"extension":101,
"workNumber":"+48 333 555 444",
"email":"awasik@firmatestowa.pl "
}
],
"customValue":[
{
"uuid":"81b120cf-8e98-480b-acb9-790c420029d1",
"type":"text",
"param":{
"type":"text",
"name":"Produkt",
"required":false,
"contactType":[
"person"
],
"isLink":false,
"isMultiline":false,
"minLength":0,
"maxLength":50,
"uuid":"81b120cf-8e98-480b-acb9-790c420029d1"
},
"value":"Produkt 1"
},
{
"uuid":"7b0abc08-afa4-4946-ad23-ad4646072853",
"type":"date",
"param":{
"type":"date",
"name":"Data zamówienia",
"required":true,
"contactType":[
"person",
"organisation"
]
},
"value":null
},
{
"uuid":"96d8ad7a-ffef-4b5f-a38f-f21e7c8bb97e",
"type":"number",
"param":{
"type":"number",
"name":"Ilość",
"required":false,
"contactType":[
"person",
"organisation"
],
"minValue":5,
"maxValue":20,
"uuid":"96d8ad7a-ffef-4b5f-a38f-f21e7c8bb97e"
},
"value":13
},
"otherData":{
"totalCount":1
},
"message":"OK"
}
```
#### 3. Edycja istniejącego kontaktu- osoby
Metoda pozwala na edytowanie istniejącej osoby w bazie kontaktów CRM.
Metoda: **PATCH** Adres URL: **{twoja\_nazwa}.ccrm.pl/publicApi/people/{uuid}**
**Struktura żądania**
Jak w przypadku metody na dodanie nowego kontaktu- osoby (pkt 2).
Przykład żądania
```JSON
{
"firstName":".Stanisława",
"middleName":"Janina",
"lastName":"Testowa",
"pesel":"",
"description":"",
"phone1":"48888555222",
"phone1Name":"Prywatny",
"phone2":"",
"phone2Name":"",
"phone3":"",
"phone3Name":"",
"email1":"",
"email1Name":"",
"email2":"",
"email2Name":"",
"email3":"",
"email3Name":"",
"idDocType":"",
"idDocNumber":"",
"idDocIssuer":""
}
```
---
**Struktura odpowiedzi**
Jak w przypadku metody na pobranie pobranie listy kontaktów- osób zapisanych w CRM (pkt 1).
Przykład odpowiedzi
```JSON
{
"success":true,
"data":{
"uuid":"4b1b1dc7-8875-4550-bd26-7526320f0df9",
"firstName":".Stanisława",
"middleName":"Janina",
"lastName":"Testowa",
"pesel":null,
"avatar":"",
"description":null,
"phone1":"+48 888 555 222",
"phone1Name":"Prywatny",
"phone2":"",
"phone2Name":null,
"phone3":"",
"phone3Name":null,
"email1":null,
"email2":null,
"email3":null,
"email1Name":null,
"email2Name":null,
"email3Name":null,
"idDocType":null,
"idDocTypeName":null,
"idDocNumber":null,
"idDocIssuer":null,
"address1":{
"uuid":"45a0a082-ff89-4d85-8975-402d3e8d5a6c",
"name":null,
"street":null,
"buildingNo":null,
"localNo":null,
"postcode":null,
"city":null,
"voivodeship":null,
"country":null,
"district":null
},
"address2":null,
"address3":null,
"organisations":{
},
"customValue":null
},
"otherData":{
"totalCount":1
},
"message":"OK"
}
```
#### 4. Usunięcie istniejącego kontaktu- osoby
Metoda pozwala na usunięcie istniejącej osoby w bazie kontaktów CRM.
Metoda: **DELETE** Adres URL: **{twoja\_nazwa}.ccrm.pl/publicApi/people/{uuid}**
**Struktura odpowiedzi**
**Właściwość**
| **Wartość**
| **Opis**
|
success
| bool
| |
data
| string
| |
otherData.totalCount
| int
| Ilość usuniętych rekordów.
|
message
| string
| |
Przykład odpowiedzi
```JSON
{
"success":true,
"data":"OK",
"otherData":{
"totalCount":1
},
"message":"OK"
}
```