POST

ExpensesCategories.Count

Return only the number of expense categories matching the same filters as ExpensesCategories.List (parent_id, search, include_other, all).

Permissions

  • User must be logged in with a valid bearer token.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Returns only the count for ExpensesCategories using the same filters as the list function.

Push Service

No push is sent because this function only reads data or returns helper information.

Automation

No automation is run for this function.

Special Instructions

  • SELECT CATEGORY: POST /app/ExpensesCategories.List (default parent_id=0). Use data[].id as Expenses.Add category_id.
  • SELECT SUB CATEGORY: send parent_id with the selected category id from the first call.
  • Other (id=0) is a synthetic dashboard option. Prefer a real category id for Expenses.Add.
  • Aliases: Expenses.CategoriesList. Not the same as Categories.List (ec_categories / products).

Required Parameters

No body parameters are required for this function.

Optional Parameters

NameTypeSampleWhat it gives
parent_id
post
int0Filter by parent. Default 0 = top-level categories (SELECT CATEGORY). Send a category id to list its sub-categories (SELECT SUB CATEGORY). Aliases: parent, parent_category_id.
parents_only
post
int1When 1, forces parent_id=0. Alias: top_level.
all
post
int0When 1, returns every category (parents and sub-categories) without parent filter.
include_other
post
int1When listing top-level categories, default 1 prepends Other (id=0) like the dashboard. Send 0 to skip. Alias: include_others.
search
post
stringrootSearch name_en / name_he. Aliases: name, name_en, name_he, category_name, filter_data, search[value].
start
post
int0First row offset for paging. Alias: offset.
limit
post
int25Maximum rows to return. Values above 25 are capped. Aliases: length, per_page.
order_by
post
stringidOrder column: id, name_en, name_he, parent_id. Default id.
order_dir
post
stringascOrder direction: asc or desc. Default asc.

Authentication

Send the bearer token returned by Login in the request header.

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/ExpensesCategories.Count",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "parent_id": "0"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/ExpensesCategories.Count",
    "url_domain": "https:\/\/{domain}\/app\/ExpensesCategories.Count"
}

Endpoint

POST /app/ExpensesCategories.Count
POST https://{user}.bull36.com/app/ExpensesCategories.Count
POST https://{domain}/app/ExpensesCategories.Count

Sample Output

{
    "success": 1,
    "count": 3,
    "total_record": 3,
    "include_other": 1,
    "parent_id": 0
}

Count Only

Use the matching count route with the same filters when the UI only needs total rows for paging.

{
    "url": "\/app\/ExpensesCategories.Count",
    "url_user": "https:\/\/{user}.bull36.com\/app\/ExpensesCategories.Count",
    "url_domain": "https:\/\/{domain}\/app\/ExpensesCategories.Count",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "parent_id": "0"
    },
    "sample_output": {
        "success": 1,
        "count": 123
    },
    "notes": {
        "count": "Total expense categories matching the sent filters.",
        "total_record": "Same total for clients that read total_record."
    }
}

Count JavaScript

const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('parent_id', '0');

const res = await fetch('https://{domain}/app/ExpensesCategories.Count', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
  body
});
const data = await res.json();
console.log(data.count);

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams({ parent_id: '0' });
const res = await fetch('/app/ExpensesCategories.Count', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + token },
  body
});
const data = await res.json();
console.log(data.count);

Error Example

{
    "success": "0",
    "error": "bearer_token_required",
    "message": "Authorization bearer token is required. Send header: Authorization: Bearer YOUR TOKEN"
}