POST

Ticket.ProductsByCustomer

Return products for a customer from their invoice and purchase_orders document line items (same source as dashboard tickets/product_choose_by_customer). App value rule: when document line iteeeem_id is 0 (free-text), value/product_id is the item_name; when iteeeem_id is not 0, value/product_id is that catalog id. Use returned value with Ticket.Add / Ticket.Edit product_id[]. Optional product_id marks selected rows.

Permissions

  • User must be logged in with a valid bearer token.
  • The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Runs the Ticket.ProductsByCustomer 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

  • On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
  • This is App-only JSON. Dashboard still returns HTML options and is unchanged.
  • If iteeeem_id = 0 → return / store the product name.
  • If iteeeem_id != 0 → return / store the product id.
  • Send the value field (or product_id) on Ticket.Add / Ticket.Edit as product_id[].

Required Parameters

NameTypeSampleExplanation
cust_id
post
int123Customer id. Aliases: customer_id, id (dashboard posts id).

Optional Parameters

NameTypeSampleWhat it gives
product_id
post
array|string12,Custom itemOptional selected values to mark selected=true. Mix of catalog ids and free-text names. Alias: product_id[].

Authentication

Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Ticket.ProductsByCustomer",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "cust_id": "123",
        "product_id": "12"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Ticket.ProductsByCustomer",
    "url_domain": "https:\/\/{domain}\/app\/Ticket.ProductsByCustomer"
}

Endpoint

POST /app/Ticket.ProductsByCustomer
POST https://{user}.bull36.com/app/Ticket.ProductsByCustomer
POST https://{domain}/app/Ticket.ProductsByCustomer

Sample Output

{
    "success": 1,
    "cust_id": 123,
    "count": 2,
    "data": [
        {
            "id": 12,
            "name": "Widget",
            "value": "12",
            "product_id": "12",
            "selected": true
        },
        {
            "id": 0,
            "name": "Custom service",
            "value": "Custom service",
            "product_id": "Custom service",
            "selected": false
        }
    ],
    "product_id": [
        "12"
    ]
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams({ cust_id: '123', product_id: '12' });
const res = await fetch('/app/Ticket.ProductsByCustomer', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + token },
  body
});
const data = await res.json();
// Use data.data[i].value on Ticket.Add product_id[]
console.log(data.data);

Error Example

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