POST

Documents.Products

Return product line items sold/ordered for one customer, matching the dashboard customer Product tab (product_invoice_html). Rows are expanded from document items on purchase_orders, order_proposals, gi_ir, organization_receipt, and selected invoices. Pagination is by documents (default 10, max 25), then each document items[] becomes one or more product rows.

Required Choice

Send at least one complete option from the list below.

OptionAccepted FieldsExplanation
1customer_id or cust_id or client_idOne of these values is required to create the record.

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

  • Runs the Documents.Products function and returns JSON.

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

  • This route matches the dashboard customer Product tab loader (product_invoice_html), but returns JSON rows instead of HTML.
  • It is different from Products.List, which returns the account product catalog (ec_product).
  • Document set: purchase_orders, order_proposals, gi_ir, organization_receipt, plus invoices that pass the same related-purchase-order rules as the dashboard.
  • Pagination counts documents, not product rows. One document with 3 items can return 3 rows.
  • Send filter fields flat or nested under filter / filter[key] for dashboard-compatible clients.

Required Parameters

NameTypeSampleExplanation
customer_id
post
int108545Customer id. Aliases: cust_id, client_id.

Optional Parameters

NameTypeSampleWhat it gives
page_id
post
int11-based document page, same idea as dashboard Product tab. Alias: page.
start
post
int0Document offset alternative to page_id. Alias: offset.
limit
post
int10Documents per page. Default 10 (dashboard). Values above 25 are capped. Aliases: length, per_page.
prev_record_count
post
int11Optional next row_number start for page continuity (dashboard prev_record).
last_documents_id
post
string1234Filter by document number. Also accepted as filter[last_documents_id].
final_amount
post
string100,500Exact amount, or from,to range. Alias: price. Also filter[final_amount].
coin
post
stringCurrency/coin filter. Alias: currency.
order_type
post
stringgi_irDocument type filter such as purchase_orders, order_proposals, gi_ir, organization_receipt, invoice. Aliases: type, document_type.
product_name
post
stringtestingSearch product name inside documents.items JSON. Alias: search.
start_qty
post
number1Minimum item qty. Alias: qty_from. Use with end_qty.
end_qty
post
number10Maximum item qty. Alias: qty_to. Use with start_qty.
from_date
post
date2022-01-01Filter documents.date_created from this date. Alias: created_from. Send date filters and date values as UTC Y-m-d H:i:s when the route accepts date/time; date-only table columns store the Y-m-d date part.
to_date
post
date2026-12-31Filter documents.date_created until this date. Alias: created_to. Send date filters and date values as UTC Y-m-d H:i:s when the route accepts date/time; date-only table columns store the Y-m-d date part.
order_by
post
stringdate_createdSort column: date_created, last_documents_id, final_amount, type, coin, id. Alias: data_name.
order_dir
post
stringdescasc or desc. Alias: data_val.
filter
post
json|array{"product_name":"testing"}Optional dashboard-style filter object. Keys: last_documents_id, final_amount, coin, order_type, product_name, start_qty, end_qty, data_name, data_val, between_condition.

Authentication

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

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Documents.Products",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "customer_id": "108545",
        "page_id": "1",
        "limit": "10"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Documents.Products",
    "url_domain": "https:\/\/{domain}\/app\/Documents.Products"
}

Endpoint

POST /app/Documents.Products
POST https://{user}.bull36.com/app/Documents.Products
POST https://{domain}/app/Documents.Products

Sample Output

{
    "success": 1,
    "count": 2,
    "document_count": 15,
    "recordsTotal": 15,
    "page_id": 1,
    "start": 0,
    "limit": 10,
    "prev_record_count": 3,
    "customer_id": 108545,
    "data": [
        {
            "row_number": 1,
            "product_id": "77",
            "iteeeem_id": "77",
            "document_id": "9001",
            "last_documents_id": "1234",
            "date_created": "2022-01-29 10:00:00",
            "date_display": "29\/01\/22",
            "coin": "₪",
            "item_total": "100",
            "price": "₪100",
            "item_qty": "1",
            "document_type": "gi_ir",
            "document_type_label": "gi_ir",
            "product_name": "testing1",
            "item_name": "testing1",
            "item_notes": "",
            "document_note": "",
            "item_price": "100",
            "item_sku": "",
            "item_type": "product"
        }
    ]
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams({
  customer_id: '108545',
  page_id: '1',
  limit: '10'
});
const res = await fetch('/app/Documents.Products', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + token },
  body
});
const data = await res.json();
console.log(data.data);

Error Example

{
    "success": 0,
    "message": "Missing required parameter: customer_id"
}