Overview
The Publicidades (Advertisements) endpoint allows you to upload and manage advertisement media files associated with specific cities and countries. This endpoint handles file uploads for advertising materials that will be displayed as part of campaigns.Base URL
Endpoints
List All Advertisements
Retrieve a list of all advertisement media files. ResponseUnique identifier for the advertisement (auto-generated)
Date when the advertisement was created (format: YYYY-MM-DD)
Advertisement status (0: inactive, 1: active)
The advertisement media file (image, video, or other supported format). Uploaded files are stored in the
ads/ directory.Foreign key to the city where this advertisement is targeted
Foreign key to the country where this advertisement is targeted
Date when the advertisement was last modified (format: YYYY-MM-DD)
Create an Advertisement
Upload a new advertisement media file. Request Body This endpoint requiresmultipart/form-data encoding for file uploads.
Creation date (YYYY-MM-DD)
Advertisement status (0: inactive, 1: active)
The advertisement media file to upload. Supported formats depend on server configuration. Files are uploaded to the
ads/ directory.ID of the target city
ID of the target country
Modification date (YYYY-MM-DD)
Retrieve an Advertisement
Retrieve details of a specific advertisement by ID, including the file URL.Update an Advertisement
Update all fields of a specific advertisement, including replacing the media file. Request Body Usemultipart/form-data encoding when updating the file.
Partially update specific fields of an advertisement. You can update metadata without replacing the file.
Delete an Advertisement
Delete a specific advertisement by ID. This also removes the associated media file from storage.File Upload
When uploading advertisement files:- Use
multipart/form-dataencoding - Include the file in the
imagen_publicitariafield - Files are automatically stored in the
ads/directory - The response includes the file URL path
Example Usage
Creating an Advertisement (JSON representation)
Using cURL to Upload a File
Using JavaScript with FormData
Notes
- The
imagen_publicitariafield accepts file uploads using Django’sFileField - Files are stored in the
ads/directory relative to the media root - When retrieving advertisements, the file URL will be provided in the response
- File type validation depends on server configuration
- Consider implementing file size limits for production use
- The endpoint returns the file path relative to the media URL