As-Mart Product API Documentation
Use the As-Mart Public API to display products, categories, collections, and latest blog content on external websites, affiliate blogs, partner platforms, and ASP.NET Core applications.
API
JSON Responses
All endpoints return clean JSON for websites and apps.
Rate Limited
Public endpoints are protected by rate limiting.
Affiliate Ready
Use buyUrl to keep tracking and redirects controlled.
Product API Endpoints
Use these endpoints to show As-Mart products on external websites.
| GET | /api/products/featured?count=12 | Products | Featured products selected by admin. |
| GET | /api/products/latest?count=12 | Products | Latest active products. |
| GET | /api/products/popular?count=12 | Products | Popular products based on clicks and ratings. |
| GET | /api/products/deals?count=12 | Deals | Products marked as Deal of the Day. |
| GET | /api/products/top-rated?count=12 | Rating | Highest-rated products. |
| GET | /api/products/random?count=6 | Widgets | Random active products for rotating widgets and ads. |
| GET | /api/products/search?q=watch&count=12 | Search | Search by title, brand, or short description. |
| GET | /api/products/category/{categorySlug}?count=12 | Category | Products from a specific category slug. |
| GET | /api/products/brand/{brand}?count=12 | Brand | Products from a specific brand. |
| GET | /api/products/price-range?min=10&max=100&count=12 | Filter | Products within a price range. |
| GET | /api/products/related/{slug}?count=12 | Related | Related products using product categories. |
| GET | /api/products/collection/{collectionSlug}?count=12 | Collection | Products from a public collection. |
| GET | /api/products/home-widget?count=8 | Widget | Returns featured, deals, popular, and latest products in one response. |
| GET | /api/products/promote/{slug} | Ad | Single product for advertising/promotion. |
| GET | /api/products/{slug} | Single | Single active product by SEO slug. |
The count parameter defaults to 12 and maximum allowed value is 50.
Category API
| GET | /api/categories | Returns all public categories with product counts. |
| GET | /api/products/category/{categorySlug}?count=12 | Returns products for a specific category. |
Collection API
| GET | /api/collections | Returns all public collections with product counts. |
| GET | /api/products/collection/{collectionSlug}?count=12 | Returns products from a selected collection. |
Blog API
| GET | /api/blogs/latest?count=6 | Returns latest As-Mart blog posts for external websites. |
Response Models
Product Response
| Field | Type | Description |
|---|---|---|
| id | int | Product ID. |
| title | string | Product title. |
| slug | string | SEO slug. |
| shortDescription | string | Short product summary. |
| brand | string | Brand name. |
| price | decimal | Sale price. |
| listPrice | decimal | Original/list price. |
| currency | string | Currency code. |
| Field | Type | Description |
|---|---|---|
| rating | decimal | Product rating. |
| ratingCount | int | Total ratings. |
| mainImageUrl | string | Main image URL. |
| productUrl | string | As-Mart product page. |
| buyUrl | string | Tracked buy redirect. |
| isFeatured | bool | Featured flag. |
| isDealOfTheDay | bool | Deal flag. |
| categories | array | Category names. |
Product JSON Response
[
{
"id": 101,
"title": "Example Product Title",
"slug": "example-product-title",
"shortDescription": "Short product description here.",
"brand": "Example Brand",
"price": 49.99,
"listPrice": 69.99,
"currency": "USD",
"rating": 4.6,
"ratingCount": 1240,
"mainImageUrl": "https://example.com/product.jpg",
"productUrl": "https://as-mart.com/product/example-product-title",
"buyUrl": "https://as-mart.com/product/go/101",
"isFeatured": true,
"isDealOfTheDay": false,
"clickCount": 250,
"categories": ["Electronics", "Smart Devices"]
}
]
Home Widget Response
{
"featured": [],
"deals": [],
"popular": [],
"latest": []
}
JavaScript Fetch Example
fetch("https://as-mart.com/api/products/home-widget?count=6")
.then(response => response.json())
.then(data => {
console.log(data.featured);
console.log(data.deals);
console.log(data.popular);
console.log(data.latest);
})
.catch(error => {
console.error("API Error:", error);
});
ASP.NET Core HttpClient Example
public class AsMartApiService
{
private readonly HttpClient _httpClient;
public AsMartApiService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<ProductHomeWidgetApiDto> GetHomeWidgetAsync()
{
var result = await _httpClient.GetFromJsonAsync<ProductHomeWidgetApiDto>(
"https://as-mart.com/api/products/home-widget?count=8");
return result ?? new ProductHomeWidgetApiDto();
}
}