# Create view

`POST /api/task-views`

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  }
]
```

- bearer: http (bearer), header JWT. Enter JWT token

Request body: application/json (required)

Type: object

Schema: [CreateViewDTO](https://sourcey-gauzy.pages.dev/api-reference/models/createviewdto/index.md)

- `tenant` (optional)
  Type: object

- `tenantId` (optional)
  Type: string

- `organization` (optional)
  Type: object

- `organizationId` (optional)
  Type: string

- `sentTo` (optional)
  Type: string

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `name` (required)
  Type: string

- `description` (optional)
  Type: string

- `visibilityLevel` (optional)
  Type: string
  
  enum: [0,1,2,3]

- `queryParams` (optional)
  Type: object

- `filterOptions` (optional)
  Type: object

- `displayOptions` (optional)
  Type: object

- `properties` (optional)
  Type: object

- `isLocked` (optional)
  Type: boolean
  
  default: false

- `projectId` (optional)
  Type: string

- `organizationTeamId` (optional)
  Type: string

- `projectModuleId` (optional)
  Type: string

- `organizationSprintId` (optional)
  Type: string

Responses:

- 201: The record has been successfully created.

- 400: Invalid input, The response body may contain clues as to what went wrong

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/task-views' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "name": "string",
  "description": "string",
  "visibilityLevel": 0,
  "queryParams": {},
  "filterOptions": {},
  "displayOptions": {},
  "properties": {},
  "isLocked": false,
  "projectId": "string",
  "organizationTeamId": "string",
  "projectModuleId": "string",
  "organizationSprintId": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "name": "string",
  "description": "string",
  "visibilityLevel": 0,
  "queryParams": {},
  "filterOptions": {},
  "displayOptions": {},
  "properties": {},
  "isLocked": false,
  "projectId": "string",
  "organizationTeamId": "string",
  "projectModuleId": "string",
  "organizationSprintId": "string"
}`;

const response = await fetch('http://localhost:3000/api/task-views', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "name": "string",
  "description": "string",
  "visibilityLevel": 0,
  "queryParams": {},
  "filterOptions": {},
  "displayOptions": {},
  "properties": {},
  "isLocked": false,
  "projectId": "string",
  "organizationTeamId": "string",
  "projectModuleId": "string",
  "organizationSprintId": "string"
}'''

response = requests.post(
    'http://localhost:3000/api/task-views',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
