Global Stocks โ JSON API Documentation
All endpoints except /api/docs require HTTP Basic Authentication against site_users.
Only active accounts with scope api-user can sign in. Admin and super-admin accounts are denied.
Example usage: curl -u "username:password" "https://api.globalstocks.eu/api/product-catalog"
Example JSON responses (auth required): https://api.globalstocks.eu/api/docs/examples
| Method | Path | Description | |
|---|---|---|---|
| GET | /api/docs | API documentation (this page). | Try it โ |
| GET | /api/pages-content | PagesContent โ site_pages_content (id, parent_id, lang, title, content). | Try it โ |
| GET | /api/category-list | CategoryList โ stock_category_list, active rows only (id, parent_id, title, route, language, level). | Try it โ |
| GET | /api/site-pages | SitePages โ site_pages (id, route, title, type, lang). | Try it โ |
| GET | /api/domain-configuration | DomainConfiguration โ site_configuration (languages, analytics, recaptchaPublic, recaptchaPrivate, adsenseClient, adsenseSlot). | Try it โ |
| GET | /api/product-catalog | Product list (default limit 30, totalCount in meta) or single item by id. Filters: region, category. | Try it โ |
| GET | /api/product-catalog-search | Search by query and/or dateCreated (on or after). Filters: region, category. All matches by default; optional pagination. | Try it โ |
| GET | /api/product-special-offer | Special offers only (is_special = 1). Same list pattern as product-catalog: limit, offset, region, category, or id. | Try it โ |
| GET | /api/product-daily-offer | Offers created on a given day (default today). If none, walks backward up to 30 days. Same row shape as product-catalog. | Try it โ |
| GET | /api/product-count | Total count. Optional by=category or by=region for grouped breakdown. | Try it โ |
| GET | /api/product-files | Documents and pictures for one product. Returns files[] and images[]. Query: id (required). | Try it โ |
| GET | /api/banner-config | BannerConfig โ bannerconfig (id, bannerPicture, bannerLink, position). Optional filter: position. | Try it โ |
| GET | /api/seasonal-offer | Seasonal offer from site_seasonal_offers. active matches the database flag (1 = true). | Try it โ |
| GET | /api/site-reviews | SiteReviews โ site_reviews (id, reviewerName, reviewerInitial, reviewerSubtitle, rating, reviewText). | Try it โ |
| POST | /api/subscribers | Create a newsletter subscriber (site_subscribers). JSON body; HTML in any field is rejected. | |
| POST | /api/messages | Submit a site contact message (site_messages). type must be mainContactForm or stockContactForm; HTML rejected. |
Page metadata lives in site_pages. Translation bodies live in site_pages_content and are returned as a flat list from /api/pages-content. Join them with parent_id = site_pages.id.
GET /api/pages-contentReturns all translation rows from site_pages_content. This is the previous flat payload (the items that were nested under content[]).
| Field | Description |
|---|---|
id | Translation row id. |
parent_id | Related site_pages.id. |
lang | Translation language. |
title | Translated title. |
content | Translated body HTML. |
Example: curl -u "username:password" "https://api.globalstocks.eu/api/pages-content"
GET /api/site-pagesReturns all site_pages rows (including homepage and catalog). No nested translations.
| Field | Description |
|---|---|
id | Site page id. |
route | Page route slug. |
title | Page title. |
type | Page type (page, pages, contacts, code, homepage, catalog). |
lang | Default page language. |
Per-domain portal settings from site_configuration, including public and secret reCAPTCHA keys.
GET /api/domain-configurationReturns all domain rows. No query parameters.
| Field | Description |
|---|---|
id | Configuration row id. |
domain | Hostname this row applies to. |
defaultUILang | Default UI language code. |
defaultCatalogLang | Default catalog language code. |
langList | Available languages for the domain. |
googleAnalytics | Google Analytics measurement / tracking id. |
recaptchaPublic | reCAPTCHA site key (public). |
recaptchaPrivate | reCAPTCHA secret key. |
adsenseClient | Google AdSense client id (for example ca-pub-โฆ). |
adsenseSlot | Google AdSense slot id. |
Example: curl -u "username:password" "https://api.globalstocks.eu/api/domain-configuration"
Site banners from bannerconfig. Each row has a picture, optional link, and a placement position. The old domainID column is not returned.
GET /api/banner-configReturns banner rows. Omit position for all banners; pass it to load one placement.
| Field | Description |
|---|---|
id | Banner row id. |
bannerPicture | Image path or filename for the banner. |
bannerLink | Click-through URL. May be empty. |
position | Placement: homepage, catalog-1, catalog-2, or partners-adv. |
| Parameter | Required | Description |
|---|---|---|
position | No | Filter by placement. Allowed: homepage, catalog-1, catalog-2, partners-adv. Invalid value returns 400. |
Example: curl -u "username:password" "https://api.globalstocks.eu/api/banner-config?position=homepage"
Catalog rows come from stock_catalog. Filter values region and category use route slugs (regionRoute, categoryRoute), not display titles. Paginated list/search responses put meta before data. price_full and price_short are served as stored in the database.
| Endpoint | Purpose |
|---|---|
/api/product-catalog | List or fetch one product (includes embedded files / images). |
/api/product-catalog-search | Text search with optional region, category, and dateCreated filters. |
/api/product-special-offer | Same as product-catalog, limited to is_special = 1. |
/api/product-daily-offer | Products created on one calendar day; walks backward up to 30 days if that day is empty. |
/api/product-count | Aggregate counts (total, by category, or by region). |
/api/product-files | Documents and pictures for one product id (files[] + images[]). |
Asset paths (config.ini [paths]): stockDataRoot = portal root containing public/data/โฆ; stockDataDirectRoot = flat layout with {id}/files and {id}/pictures. JSON paths always use public/data/{id}/โฆ. Reload PHP after config changes.
GET /api/product-catalogReturns products ordered by id DESC. Each row includes stored price display fields plus files and images path arrays. availability and viewCount are not returned.
| Field | Description |
|---|---|
id | Product id. |
region | Region display name (from regionName). |
regionRoute | Region slug used in filters. |
category | Category display name. |
categoryRoute | Category slug used in filters. |
title | Product title. |
description | Product description. |
price | Numeric price when the currency uses a number; empty when sold or price is not numeric. |
currency | Currency or price mode (EUR, GBP, USD, % from Retail, % from Wholesale, price in attachment, price upon request, bid price). |
price_full | Display price as stored in the database. |
price_short | Short display price as stored in the database. |
sold | 1 if sold, otherwise 0. |
dateCreated | Created timestamp. |
is_special | Special-offer flag. |
files | Document paths under public/data/{id}/files/. |
images | Picture paths, or stub images when the product has none. |
| Parameter | Required | Description |
|---|---|---|
id | No | Return a single product by id. When set, pagination, filters, and meta are omitted. |
limit | No | Page size. Default 30. |
offset | No | Pagination offset. Default 0. |
region | No | Filter by regionRoute (exact match). |
category | No | Filter by categoryRoute (exact match). |
List meta: limit, offset, region, category, count, totalCount. To load only asset paths without product fields, use /api/product-files?id=.
GET /api/product-special-offerSame response shape as /api/product-catalog (including files / images), but only products with is_special = 1. Ordered by id DESC.
| Parameter | Required | Description |
|---|---|---|
id | No | Return a single special offer by id. Empty list if the product is not special. When set, pagination, filters, and meta are omitted. |
limit | No | Page size. Default 30. |
offset | No | Pagination offset. Default 0. |
region | No | Filter by regionRoute (exact match). |
category | No | Filter by categoryRoute (exact match). |
Example: curl -u "username:password" "https://api.globalstocks.eu/api/product-special-offer"
GET /api/product-daily-offerReturns all catalog rows created on one calendar day, same fields as /api/product-catalog (including files / images), ordered by id DESC. Default date is today. If that day has no products, the API walks backward one day at a time for up to 30 days until a day with offers is found.
| Parameter | Required | Description |
|---|---|---|
date | No | Start date. Accepts YYYY-MM-DD or DD-MM-YYYY. Default: today. |
Meta: date (requested start day), offerDate (day that had offers, or null), title (for example STOCK OFFERS FOR 01-08-2026), daysChecked, count, totalCount.
Example: curl -u "username:password" "https://api.globalstocks.eu/api/product-daily-offer?date=2026-08-01"
GET /api/product-catalog-searchSubstring search in title and description (LIKE %query%), and/or filter by dateCreated. Provide at least query or dateCreated. By default returns all matching products. Pass limit and/or offset to paginate.
| Parameter | Required | Description |
|---|---|---|
query | No* | Search term matched against title and description. Required if dateCreated is omitted. |
region | No | Filter by regionRoute (exact match). |
category | No | Filter by categoryRoute (exact match). |
dateCreated | No* | Return items created on this date or later (YYYY-MM-DD). Required if query is omitted. |
limit | No | Page size. Only used when paginating; default is all matches. |
offset | No | Pagination offset. Only used when paginating. |
Meta fields: query, region, category, dateCreated, limit, offset, count (items in current response), totalCount (all matches for the current filters).
GET /api/product-countReturns aggregate product counts. Use the optional by parameter to choose grouping.
| Parameter | Required | Description |
|---|---|---|
by | No | category โ group by category with by_region nested in each category. region โ group by region with by_category nested in each region. Omit for total count only. |
Default response: data.count only (no category or region breakdown).
by=category: data.count, data.by_category[] with category, categoryRoute, count, by_region[].
by=region: data.count, data.by_region[] with region, regionRoute, count, by_category[].
GET /api/product-filesReturns documents and pictures for one product in a single response. This is the only dedicated assets endpoint (no separate pictures route).
| Parameter | Required | Description |
|---|---|---|
id | Yes | Product id. |
Response: data.id, data.files[] (documents from public/data/{id}/files/), data.images[] (pictures from public/data/{id}/pictures/, or stub images when empty).
Example: curl -u "username:password" "https://api.globalstocks.eu/api/product-files?id=12345"
Promotion content from site_seasonal_offers. active is the stored flag from the database. Use showFrom / showTo on the client if you also need the display window.
GET /api/seasonal-offerReturns the current seasonal offer. Prefers an enabled row whose date window includes today; otherwise the latest enabled row; otherwise the latest row. No query parameters.
| Field | Description |
|---|---|
data.seasonal_offer | null when the table has no rows. |
data.seasonal_offer.id | Offer row id. |
data.seasonal_offer.header | Modal title (plain text). |
data.seasonal_offer.content | Modal body as HTML. |
data.seasonal_offer.showFrom | First date the offer may be shown (YYYY-MM-DD). |
data.seasonal_offer.showTo | Last date the offer may be shown (YYYY-MM-DD). |
data.seasonal_offer.active | true when the database column active is 1. |
Display logic: active mirrors the database. Combine it with showFrom / showTo on the client if the modal should also respect the date window.
Example: curl -u "username:password" "https://api.globalstocks.eu/api/seasonal-offer"
Customer reviews from site_reviews. Rating is an integer from 1 to 5.
GET /api/site-reviewsReturns all review rows, newest first (id DESC). No query parameters.
| Field | Description |
|---|---|
id | Review row id. |
reviewerName | Display name of the reviewer. |
reviewerInitial | Optional short initial or avatar letters. null when empty. |
reviewerSubtitle | Optional subtitle (company, role, location). null when empty. |
rating | Star rating, integer 1โ5. |
reviewText | Review body (plain text). |
Example: curl -u "username:password" "https://api.globalstocks.eu/api/site-reviews"
POST endpoints for newsletter sign-ups and contact-form submissions. Send Content-Type: application/json. All string fields are checked for HTML โ if tags or encoded markup are detected, the API returns 400 with an error (nothing is stored).
POST /api/subscribersInserts a row into site_subscribers. dateCreated is set automatically.
| JSON field | Required | Description |
|---|---|---|
subscriberFormType | Yes | Form identifier (plain text, no HTML). |
subscribersEmail | Yes | Subscriber email address. |
subscribersDomain | Yes | Originating site domain (plain text, no HTML). |
Success (201): { "success": true, "data": { "subscriber": { "id": 123 } } }
Example: curl -u "username:password" -H "Content-Type: application/json" -d '{"subscriberFormType":"footer","subscribersEmail":"user@example.com","subscribersDomain":"globalstocks.eu"}' "https://api.globalstocks.eu/api/subscribers"
POST /api/messagesInserts a row into site_messages. created_at is set automatically.
| JSON field | Required | Description |
|---|---|---|
name | Yes | Sender name (plain text, no HTML). |
type | Yes | Contact form type. Must be exactly mainContactForm or stockContactForm โ use mainContactForm for the main site contact form and stockContactForm for the stock portal contact form. |
subject | Yes | Message subject (plain text, no HTML). |
email | Yes | Sender email address. |
comments | Yes | Message body (plain text, no HTML). |
type values: mainContactForm ยท stockContactForm โ any other value returns 400.
HTML rejected: { "success": false, "error": "HTML is not allowed in comments" }
Success (201): { "success": true, "data": { "message": { "id": 456 } } }
Example: curl -u "username:password" -H "Content-Type: application/json" -d '{"name":"Jane Doe","type":"mainContactForm","subject":"Inquiry","email":"jane@example.com","comments":"Hello"}' "https://api.globalstocks.eu/api/messages"