# Application Categories REST API

The Application Categories API manages application categories or tags assigned to applications in an organization. An application category or tag consists of a name, a description and a color.

Possible values for the field color are:

```
light-red, light-green, light-blue, light-purple, dark-red, dark-green, dark-blue, dark-purple, orange, yellow
```

## Creating Application Categories

An application category or tag for an organization can be created by sending a POST request

```
POST /api/v2/applicationCategories/organization/{organizationId}
```

with a body specifying the application category's details.

As an example, in order to create an application category using the cURL tool for the organization with id `3c1f21228ec243d5abdff55e913c7ab8` the command would be as follows:

```
curl -u admin:admin123 -X POST -H 'Content-Type: application/json' 'http://localhost:8070/api/v2/applicationCategories/organization/3c1f21228ec243d5abdff55e913c7ab8' -d '{"name": "Internal Application","color": "dark-blue","description": "Applications internal to company."}'
```

The server responds with a `200 OK` upon successful creation echoing the created application category with its details including the assigned `id`:

```
{
  "id": "72ad13b69f1141bdba66ff396a905b68",
  "name": "Internal Application",
  "description": "Applications internal to company",
  "organizationId": "3c1f21228ec243d5abdff55e913c7ab8",
  "color": "dark-blue"
}
```

## Retrieving Application Categories

Application categories or tags owned by an organization can be retrieved by sending a `GET` request

```
GET /api/v2/applicationCategories/organization/{organizationId}
```

As an example, in order to list owned application categories using the cURL tool for the organization with id `3c1f21228ec243d5abdff55e913c7ab8` the command would be as follows:

```
curl -u admin:admin123 'http://localhost:8070/api/v2/applicationCategories/organization/3c1f21228ec243d5abdff55e913c7ab8'
```

The server responds with a `200 OK` upon successful query and returns application categories available to an organization:

```
[  
  {  
    "id": "72ad13b69f1141bdba66ff396a905b68",
    "name": "Internal Application",
    "description": "Applications internal to company",
    "organizationId": "3c1f21228ec243d5abdff55e913c7ab8",
    "color": "dark-blue"
  },  
  {  
    "id": "93e7890eebbf45a990927c1ac9a547e1",
    "name": "Test",
    "description": "Test",
    "organizationId": "3c1f21228ec243d5abdff55e913c7ab8",
    "color": "orange"
  }  
]
```

## Updating Application Categories

An application category or tag owned by an organization can be updated by sending a `PUT` request to

```
PUT /api/v2/applicationCategories/organization/{organizationId}
```

with a body specifying the application category's details including the `id` of the application category to be updated.

As an example, in order to update an application category using the cURL tool for the organization with id `3c1f21228ec243d5abdff55e913c7ab8` the command would be as follows:

```
curl -u admin:admin123 -X PUT -H 'Content-Type: application/json' 'http://localhost:8070/api/v2/applicationCategories/organization/3c1f21228ec243d5abdff55e913c7ab8' -d '{"id": "72ad13b69f1141bdba66ff396a905b68", "name": "Internal Application - Updated","color": "light-red","description": "Description updated."}'
```

The server responds with a `200 OK` upon successful update echoing the updated application category with its details:

```
{
  "id": "72ad13b69f1141bdba66ff396a905b68",
  "name": "Internal Application - Updated",
  "description": "Description updated.",
  "organizationId": "3c1f21228ec243d5abdff55e913c7ab8",
  "color": "light-red"
}
```

## Deleting Application Categories

An application category or tag can be deleted sending a `DELETE` request to

```
DELETE /api/v2/applicationCategories/organization/{organizationId}/{applicationCategoryId}
```

The server responds with a `204 No Content` upon successful deletion.
