# Create camshot

`POST /api/plugins/camshots`

This API Endpoint allows uploading the camshot file along with related metadata.

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

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

- `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"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `storageProvider` (required)
  Type: string
  
  enum: ["LOCAL","S3","WASABI","CLOUDINARY","DIGITALOCEAN"]

- `recordedAt` (optional)
  Type: timestamptz
  
  Date when the camshot was recorded

- `fullUrl` (optional)
  Type: string
  
  Full URL to access the camshot

- `thumbUrl` (optional)
  Type: string
  
  Thumb URL to access the camshot

- `size` (optional)
  Type: number
  
  Size of the camshot file in bytes

- `timeSlotId` (optional)
  Type: string
  
  The UUID of the associated TimeSlot

- `uploadedById` (optional)
  Type: string
  
  The UUID of the associated Employee

- `userId` (optional)
  Type: string
  
  The UUID of the associated User

Responses:

- 201: Camshot created successfully.

Content type: application/json

Type: object

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

- `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"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `title` (required)
  Type: string
  
  Title of the camshot

- `fileKey` (optional)
  Type: string
  
  Camshot file path or identifier

- `thumbKey` (optional)
  Type: string
  
  Camshot thumb file path or identifier

- `storageProvider` (required)
  Type: string
  
  enum: ["LOCAL","S3","WASABI","CLOUDINARY","DIGITALOCEAN"]

- `recordedAt` (optional)
  Type: timestamptz
  
  Date when the camshot was recorded

- `fullUrl` (optional)
  Type: string
  
  Full URL to access the camshot

- `thumbUrl` (optional)
  Type: string
  
  Thumb URL to access the camshot

- `size` (optional)
  Type: number
  
  Size of the camshot file in bytes

- `timeSlotId` (optional)
  Type: string
  
  The UUID of the associated TimeSlot

- `uploadedById` (optional)
  Type: string
  
  The UUID of the associated Employee

- `userId` (optional)
  Type: string
  
  The UUID of the associated User

- 400: Invalid input provided. Check the response body for error details.

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugins/camshots' \
  --form-string 'isActive=true' \
  --form-string 'isArchived=false' \
  --form-string 'archivedAt=2018-11-21T06:20:32.232Z' \
  --form-string 'tenantId=string' \
  --form-string 'organizationId=string' \
  --form-string 'storageProvider=LOCAL' \
  --form-string 'fullUrl=string' \
  --form-string 'thumbUrl=string' \
  --form-string 'size=0' \
  --form-string 'timeSlotId=string' \
  --form-string 'uploadedById=string' \
  --form-string 'userId=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('isActive', 'true');
form.append('isArchived', 'false');
form.append('archivedAt', '2018-11-21T06:20:32.232Z');
form.append('tenantId', 'string');
form.append('organizationId', 'string');
form.append('storageProvider', 'LOCAL');
form.append('fullUrl', 'string');
form.append('thumbUrl', 'string');
form.append('size', '0');
form.append('timeSlotId', 'string');
form.append('uploadedById', 'string');
form.append('userId', 'string');
const response = await fetch('http://localhost:3000/api/plugins/camshots', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('isActive', (None, 'true')),
        ('isArchived', (None, 'false')),
        ('archivedAt', (None, '2018-11-21T06:20:32.232Z')),
        ('tenantId', (None, 'string')),
        ('organizationId', (None, 'string')),
        ('storageProvider', (None, 'LOCAL')),
        ('fullUrl', (None, 'string')),
        ('thumbUrl', (None, 'string')),
        ('size', (None, '0')),
        ('timeSlotId', (None, 'string')),
        ('uploadedById', (None, 'string')),
        ('userId', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:3000/api/plugins/camshots', headers={}, files=files)
    print(response.text)
```
