API: Физические лица - MCODEDOTSU/panorama.back GitHub Wiki

API: Физические лица

Для всех запросов, не отмеченных как NOAUTH, необходимо добавить в заголовок Authorization:

"Bearer {TOKEN}"

TOKEN получается на этапе аутентификации в системе

Получить список физических лиц

METHOD: GET

NAME: api/person

RESPONSES:

[
    {
        id: integer,
        firstname: string,
        lastname: string,
        middlename: string | null,
        date_of_birth: datetime | null,
        address_id: integer | null,
        phones: text| null,
        note: text | null,
        created_at: datetime | null,
        updated_at: datetime | null,
        users: [
            {
                id: integer,
                name: string,
                email: string,
                email_verified_at: datetime | null,
                contractor_id: integer,
                created_at: datetime | null,
                updated_at: datetime | null,
                role: string,
                post: string | null,
                photo: string | null,
                person_id: integer | null,
            }
        ],
        address: {
            id: integer,
            index: integer,
            region: string,
            city: string,
            street: string,
            build: string,
            created_at: datetime,
            updated_at: datetime
        } | null,
    }
]

Получить физическое лицо по ID

METHOD: GET

NAME: api/person/ID

RESPONSES:

{
    id: integer,
    firstname: string,
    lastname: string,
    middlename: string | null,
    date_of_birth: datetime | null,
    address_id: integer | null,
    phones: text| null,
    note: text | null,
    created_at: datetime | null,
    updated_at: datetime | null,
    users: [
        {
            id: integer,
            name: string,
            email: string,
            email_verified_at: datetime | null,
            contractor_id: integer,
            created_at: datetime | null,
            updated_at: datetime | null,
            role: string,
            post: string | null,
            photo: string | null,
            person_id: integer | null,
        }
    ],
    address: {
        id: integer,
        index: integer,
        region: string,
        city: string,
        street: string,
        build: string,
        created_at: datetime,
        updated_at: datetime
    } | null,
}

Создать физическое лицо

METHOD: POST

NAME: api/person

QUERY PARAMETERS:

firstname*: string // Имя
lastname*: string // Фамилия
middlename: string // Отчество
date_of_birth: date // Дата рождения
address: {
    city: string // Город
    street: string // Улица
    build: string // Дом
}
phones: text // Список телефонов
note: text // Заметка

RESPONSES:

{
    id: integer,
    firstname: string,
    lastname: string,
    middlename: string | null,
    date_of_birth: datetime | null,
    address_id: integer | null,
    phones: text| null,
    note: text | null,
    created_at: datetime | null,
    updated_at: datetime | null,
    users: [
        {
            id: integer,
            name: string,
            email: string,
            email_verified_at: datetime | null,
            contractor_id: integer,
            created_at: datetime | null,
            updated_at: datetime | null,
            role: string,
            post: string | null,
            photo: string | null,
            person_id: integer | null,
        }
    ],
    address: {
        id: integer,
        index: integer,
        region: string,
        city: string,
        street: string,
        build: string,
        created_at: datetime,
        updated_at: datetime
    } | null,
}

Изменить физическое лицо

METHOD: PUT

NAME: api/person/ID

QUERY PARAMETERS:

firstname*: string // Имя
lastname*: string // Фамилия
middlename: string // Отчество
date_of_birth: date // Дата рождения
address: {
    city: string // Город
    street: string // Улица
    build: string // Дом
}
phones: text // Список телефонов
note: text // Заметка

RESPONSES:

{
    id: integer,
    firstname: string,
    lastname: string,
    middlename: string | null,
    date_of_birth: datetime | null,
    address_id: integer | null,
    phones: text| null,
    note: text | null,
    created_at: datetime | null,
    updated_at: datetime | null,
    users: [
        {
            id: integer,
            name: string,
            email: string,
            email_verified_at: datetime | null,
            contractor_id: integer,
            created_at: datetime | null,
            updated_at: datetime | null,
            role: string,
            post: string | null,
            photo: string | null,
            person_id: integer | null,
        }
    ],
    address: {
        id: integer,
        index: integer,
        region: string,
        city: string,
        street: string,
        build: string,
        created_at: datetime,
        updated_at: datetime
    } | null,
}

Удалить физическое лицо

METHOD: DELETE

NAME: api/person/ID

RESPONSES:

{
    id: integer
}