๐Ÿš€ GS API

Global Stocks โ€“ JSON API Documentation

๐Ÿ” Authentication Required

All endpoints except /api/docs require HTTP Basic Authentication.

Two login pairs are supported: primary (username/password) and optional second (username2/password2 in config).

Example usage: curl -u "username:password" "https://api.globalstocks.eu/api/product-catalog"

Example JSON responses (auth required): https://www.api.globalstocks.eu/api/docs/examples

MethodPathDescription
GET/api/docsAPI documentation (this page).Try it โ†’
GET/api/pages-contentPagesContent โ€“ pagestranslation (id, parent_id, lang, title, content).Try it โ†’
GET/api/category-listCategoryList โ€“ stockcategorylist (id, parent_id, title, route, language, level).Try it โ†’
GET/api/site-pagesSitePages โ€“ sitepagesconfig (id, route, title, type, lang).Try it โ†’
GET/api/domain-configurationDomainConfiguration โ€“ domainconfiguration.Try it โ†’
GET/api/product-catalogProduct list (default limit 30, totalCount in meta) or single item by id. Filters: region, category.Try it โ†’
GET/api/product-catalog-searchSearch title/description. Filters: region, category. All matches by default; optional pagination.Try it โ†’
GET/api/product-countTotal count. Optional by=category or by=region for grouped breakdown.Try it โ†’
GET/api/product-filesDocuments and pictures for one product. Returns files[] and images[]. Query: id (required).Try it โ†’
GET/api/banner-configBannerConfig โ€“ bannerconfig.Try it โ†’
GET/api/seasonal-offerStatic franchise seasonal offer (HTML header + content). Visible 2026-06-01 to 2026-06-30 (active flag).Try it โ†’
POST/api/subscribersCreate a newsletter subscriber (subscribers_new). JSON body; HTML in any field is rejected.
POST/api/messagesSubmit a site contact message (messages_new). type must be mainContactForm or stockContactForm; HTML rejected.

Product endpoints

Filter values region and category use route slugs from product data (regionRoute, categoryRoute), not display titles. Paginated list/search responses put meta before data.

EndpointPurpose
/api/product-catalogList or fetch one product (includes embedded files / images).
/api/product-catalog-searchText search with optional region/category filters.
/api/product-countAggregate counts (total, by category, or by region).
/api/product-filesDocuments 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-catalog

Returns products ordered by id DESC. Each list row includes files and images path arrays.

ParameterRequiredDescription
idNoReturn a single product by id. When set, pagination, filters, and meta are omitted.
limitNoPage size. Default 30.
offsetNoPagination offset. Default 0.
regionNoFilter by regionRoute (exact match).
categoryNoFilter 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-catalog-search

Substring search in title and description (LIKE %query%). By default returns all matching products. Pass limit and/or offset to paginate.

ParameterRequiredDescription
queryYesSearch term matched against title and description.
regionNoFilter by regionRoute (exact match).
categoryNoFilter by categoryRoute (exact match).
limitNoPage size. Only used when paginating; default is all matches.
offsetNoPagination offset. Only used when paginating.

Meta fields: query, region, category, limit, offset, count (items in current response), totalCount (all matches for the current filters).

GET /api/product-count

Returns aggregate product counts. Use the optional by parameter to choose grouping.

ParameterRequiredDescription
byNocategory โ€“ 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-files

Returns documents and pictures for one product in a single response. This is the only dedicated assets endpoint (no separate pictures route).

ParameterRequiredDescription
idYesProduct 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"

Seasonal offer

Static franchise promotion content (no database). Use the active flag together with showFrom / showTo to decide whether to display the modal on the portal.

GET /api/seasonal-offer

Returns the current seasonal franchise offer. No query parameters.

FieldDescription
data.seasonal_offer.headerModal title (plain text).
data.seasonal_offer.contentModal body as HTML (<p>, links, <br/>).
data.seasonal_offer.showFromFirst date the offer may be shown (YYYY-MM-DD). Currently 2026-06-01.
data.seasonal_offer.showToLast date the offer may be shown (YYYY-MM-DD). Currently 2026-06-30.
data.seasonal_offer.activetrue when today's date is between showFrom and showTo (inclusive); otherwise false.

Display logic: show the modal when active is true. Content is always returned; clients may ignore it when active is false.

Example: curl -u "username:password" "https://api.globalstocks.eu/api/seasonal-offer"

Subscribers & messages

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/subscribers

Inserts a row into subscribers_new. dateCreated is set automatically.

JSON fieldRequiredDescription
subscriberFormTypeYesForm identifier (plain text, no HTML).
subscribersEmailYesSubscriber email address.
subscribersDomainYesOriginating 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/messages

Inserts a row into messages_new. created_at is set automatically.

JSON fieldRequiredDescription
nameYesSender name (plain text, no HTML).
typeYesContact form type. Must be exactly mainContactForm or stockContactForm โ€” use mainContactForm for the main site contact form and stockContactForm for the stock portal contact form.
subjectYesMessage subject (plain text, no HTML).
emailYesSender email address.
commentsYesMessage 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"