Documentacion API - Publicidad

Esta documentación cubre los puntos finales para administrar la publicidad dentro de smart lockers.

1. Cargar publicidad

Endpoint: POST /advertising/upload/{lockerId}

Descripción: Sube un archivo publicitario para un casillero específico.

Request Headers:

  • Authorization: Bearer token

Request Parameters:

  • lockerId: The ID of the locker where the file is uploaded.

Request Body: Multipart form-data containing the file with the key arc.

Response:

                    
                        {
                            "message": "Advertising file uploaded successfully",
                            "file": "uploaded-file-name.jpg",
                            "url": "http://uploads.example.com/uploaded-file-name.jpg",
                            "userId": "123"
                        }
                    
                

1. Listar publicidad

Endpoint: GET /advertising

Descripción: Obtiene una lista de archivos publicitarios para un casillero específico.

Request Headers:

  • Authorization: Bearer token

Response:

                    
[
    {
        "_id": "68815af220a75e8c1a3c980c",
        "filename": "1753307890219-369341656.jpg",
        "originalName": "filename.jpg",
        "fileUrl": "https://api-lockers.unitsmartlabs.com/uploads/files/567-369341656.jpg",
        "lockerId": "671fgh2c8c835cbd742",
        "userId": "67gfhfgh0d4e8245657",
        "apiUserId": "669e934beefa9f7429037dac",
        "mimeType": "image/jpeg",
        "size": 247471,
        "createdAt": "2025-07-23T21:58:10.228Z",
        "updatedAt": "2025-07-23T21:58:10.228Z"
    },
    {
        "_id": "68815bff20a75e8c1a3c982a",
        "filename": "1753308159009-404960536.jpg",
        "originalName": "filename.jpg",
        "fileUrl": "https://api-lockers.unitsmartlabs.com/uploads/files/56756756-404960536.jpg",
        "lockerId": "67192c546dfgh2c8c2",
        "userId": "67474536j70d4e8245657",
        "apiUserId": "669e934beefa9f7429037dac",
        "mimeType": "image/jpeg",
        "size": 316552,
        "createdAt": "2025-07-23T22:02:39.016Z",
        "updatedAt": "2025-07-23T22:02:39.016Z"
    }
]
                    
                

3. Eliminar publicidad.

Endpoint: DELETE /advertising/{lockerId}/delete/{filename}

Description: Elimina un archivo de publicidad específico por nombre de archivo.

Request Headers:

  • Authorization: Bearer token

Request Parameters:

  • lockerId: The ID of the locker where the file is stored.
  • filename: The name of the file to delete.

Response:

                    
                        {
                            "message": "File deleted successfully"
                        }