---
url: https://next.zammad.org/cs/reference/rest-api/organization.md
---

# Organizace

## Výpis

Požadované oprávnění: `ticket.agent` **nebo** `admin.organization`

::: info
Zákazníci technicky vidí jen svou vlastní organizaci, pokud nějakou mají.
:::

Odeslaný požadavek `GET`: `/api/v1/organizations`

::: details

```json
// HTTP-Code 200 OK

[
  {
    "id": 1,
    "name": "Zammad Foundation",
    "shared": true,
    "domain": "",
    "domain_assignment": false,
    "active": true,
    "note": "",
    "updated_by_id": 1,
    "created_by_id": 1,
    "created_at": "2023-07-26T08:44:39.608Z",
    "updated_at": "2023-08-04T12:02:00.018Z",
    "vip": false,
    "member_ids": [
      2
    ],
    "secondary_member_ids": []
  },
  {
    "name": "Fast Lane Hardware Inc.",
    "shared": true,
    "domain": "",
    "domain_assignment": false,
    "active": true,
    "note": "IT hardware and custom PC builds",
    "vip": false,
    "updated_by_id": 3,
    "id": 2,
    "created_by_id": 1,
    "created_at": "2023-07-26T08:44:48.617Z",
    "updated_at": "2023-08-04T12:01:44.370Z",
    "member_ids": [
      3,
      5,
      4
    ],
    "secondary_member_ids": []
  },
  {
    "name": "Joe's car parts",
    "shared": true,
    "domain": "",
    "domain_assignment": false,
    "active": true,
    "note": "Their shipping department often needs computer spare parts as well as printers!",
    "vip": true,
    "updated_by_id": 3,
    "id": 3,
    "created_by_id": 1,
    "created_at": "2023-07-26T08:44:48.632Z",
    "updated_at": "2023-08-04T12:54:30.974Z",
    "member_ids": [
      8,
      7,
      6
    ],
    "secondary_member_ids": []
  },
  {
    "id": 4,
    "name": "Good Customer Inc.",
    "shared": true,
    "domain": "",
    "domain_assignment": false,
    "active": true,
    "note": "Search the world's information, including webpages, images, videos and more. Good Customer has many special features to help you find exactly what you're looking for.",
    "updated_by_id": 1,
    "created_by_id": 1,
    "created_at": "2023-07-26T08:44:48.645Z",
    "updated_at": "2023-07-26T08:44:48.645Z",
    "member_ids": [
      9
    ],
    "secondary_member_ids": []
  }
]

```

:::

## Zobrazení

Požadované oprávnění: `ticket.agent` **nebo** `admin.organization`

Odeslaný požadavek `GET`: `/api/v1/organizations/{id}`

::: info
Všichni dotčení uživatelé technicky vidí jen svou vlastní organizaci.
:::

::: details

```json
// HTTP-Code 200 OK

{
  "id": 2,
  "name": "Fast Lane Hardware Inc.",
  "shared": true,
  "domain": "",
  "domain_assignment": false,
  "active": true,
  "note": "IT hardware and custom PC builds",
  "vip": false,
  "updated_by_id": 3,
  "created_by_id": 1,
  "created_at": "2023-07-26T08:44:48.617Z",
  "updated_at": "2023-08-04T12:01:44.370Z",
  "member_ids": [
    3,
    5,
    4
  ],
  "secondary_member_ids": []
}

```

:::

## Vytvoření

Požadované oprávnění: `admin.organization`

Odeslaný požadavek `POST`: `/api/v1/organizations`

:::: details

::: tabs key:reqres

\=== Požadavek

```json
{
  "name": "Sample Corp.",
  "shared": false,
  "domain": "example.com",
  "domain_assignment": true,
  "active": true,
  "vip": true,
  "note": "Just a sample, aint that nice?",
  "members": [
    "olivia@example.com",
    "david@example.com"
  ]
}

```

\=== Odpověď

```json
// HTTP-Code 201 Created

{
  "id": 5,
  "name": "Sample Corp.",
  "shared": false,
  "domain": "example.com",
  "domain_assignment": true,
  "active": true,
  "note": "Just a sample, aint that nice?",
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2023-08-08T09:12:42.023Z",
  "updated_at": "2023-08-08T09:12:42.602Z",
  "vip": true,
  "member_ids": [
    10,
    11
  ],
  "secondary_member_ids": []
}

```

:::
::::

## Aktualizace

Požadované oprávnění: `admin.organization`

Odeslaný požadavek `PUT`: `/api/v1/organizations/{id}`

:::: details

::: tabs key:reqres

\=== Požadavek

```json
{
  "name": "Sample Corp.",
  "shared": false,
  "domain": "",
  "domain_assignment": false,
  "active": true,
  "note": "This was a triumph - I'm making a note here - H-U-G-E success!",
  "members": [
    "olivia@example.com",
    "david@example.com"
  ]
}

```

\=== Odpověď

```json
// HTTP-Code 200 OK

{
  "id": 5,
  "name": "Sample Corp.",
  "shared": false,
  "domain": "",
  "domain_assignment": false,
  "active": true,
  "note": "This was a triumph - I'm making a note here - H-U-G-E success!",
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2023-08-08T09:12:42.023Z",
  "updated_at": "2023-08-08T09:16:58.922Z",
  "vip": true,
  "member_ids": [
    10,
    11
  ],
  "secondary_member_ids": []
}

```

:::
::::

## Smazání

Požadované oprávnění: `admin.organization`

Odeslaný požadavek `DELETE`: `/api/v1/organizations/{id}`

::: danger
**Jde o trvalé odstranění**

Odstranění organizací nelze vrátit zpět.

Organizace s odkazy např. v toku aktivit nebo na uživatele
nelze přes API odstranit – signalizuje to
`"error": "Can't delete, object has references."`. *Nejde* o chybu.

Pro větší kontrolu zvažte místo toho funkci Ochrana osobních údajů
v uživatelském rozhraní Zammadu.
:::

::: details

Odpověď:

```json
// HTTP-Code 200 OK

{}

```

:::
