CMS
The AppAmbit CMS feature allows you to securely retrieve dynamic content directly from the AppAmbit platform to power your applications. The SDK includes filtering, sorting, pagination, and a robust caching mechanism out-of-the-box to ensure optimal network performance and a seamless user experience.
Prerequisites
If you haven't initialized the AppAmbit SDK in your app yet, please complete the setup first before using the CMS module. See the Getting Started guide.
Creating your Model
Before fetching the content, you need to create a dedicated model class that will be used to deserialize the data retrieved from the CMS collection. Use these examples as a reference to structure your own representations based on your actual data schema.
using Newtonsoft.Json;
using System.Collections.Generic;
public class CmsExampleModel
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("product_name")]
public string ProductName { get; set; }
[JsonProperty("price")]
public decimal Price { get; set; }
[JsonProperty("category")]
public List<string>? Category { get; set; }
[JsonProperty("in_stock")]
public bool InStock { get; set; }
[JsonProperty("item_sku")]
public string ItemSku { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("product_image_url")]
public string? ProductImageUrl { get; set; }
}
import Foundation
import AppAmbit
struct CmsExampleModel: Decodable, Identifiable {
let id: String?
let productName: String?
let price: Double?
let category: [String]?
let inStock: Bool?
let itemSku: String?
let description: String?
let productImageUrl: String?
enum CodingKeys: String, CodingKey {
case id, price, category, description
case productName = "product_name"
case inStock = "in_stock"
case itemSku = "item_sku"
case productImageUrl = "product_image_url"
}
}
// CmsExampleModel.h
#import <Foundation/Foundation.h>
@interface CmsExampleModel : NSObject
@property (nonatomic, copy, nullable) NSString *id;
@property (nonatomic, copy, nullable) NSString *productName;
@property (nonatomic, strong, nullable) NSNumber *price;
@property (nonatomic, copy, nullable) NSArray<NSString *> *category;
@property (nonatomic, assign) BOOL inStock;
@property (nonatomic, copy, nullable) NSString *itemSku;
@property (nonatomic, copy, nullable) NSString *description;
@property (nonatomic, copy, nullable) NSString *productImageUrl;
- (instancetype _Nullable)initWithDictionary:(NSDictionary * _Nullable)dict;
@end
import com.appambit.sdk.utils.JsonKey;
import java.util.List;
public class CmsExampleModel {
public String id;
@JsonKey("product_name")
public String productName;
public double price;
public List<String> category;
@JsonKey("in_stock")
public boolean inStock;
@JsonKey("item_sku")
public String itemSku;
public String description;
@JsonKey("product_image_url")
public String productImageUrl;
}
import com.appambit.sdk.utils.JsonKey
data class CmsExampleModel(
val id: String?,
@JsonKey("product_name")
val productName: String?,
val price: Double = 0.0,
val category: List<String>?,
@JsonKey("in_stock")
val inStock: Boolean = false,
@JsonKey("item_sku")
val itemSku: String?,
val description: String?,
@JsonKey("product_image_url")
val productImageUrl: String?
)
class CmsExampleModel {
final String? id;
final String? title;
final String? body;
final String? category;
final String? author;
final String? featuredImage;
final int likes;
final double rating;
final int readingTime;
final String? publishedAt;
CmsExampleModel({
this.id,
this.title,
this.body,
this.category,
this.author,
this.featuredImage,
this.likes = 0,
this.rating = 0.0,
this.readingTime = 0,
this.publishedAt,
});
factory CmsExampleModel.fromJson(Map<String, dynamic> json) {
return CmsExampleModel(
id: json['id'] as String?,
title: json['title'] as String?,
body: json['body'] as String?,
category: json['category'] as String?,
author: json['author'] as String?,
featuredImage: json['featured_image'] as String?,
likes: json['likes'] as int? ?? 0,
rating: (json['rating'] as num?)?.toDouble() ?? 0.0,
readingTime: json['reading_time'] as int? ?? 0,
publishedAt: json['published_at'] as String?,
);
}
}
export interface CmsExampleModel {
id: string;
title: string;
body: string;
category?: string;
author_email?: string | null;
is_published?: boolean;
featured_image?: string | null;
views_count?: number | string;
}
using Newtonsoft.Json;
using System.Collections.Generic;
public class CmsExampleModel
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("product_name")]
public string ProductName { get; set; }
[JsonProperty("price")]
public decimal Price { get; set; }
[JsonProperty("category")]
public List<string>? Category { get; set; }
[JsonProperty("in_stock")]
public bool InStock { get; set; }
[JsonProperty("item_sku")]
public string ItemSku { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("product_image_url")]
public string? ProductImageUrl { get; set; }
}
using Newtonsoft.Json;
using System.Collections.Generic;
public class CmsExampleModel
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("product_name")]
public string ProductName { get; set; }
[JsonProperty("price")]
public decimal Price { get; set; }
[JsonProperty("category")]
public List<string>? Category { get; set; }
[JsonProperty("in_stock")]
public bool InStock { get; set; }
[JsonProperty("item_sku")]
public string ItemSku { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("product_image_url")]
public string? ProductImageUrl { get; set; }
}
Fetching Content
Fetch all content from a collection. The SDK deserializes the results directly into your typed model.
var items = await Cms.Content<CmsExampleModel>("tech_inventory").GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.getList { results in
self.items = results
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query getListWithCompletion:^(NSArray *items) {
self->_items = items;
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
).getList();
const raw = await AppAmbitCms.content("tech_inventory").getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory").GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory").GetListAsync();
Filtering Data
The CMS SDK provides powerful filtering mechanisms to narrow down your queries. Chain your filter before calling .getList() / getListWithCompletion: / GetListAsync() to retrieve the filtered results.
Search
Searches the query term across all fields of the object.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Search("Pro")
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.search("Pro")
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query search:@"Pro"];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.search("Pro")
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.search("Pro")
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.search("Pro")
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.search("Pro")
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Search("Pro")
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Search("Pro")
.GetListAsync();
Equals
Filters results where the field matches exactly the value provided.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Equals("category", "Electronics")
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.equals("category", "Electronics")
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query equals:@"category" value:@"Electronics"];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.equals("category", "Electronics")
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.equals("category", "Electronics")
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.equals("category", "Electronics")
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.equals("category", "Electronics")
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Equals("category", "Electronics")
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Equals("category", "Electronics")
.GetListAsync();
Not Equals
Filters results where the field is different from the value provided.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.NotEquals("item_sku", "TEC-02")
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.notEquals("item_sku", "TEC-02")
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query notEquals:@"item_sku" value:@"TEC-02"];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.notEquals("item_sku", "TEC-02")
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.notEquals("item_sku", "TEC-02")
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.notEquals("item_sku", "TEC-02")
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.notEquals("item_sku", "TEC-02")
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.NotEquals("item_sku", "TEC-02")
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.NotEquals("item_sku", "TEC-02")
.GetListAsync();
Contains
Filters results where the field string contains the provided substring.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Contains("product_name", "Pro")
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.contains("product_name", "Pro")
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query contains:@"product_name" value:@"Pro"];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.contains("product_name", "Pro")
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.contains("product_name", "Pro")
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.contains("product_name", "Pro")
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.contains("product_name", "Pro")
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Contains("product_name", "Pro")
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.Contains("product_name", "Pro")
.GetListAsync();
Starts With
Filters results where the field string starts with the provided value.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.StartsWith("item_sku", "TEC")
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.startsWith("item_sku", "TEC")
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query startsWith:@"item_sku" value:@"TEC"];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.startsWith("item_sku", "TEC")
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.startsWith("item_sku", "TEC")
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.startsWith("item_sku", "TEC")
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.startsWith("item_sku", "TEC")
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.StartsWith("item_sku", "TEC")
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.StartsWith("item_sku", "TEC")
.GetListAsync();
In List
Filters results where the field matches any value from the provided list.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.InList("item_sku", new[] { "TEC-01", "TEC-02" })
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.inList("item_sku", ["TEC-01", "TEC-02"])
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query inList:@"item_sku" values:@[@"TEC-01", @"TEC-02"]];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.inList("item_sku", List.of("TEC-01", "TEC-02"))
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.inList("item_sku", listOf("TEC-01", "TEC-02"))
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.inList("item_sku", ["TEC-01", "TEC-02"])
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.inList("item_sku", ["TEC-01", "TEC-02"])
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.InList("item_sku", new[] { "TEC-01", "TEC-02" })
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.InList("item_sku", new[] { "TEC-01", "TEC-02" })
.GetListAsync();
Not In List
Filters results where the field does not match any value in the provided list.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.NotInList("item_sku", new[] { "TEC-01", "TEC-02" })
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.notInList("item_sku", ["TEC-01", "TEC-02"])
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query notInList:@"item_sku" values:@[@"TEC-01", @"TEC-02"]];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.notInList("item_sku", List.of("TEC-01", "TEC-02"))
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.notInList("item_sku", listOf("TEC-01", "TEC-02"))
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.notInList("item_sku", ["TEC-01", "TEC-02"])
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.notInList("item_sku", ["TEC-01", "TEC-02"])
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.NotInList("item_sku", new[] { "TEC-01", "TEC-02" })
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.NotInList("item_sku", new[] { "TEC-01", "TEC-02" })
.GetListAsync();
Greater Than
Filters results where the field is strictly greater than the numeric value provided.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GreaterThan("price", 500)
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.greaterThan("price", 500)
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query greaterThan:@"price" value:@500];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.greaterThan("price", 500)
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.greaterThan("price", 500)
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.greaterThan("price", 500)
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.greaterThan("price", 500)
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GreaterThan("price", 500)
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GreaterThan("price", 500)
.GetListAsync();
Greater Than Or Equal
Filters results where the field is greater than or equal to the numeric value.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GreaterThanOrEqual("price", 500)
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.greaterThanOrEqual("price", 500)
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query greaterThanOrEqual:@"price" value:@500];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.greaterThanOrEqual("price", 500)
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.greaterThanOrEqual("price", 500)
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.greaterThanOrEqual("price", 500)
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.greaterThanOrEqual("price", 500)
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GreaterThanOrEqual("price", 500)
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GreaterThanOrEqual("price", 500)
.GetListAsync();
Less Than
Filters results where the field is strictly less than the numeric value provided.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.LessThan("price", 500)
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.lessThan("price", 500)
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query lessThan:@"price" value:@500];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.lessThan("price", 500)
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.lessThan("price", 500)
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.lessThan("price", 500)
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.lessThan("price", 500)
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.LessThan("price", 500)
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.LessThan("price", 500)
.GetListAsync();
Less Than Or Equal
Filters results where the field is less than or equal to the numeric value provided.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.LessThanOrEqual("price", 500)
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.lessThanOrEqual("price", 500)
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query lessThanOrEqual:@"price" value:@500];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.lessThanOrEqual("price", 500)
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.lessThanOrEqual("price", 500)
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.lessThanOrEqual("price", 500)
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.lessThanOrEqual("price", 500)
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.LessThanOrEqual("price", 500)
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.LessThanOrEqual("price", 500)
.GetListAsync();
Sorting and Pagination
You can easily order the results and paginate them to lazy load content or limit the number of objects retrieved at once.
Order By Ascending
Orders results by the specified field in ascending order.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.OrderByAscending("price")
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.orderByAscending("product_name")
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query orderByAscending:@"product_name"];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.orderByAscending("product_name")
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.orderByAscending("product_name")
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.orderByAscending("price")
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.orderByAscending("price")
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.OrderByAscending("price")
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.OrderByAscending("price")
.GetListAsync();
Order By Descending
Orders results by the specified field in descending order.
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.OrderByDescending("price")
.GetListAsync();
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.orderByDescending("price")
.getList { results in
DispatchQueue.main.async { self.items = results }
}
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query orderByDescending:@"price"];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
Cms.content("tech_inventory", CmsExampleModel.class)
.orderByDescending("price")
.getList()
.then(items -> adapter.updateInventory(items));
Cms.content("tech_inventory", CmsExampleModel::class.java)
.orderByDescending("price")
.getList()
.then { result -> if (result != null) items = result }
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.orderByDescending("price")
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.orderByDescending("price")
.getList();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.OrderByDescending("price")
.GetListAsync();
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.OrderByDescending("price")
.GetListAsync();
Pagination (Limit & Offset)
Retrieves a specific page of results with a defined number of items per page. The first page is 1.
// Page 1 — 20 items per page
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GetPage(1)
.GetPerPage(20)
.GetListAsync();
// Page 1 — 20 items per page
Cms.content("tech_inventory", modelType: CmsExampleModel.self)
.getPage(1)
.getPerPage(20)
.getList { results in
DispatchQueue.main.async { self.items = results }
}
// Page 1 — 20 items per page
CmsQueryObjC *query = [Cms contentWithType:@"tech_inventory"];
[query getPage:1];
[query getPerPage:20];
[query getListWithCompletion:^(NSArray *items) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_items = items;
[self->_tableView reloadData];
});
}];
// Page 1 — 20 items per page
Cms.content("tech_inventory", CmsExampleModel.class)
.getPage(1)
.getPerPage(20)
.getList()
.then(items -> adapter.updateInventory(items));
// Page 1 — 20 items per page
Cms.content("tech_inventory", CmsExampleModel::class.java)
.getPage(1)
.getPerPage(20)
.getList()
.then { result -> if (result != null) items = result }
// Page 1 — 20 items per page
final items = await AppAmbitCms.content<CmsExampleModel>(
"tech_inventory",
fromJson: CmsExampleModel.fromJson,
)
.getPage(1)
.getPerPage(20)
.getList();
const items = await AppAmbitCms.content("tech_inventory")
.GetPage(1)
.getList();
// Page 1 — 20 items per page
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GetPage(1)
.GetPerPage(20)
.GetListAsync();
// Page 1 — 20 items per page
var items = await Cms.Content<CmsExampleModel>("tech_inventory")
.GetPage(1)
.GetPerPage(20)
.GetListAsync();
Cache Management
The SDK automatically caches previously fetched CMS data to optimize performance. A background task attempts to update the cache ensuring data relies on locally available files safely while it synchronizes. If you want to force clear the cache and require fresh remote data to be acquired on the next request, you can perform cache cleanups.
Tip
If you want to stop displaying a content type in your app, call clearCache for that specific collection and remove any calls to content() for it in your code. This ensures that previously cached data is wiped and the content won't appear again once users update to the new version of your app.
Clears the cache only for the specified content type:
Cms.ClearCache("tech_inventory");
Clears the cache for all content types at once:
Cms.ClearAllCache();
Clears the cache only for the specified content type:
Cms.clearCache("tech_inventory")
Clears the cache for all content types at once:
Cms.clearAllCache()
Clears the cache only for the specified content type:
[Cms clearCache:@"tech_inventory"];
Clears the cache for all content types at once:
[Cms clearAllCache];
Clears the cache only for the specified content type:
Cms.clearCache("tech_inventory");
Clears the cache for all content types at once:
Cms.clearAllCache();
Clears the cache only for the specified content type:
Cms.clearCache("tech_inventory")
Clears the cache for all content types at once:
Cms.clearAllCache()
Clears the cache only for the specified content type:
await AppAmbitCms.clearCache("tech_inventory");
Clears the cache for all content types at once:
await AppAmbitCms.clearAllCache();
Clears the cache only for the specified content type:
AppAmbitCms.clearCache("tech_inventory");
Clears the cache for all content types at once:
AppAmbitCms.clearAllCache();
Clears the cache only for the specified content type:
Cms.ClearCache("tech_inventory");
Clears the cache for all content types at once:
Cms.ClearAllCache();
Clears the cache only for the specified content type:
Cms.ClearCache("tech_inventory");
Clears the cache for all content types at once:
Cms.ClearAllCache();
Sample Applications
Explore fully functional reference apps for each platform to see the CMS SDK integrated end-to-end.
Troubleshooting
No content is returned
- Verify that the collection name passed to
Cms.content()/Cms.Content<T>()matches exactly the one defined in your AppAmbit dashboard (case-sensitive). - Ensure your AppAmbit project key is correctly set during SDK initialization. See the Getting Started guide.
- Check that there is at least one published entry in the content type on the dashboard.
Stale or outdated data is displayed
The SDK serves data from the local cache by default while refreshing in the background. If you need to force a fresh fetch, clear the cache before your next query:
Cms.ClearCache("your_collection") // .NET / Avalonia
Cms.clearCache("your_collection") // iOS / Android
Model fields are null after deserialization
- Double-check that the
@JsonProperty/CodingKeys/@JsonKeyannotations on your model match the exact field names returned by the API. - Use your AppAmbit dashboard's Preview panel to inspect the raw JSON structure of your collection documents.
Filters return unexpected results
- Remember that string filters (e.g.,
Equals,Contains) are case-sensitive by default. - Numeric filters (
GreaterThan,LessThan, etc.) only work on fields stored as numbers in the collection — string-encoded numbers are not compared numerically.
Pagination returns duplicate or missing items
- Ensure you are not changing the sort order between page requests.
- Page numbers start at
1, not0. UsinggetPage(0)may produce unexpected behavior.
Build error: Cms symbol not found
- Make sure you have imported / referenced the AppAmbit SDK package in your project.
- Clean and rebuild the project after adding the dependency.
- For iOS, run
pod install(CocoaPods) or resolve the Swift Package if using SPM.