Skip to main content

Banners API

The Banners API provides endpoints for managing banners and banner clients in Joomla.

Base URL

/api/index.php/v1/banners

Endpoints Overview

Banners

MethodEndpointDescription
GET/bannersRetrieve all banners
GET/banners/{id}Retrieve specific banner
POST/bannersCreate new banner
PATCH/banners/{id}Update banner
DELETE/banners/{id}Delete banner
MethodEndpointDescription
GET/banners/clientsRetrieve all clients
GET/banners/clients/{id}Retrieve specific client
POST/banners/clientsCreate new client
PATCH/banners/clients/{id}Update client
DELETE/banners/clients/{id}Delete client
MethodEndpointDescription
GET/banners/categoriesRetrieve all categories
POST/banners/categoriesCreate new category
PATCH/banners/categories/{id}Update category
DELETE/banners/categories/{id}Delete category

Banners

Retrieve all banners

GET /api/index.php/v1/banners

Response

{
"data": [
{
"type": "banners",
"id": "1",
"attributes": {
"name": "Advertisement Banner",
"alias": "advertisement-banner",
"catid": 3,
"cid": 1,
"type": 1,
"state": 1,
"clickurl": "https://example.com",
"custombannercode": "<img src=\"banner.jpg\">",
"impressions_left": 0,
"clicks": 25,
"impmade": 1500
}
}
]
}

Create banner

POST /api/index.php/v1/banners

Request Body

{
"name": "New Banner",
"alias": "new-banner",
"catid": 3,
"cid": 1,
"type": 1,
"state": 1,
"clickurl": "https://example.com",
"custombannercode": "<a href=\"#\"><img src=\"images/banners/banner.jpg\" alt=\"Banner\"></a>",
"description": "Banner description"
}

Required fields

FieldTypeDescription
namestringBanner name
catidintCategory ID

Optional fields

FieldTypeDefaultDescription
aliasstringautoURL-friendly name
cidint0Client ID
typeint0Banner type (0=image, 1=custom)
stateint1Publication status
clickurlstring""Click-through URL
custombannercodestring""Custom HTML code
descriptionstring""Description
imptotalint0Total impressions (0=unlimited)

Example

curl -X POST "https://yoursite.com/api/index.php/v1/banners" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Header Banner",
"catid": 3,
"clickurl": "https://example.com",
"custombannercode": "<img src=\"banner.jpg\" alt=\"Banner\">"
}'

Update banner

PATCH /api/index.php/v1/banners/{id}

Example

curl -X PATCH "https://yoursite.com/api/index.php/v1/banners/1" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"clickurl": "https://new-url.com",
"state": 0
}'

Delete banner

DELETE /api/index.php/v1/banners/{id}

Banner clients are advertisers who can have multiple banners.

Create client

POST /api/index.php/v1/banners/clients

Request Body

{
"name": "Advertiser Inc",
"contact": "John Smith",
"email": "john@advertiser.com",
"extrainfo": "Premium advertiser",
"state": 1
}

Required fields

FieldTypeDescription
namestringClient name
contactstringContact person
emailstringEmail address

Example

curl -X POST "https://yoursite.com/api/index.php/v1/banners/clients" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Advertiser Inc",
"contact": "John Smith",
"email": "john@advertiser.com"
}'

Create category

POST /api/index.php/v1/banners/categories

Request Body

{
"title": "Header Banners",
"alias": "header-banners",
"description": "Banners for the header section"
}
TypeDescription
0Image
1Custom HTML code
ValueStatus
-2Trash
0Unpublished
1Published
2Archived

Filtering

By category

GET /api/index.php/v1/banners?filter[catid]=3

By client

GET /api/index.php/v1/banners?filter[cid]=1

By status

GET /api/index.php/v1/banners?filter[state]=1

Banners automatically track statistics:

FieldDescription
impmadeNumber of impressions
clicksNumber of clicks
impressions_leftRemaining impressions
info

Resetting statistics must be done through the Joomla administrator interface.