# Get departments

## getDepartments()

Should return all available support departments from the ticket software. Gets used for the mapping dropdown in the administration (see testing)

### Parameters

None

### Response

Collection of TicketDepartmentResponse()

<table><thead><tr><th width="142">Type</th><th width="166">Name</th><th>Description</th></tr></thead><tbody><tr><td>string</td><td>$id</td><td>The technical ID of the department.</td></tr><tr><td>string</td><td>$name</td><td>The display name of the department</td></tr></tbody></table>

### Example Code

```php
public function getDepartments(): Collection {
	$response = $this->makeRequest("mailboxes");
	$result = collect();

	foreach ($response->_embedded->mailboxes as $mailbox) {
		$result->add(new TicketDepartmentResponse($mailbox->id, $mailbox->name));
	}

	return $result;
}
```

### Testing

Visit *Settings -> Support settings -> Provider Settings* in the administration. When entering your api key, a dropdown of all departments will be fetched using the above method.
