### Get Stock of Product by Code Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves the real and reserved stock for a product using its unique key. ```APIDOC ## POST /graphql ### Description Retrieves the real and reserved stock for a product using its unique key. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **key** (Object) - Required - The key to identify the product branch. - **company_id** (Int) - Required - The company ID. - **branch_id** (Int) - Required - The branch ID. - **product_ambit** (Int) - Required - The product ambit. - **product_id** (String) - Required - The product ID. ### Request Body ```json { "query": "query GetStockOfProduct($key: warehouse_product_branch_InputFilter_key) {\n warehouse {\n product_branch(by: {key: $key})\n {\n stock_real\n stock_reserved\n }\n }\n}", "variables": { "key": { "company_id": 1, "branch_id": 0, "product_ambit": 0, "product_id": "test1" } } } ``` ### Response #### Success Response (200) - **warehouse.product_branch.stock_real** (Float) - The real stock quantity. - **warehouse.product_branch.stock_reserved** (Float) - The reserved stock quantity. #### Response Example ```json { "data": { "warehouse": { "product_branch": { "stock_real": 100.0, "stock_reserved": 25.0 } } } } ``` ``` -------------------------------- ### Example - Paginated Queries Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Demonstrates how to implement pagination for query results. This involves first fetching the total count of records and then retrieving records in manageable blocks using `first` and `offset` parameters. ```APIDOC ## Paginated Queries ### Description This section illustrates how to paginate query results. It involves two steps: first, obtaining the total number of records, and second, fetching records in sequential pages using the `first` and `offset` arguments. ### Step 1: Get Total Number of Records ```graphql query GetTotalCustomers { master_files { customers(where: {key: {customer_ambit: {equals: 0}}}) { totalCount } } } ``` ### Step 2: Fetch Records in Blocks ```graphql query GetCustomersPage($first: Int!, $offset: Int!) { master_files { customers( where: {key: {customer_ambit: {equals: 0}}} first: $first offset: $offset ) { nodes { customer_id name } } } } ``` ### Example Pagination Variables (10 records per page): | Page | $first | $offset | |---|---|---| | 1 | 10 | 0 | | 2 | 10 | 10 | | 3 | 10 | 20 | | 4 | 10 | 30 | | etc. | | | ``` -------------------------------- ### Get Product Details with Branch Specifics Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves product details, including branch-specific information like packing unit and stock reserved. ```APIDOC ## GET /api/warehouse/product ### Description Fetches product information, including details specific to a company branch. ### Method GET ### Endpoint /api/warehouse/product ### Parameters #### Query Parameters - **by** (object) - Required - Specifies how to identify the product. - **unique_id** (string) - Optional - Filters by the unique ID of the product. - **key** (object) - Required - The key for the company branch. - **company_id** (integer) - Required - The ID of the company. - **branch_id** (integer) - Required - The ID of the branch. ### Request Example ```json { "query": "query GetProductDetails($uniqueId: String!, $companyId: Int!, $branchId: Int!) {\n warehouse {\n product(by: {unique_id: $uniqueId}) {\n product_id\n reference\n product_branch(by: {key: {company_id: $companyId, branch_id: $branchId}}) {\n packing_unit_sales\n stock_reserved\n }\n }\n }\n}", "variables": { "uniqueId": "PROD123", "companyId": 1, "branchId": 0 } } ``` ### Response #### Success Response (200) - **product_id** (integer) - The ID of the product. - **reference** (string) - The reference of the product. - **product_branch** (object) - Branch-specific product information. - **packing_unit_sales** (string) - The sales packing unit. - **stock_reserved** (integer) - The reserved stock quantity. #### Response Example ```json { "data": { "warehouse": { "product": { "product_id": 456, "reference": "WIDGET-A", "product_branch": { "packing_unit_sales": "BOX", "stock_reserved": 50 } } } } } ``` ``` -------------------------------- ### Get Stocks Of Product Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves stock data for all branches of a product, localized by brand and reference. ```APIDOC ## GET /graphql ### Description Retrieves stock data for all branches of a product, localized by brand and reference. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **query** (String!) - Required - The GraphQL query string. ### Request Body ```json { "query": "query GetStocksOfProduct($product_ambit: Int!, $brand_name: String!, $reference: String!) {\n warehouse {\n product( by: {reference: {product_ambit: $product_ambit, brand_name: $brand_name, reference: $reference}} ) {\n product_branches {\n company_id\n branch_id\n stock_real\n }\n }\n }\n}" } ``` ### Response #### Success Response (200) - **data** (Object) - The response data containing stock information. - **warehouse** (Object) - **product** (Object) - **product_branches** (Array of Objects) - **company_id** (Int) - The company identifier. - **branch_id** (Int) - The branch identifier. - **stock_real** (Int) - The real stock quantity. #### Response Example ```json { "data": { "warehouse": { "product": { "product_branches": [ { "company_id": 1, "branch_id": 101, "stock_real": 50 }, { "company_id": 1, "branch_id": 102, "stock_real": 75 } ] } } } } ``` ``` -------------------------------- ### Get Multiple Products Stock with Fragments Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves stock information for multiple products in a single query using fragments for efficiency. ```APIDOC ## POST /graphql ### Description Retrieves stock information for multiple products in a single query using fragments for efficiency. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **company_id** (Int) - Required - The company ID. - **branch_id** (Int) - Required - The branch ID. - **product_ambit** (Int) - Required - The product ambit. - **product_id_1** (String) - Required - The ID of the first product. - **product_id_2** (String) - Required - The ID of the second product. - **product_id_3** (String) - Required - The ID of the third product. - **product_id_4** (String) - Required - The ID of the fourth product. - **product_id_5** (String) - Required - The ID of the fifth product. ### Request Body ```json { "query": "query GetMultipleProducts($company_id: Int!, $branch_id: Int!, $product_ambit: Int!, $product_id_1: String!, $product_id_2: String!, $product_id_3: String!, $product_id_4: String!, $product_id_5: String!) {\n warehouse {\n stock_1: product_branch(\n by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_1}}\n ) {\n ...stock_fields\n }\n stock_2: product_branch(\n by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_2}}\n ) {\n ...stock_fields\n }\n stock_3: product_branch(\n by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_3}}\n ) {\n ...stock_fields\n }\n stock_4: product_branch(\n by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_4}}\n ) {\n stock_real\n }\n stock_5: product_branch(\n by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_5}}\n ) {\n ...stock_fields\n }\n }\n}\n\nfragment stock_fields on product_branch {\n stock_real\n stock_reserved\n stock_pending_issue\n stock_pending_receive\n}", "variables": { "company_id": 1, "branch_id": 0, "product_ambit": 0, "product_id_1": "PROD001", "product_id_2": "PROD002", "product_id_3": "PROD003", "product_id_4": "PROD004", "product_id_5": "PROD005" } } ``` ### Response #### Success Response (200) - **warehouse.stock_1** (Object) - Stock information for the first product. - **warehouse.stock_2** (Object) - Stock information for the second product. - **warehouse.stock_3** (Object) - Stock information for the third product. - **warehouse.stock_4** (Object) - Stock information for the fourth product (only real stock). - **warehouse.stock_5** (Object) - Stock information for the fifth product. - **stock_real** (Float) - The real stock quantity. - **stock_reserved** (Float) - The reserved stock quantity. - **stock_pending_issue** (Float) - The pending issue stock quantity. - **stock_pending_receive** (Float) - The pending receive stock quantity. #### Response Example ```json { "data": { "warehouse": { "stock_1": { "stock_real": 100.0, "stock_reserved": 20.0, "stock_pending_issue": 5.0, "stock_pending_receive": 10.0 }, "stock_2": { "stock_real": 75.0, "stock_reserved": 15.0, "stock_pending_issue": 3.0, "stock_pending_receive": 8.0 }, "stock_3": { "stock_real": 50.0, "stock_reserved": 10.0, "stock_pending_issue": 2.0, "stock_pending_receive": 5.0 }, "stock_4": { "stock_real": 120.0 }, "stock_5": { "stock_real": 90.0, "stock_reserved": 18.0, "stock_pending_issue": 4.0, "stock_pending_receive": 9.0 } } } } ``` ``` -------------------------------- ### Get Stock of Product by Brand and Reference Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves stock information for all branches of a product identified by brand name and reference. ```APIDOC ## POST /graphql ### Description Retrieves stock information for all branches of a product identified by brand name and reference. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **product_ambit** (Int) - Required - The product ambit. - **brand_name** (String) - Required - The brand name of the product. - **reference** (String) - Required - The reference of the product. ### Request Body ```json { "query": "query GetStocksOfProduct($product_ambit: Int!, $brand_name: String!, $reference: String!) {\n warehouse {\n product(\n by: {reference: {product_ambit: $product_ambit, brand_name: $brand_name, reference: $reference}}\n ) {\n product_branches {\n company_id\n branch_id\n stock_real\n }\n }\n }\n}", "variables": { "product_ambit": 0, "brand_name": "ExampleBrand", "reference": "EXMPL-REF" } } ``` ### Response #### Success Response (200) - **warehouse.product.product_branches** (Array) - An array of product branch stock information. - **company_id** (Int) - The company ID. - **branch_id** (Int) - The branch ID. - **stock_real** (Float) - The real stock quantity for the branch. #### Response Example ```json { "data": { "warehouse": { "product": { "product_branches": [ { "company_id": 1, "branch_id": 0, "stock_real": 50.0 }, { "company_id": 1, "branch_id": 1, "stock_real": 75.5 } ] } } } } ``` ``` -------------------------------- ### GraphQL Query for Product (with and without variables) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Example GraphQL queries for retrieving product information. The first query is a direct query, while the second demonstrates the use of variables for more efficient and cacheable queries. This is recommended for frequently repeated queries. ```graphql query GetProduct { warehouse { product(by: {product_id: {product_ambit: 0, product_id: "gql-1007"}}) { product_id reference } } } ``` ```graphql query GetProduct($product_id: String!) { warehouse { product(by: {product_id: {product_ambit: 0, product_id: $product_id}}) { product_id reference } } } ``` ```json { "product_id": "gql-1007" } ``` -------------------------------- ### GraphQL Paged Query Example Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Illustrates how to implement pagination for GraphQL queries. It involves two steps: first, fetching the total count of records, and second, using `first` and `offset` arguments to retrieve records in blocks. This approach is efficient for handling large datasets. ```graphql query GetTotalCustomers { master_files { customers(where: {key: {customer_ambit: {equals: 0}}}) { totalCount } } } query GetCustomersPage($first: Int!, $offset: Int!) { master_files { customers( where: {key: {customer_ambit: {equals: 0}}} first: $first offset: $offset ) { nodes { customer_id name } } } } ``` -------------------------------- ### Get Stock of Product by Brand and Reference (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves real stock data for all branches of a product identified by its brand name and reference. Requires product ambit, brand name, and reference as input. ```graphql query GetStocksOfProduct($product_ambit: Int!, $brand_name: String!, $reference: String!) { warehouse { product( by: {reference: {product_ambit: $product_ambit, brand_name: $brand_name, reference: $reference}} ) { product_branches { company_id branch_id stock_real } } } } ``` -------------------------------- ### Get Stock of Product by Key (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Fetches real and reserved stock for a product using its unique key, which includes company, branch, product ambit, and product ID. The input is a composite object. ```graphql query GetStockOfProduct($key: warehouse_product_branch_InputFilter_key) { warehouse { product_branch(by: {key: $key}) { stock_real stock_reserved } } } ``` -------------------------------- ### GraphQL Query with Variables (Example) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Demonstrates the use of variables in GraphQL queries to improve performance through query plan caching. Instead of hardcoding filter values, variables are used, and their values are provided separately in a JSON object. This is a recommended practice for frequently executed queries. ```graphql query GetProduct($product_id: String!) { warehouse { product(by: {product_id: {product_ambit: 0, product_id: $product_id}}) { product_id reference } } } ``` ```json { "product_id": "gql-1007" } ``` -------------------------------- ### Obtener Stock de Producto por Marca y Referencia (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Esta consulta GraphQL recupera los datos de stock de todas las delegaciones de un producto específico, localizado por marca y referencia. Requiere parámetros para el ámbito del producto, nombre de la marca y referencia. ```graphql query GetStocksOfProduct($product_ambit: Int!, $brand_name: String!, $reference: String!) { warehouse { product(by: {reference: {product_ambit: $product_ambit, brand_name: $brand_name, reference: $reference}}) { product_branches { company_id branch_id stock_real } } } } ``` -------------------------------- ### Get Pending Changes Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves a list of record identifiers that have pending changes, allowing for change control. ```APIDOC ## GET /api/general/pending_changes ### Description Fetches a list of unique identifiers for records that have pending changes and are subject to change control. ### Method GET ### Endpoint /api/general/pending_changes ### Parameters #### Query Parameters - **table** (string) - Required - The name of the table to check for pending changes. ### Request Example ```json { "query": "query GetPendingChanges($tableName: String!) {\n general {\n pending(table: $tableName) {\n unique_id\n }\n }\n}", "variables": { "tableName": "sales_delivery_notes" } } ``` ### Response #### Success Response (200) - **unique_id** (string) - The unique identifier of a record with pending changes. #### Response Example ```json { "data": { "general": { "pending": [ {"unique_id": "change-set-1"}, {"unique_id": "change-set-2"} ] } } } ``` ``` -------------------------------- ### Múltiples Consultas de Producto con Fragmentos (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Permite realizar múltiples consultas a la vez y unificar campos mediante fragmentos. Esta consulta recupera datos de stock de varios productos, utilizando un fragmento 'stock_fields' para campos comunes y especificando campos para otros. ```graphql query GetMultipleProducts($company_id: Int!, $branch_id: Int!, $product_ambit: Int!, $product_id_1: String!, $product_id_2: String!, $product_id_3: String!, $product_id_4: String!, $product_id_5: String!) { warehouse { stock_1: product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_1}}) { ...stock_fields } stock_2: product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_2}}) { ...stock_fields } stock_3: product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_3}}) { ...stock_fields } stock_4: product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_4}}) { stock_real } stock_5: product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_5}}) { ...stock_fields } } } fragment stock_fields on product_branch { stock_real stock_reserved stock_pending_issue stock_pending_receive } ``` -------------------------------- ### Obtener Artículos por Clasificación (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Esta consulta GraphQL recupera artículos de una clasificación específica, incluyendo datos de precios, embalajes, códigos de barras e imágenes. Utiliza parámetros para paginación, ámbito del producto, ID de clasificación y detalles de la empresa/cliente. ```graphql query ProductsByClassification($first: Int = 10, $offset: Int = 0, $product_ambit: Int!, $classification_id: Int!, $company_id: Int!, $branch_id: Int!, $customer_b2b_id: Int!, $customer_b2c_id: Int!, $image_document_type: String) { warehouse { products_by_classification(first: $first, where: {product_classification_id: {equals: $classification_id}, key: {product_ambit: {equals: $product_ambit}}}, order: {product_id: ASC}, offset: $offset) { nodes { level_1 { description } level_2 { description } product { unique_id product_id brand_name reference description_short barcodes { barcode code_type } product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id}}) { sales_packing_unit { packing_unit_id minimum_quantity multiple_quantity } vendor_id pricing_b2c: pricing(by: {key: {customer_id: $customer_b2c_id}}) { ...pricing_fields } pricing_b2b: pricing(by: {key: {customer_id: $customer_b2b_id}}) { ...pricing_fields } } attached_files(where: {document_type: {equals: $image_document_type}}) { file_name file_blob } } } } } } fragment pricing_fields on sales_pricing { price price_quantity equivalent_discount currency_id net_price } ``` -------------------------------- ### Get Delivery Notes by Customer Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves delivery notes for a specific customer, including header, line, and tax information. ```APIDOC ## POST /graphql ### Description Retrieves delivery notes for a specific customer, including header, line, and tax information. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **first** (Int) - Optional - The number of delivery notes to return. - **offset** (Int) - Optional - The offset for pagination. - **customer_id** (Int) - Required - The ID of the customer. - **customer_ambit** (Int) - Required - The ambit of the customer. ### Request Body ```json { "query": "query GetDeliveryNotesByCustomer($first: Int = 10, $offset: Int, $customer_id: Int, $customer_ambit: Int) {\n sales {\n delivery_notes(\n first: $first\n offset: $offset\n where: {customer: {customer_ambit: {equals: $customer_ambit}, customer_id: {equals: $customer_id}}}\n order: {date: ASC}\n ) {\n nodes {\n sales_delivery_note_type\n sales_delivery_note_id\n date\n reference\n reference_2\n amount\n lines {\n product_id\n product_reference\n brand_name\n quantity\n price\n discount_1\n amount\n }\n taxes {\n tax_id\n tax_base\n tax_rate\n tax_amount\n }\n }\n }\n }\n}", "variables": { "first": 10, "offset": 0, "customer_id": 123, "customer_ambit": 1 } } ``` ### Response #### Success Response (200) - **sales.delivery_notes.nodes** (Array) - An array of delivery note objects. - **sales_delivery_note_type** (String) - The type of the delivery note. - **sales_delivery_note_id** (Int) - The ID of the delivery note. - **date** (String) - The date of the delivery note. - **reference** (String) - The reference of the delivery note. - **reference_2** (String) - The second reference of the delivery note. - **amount** (Float) - The total amount of the delivery note. - **lines** (Array) - An array of line items for the delivery note. - **product_id** (String) - The ID of the product. - **product_reference** (String) - The reference of the product. - **brand_name** (String) - The brand name of the product. - **quantity** (Float) - The quantity of the product. - **price** (Float) - The price of the product. - **discount_1** (Float) - The first discount applied. - **amount** (Float) - The amount for the line item. - **taxes** (Array) - An array of tax objects for the delivery note. - **tax_id** (Int) - The ID of the tax. - **tax_base** (Float) - The tax base amount. - **tax_rate** (Float) - The tax rate. - **tax_amount** (Float) - The tax amount. #### Response Example ```json { "data": { "sales": { "delivery_notes": { "nodes": [ { "sales_delivery_note_type": "TypeA", "sales_delivery_note_id": 1001, "date": "2023-10-27T10:00:00Z", "reference": "REF001", "reference_2": "REF001-B", "amount": 150.75, "lines": [ { "product_id": "PROD123", "product_reference": "P123", "brand_name": "BrandX", "quantity": 2, "price": 50.00, "discount_1": 0.05, "amount": 95.00 } ], "taxes": [ { "tax_id": 1, "tax_base": 95.00, "tax_rate": 0.21, "tax_amount": 19.95 } ] } ] } } } } ``` ``` -------------------------------- ### Get Company Branch Scope Information Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves the scope information (customer and product ambit) for a given company and branch. ```APIDOC ## GET /api/general/company_branch ### Description Fetches the customer and product ambit values for a specific company branch. ### Method GET ### Endpoint /api/general/company_branch ### Parameters #### Query Parameters - **by** (object) - Required - Specifies the key to identify the company branch. - **key** (object) - Required - The key for the company branch. - **company_id** (integer) - Required - The ID of the company. - **branch_id** (integer) - Required - The ID of the branch. ### Request Example ```json { "query": "query GetCompanyBranchScope($companyId: Int!, $branchId: Int!) {\n general {\n company_branch(by: {key: {company_id: $companyId, branch_id: $branchId}}) {\n customer_ambit\n product_ambit\n }\n }\n}", "variables": { "companyId": 1, "branchId": 0 } } ``` ### Response #### Success Response (200) - **customer_ambit** (integer) - The customer ambit ID. - **product_ambit** (integer) - The product ambit ID. #### Response Example ```json { "data": { "general": { "company_branch": { "customer_ambit": 1, "product_ambit": 2 } } } } ``` ``` -------------------------------- ### Obtener Token de Autenticación (IIS) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Solicita un token de acceso para la API GraphQL en entornos IIS. Requiere enviar credenciales de usuario en el cuerpo de la petición POST. ```json { "name": "{Nombre del usuario}", "password": "{Contraseña del usuario}" } ``` -------------------------------- ### Get Delivery Notes by Customer (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves delivery notes for a specific customer, including header, line items, and tax details. Requires customer ID and ambit as input. ```graphql query GetDeliveryNotesByCustomer($first: Int = 10, $offset: Int, $customer_id: Int, $customer_ambit: Int) { sales { delivery_notes( first: $first offset: $offset where: {customer: {customer_ambit: {equals: $customer_ambit}, customer_id: {equals: $customer_id}}} order: {date: ASC} ) { nodes { sales_delivery_note_type sales_delivery_note_id date reference reference_2 amount lines { product_id product_reference brand_name quantity price discount_1 amount } taxes { tax_id tax_base tax_rate tax_amount } } } } } ``` -------------------------------- ### Get Pending Changed Record Identifiers (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Illustrates how to retrieve a list of identifiers for records that have pending changes. This is the first step in the change control process and requires filtering by the table name. ```graphql general { pending(filter: {table: "your_table_name"}) { id } } ``` -------------------------------- ### Obtener Precio de Artículo por Código de Barras (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Esta consulta GraphQL recupera el precio neto de un artículo buscando por su código de barras. Requiere el ámbito del producto, el código de barras, y los identificadores de la empresa, sucursal y cliente. ```graphql query PriceByBarcode($product_ambit: Int!, $barcode: String!, $company_id: Int!, $branch_id: Int!, $customer_id: Int!) { warehouse { product_barcode(by: {barcode: {barcode: $barcode, product_ambit: $product_ambit}}) { product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id}}) { pricing(by: {key: {customer_id: $customer_id}}) { net_price } } } } } ``` -------------------------------- ### Multiple Product Stock Queries with Fragments (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Demonstrates how to perform multiple stock queries in a single GraphQL request using fragments to define reusable sets of fields. This query retrieves various stock metrics for multiple products. ```graphql query GetMultipleProducts($company_id: Int!, $branch_id: Int!, $product_ambit: Int!, $product_id_1: String!, $product_id_2: String!, $product_id_3: String!, $product_id_4: String!, $product_id_5: String!) { warehouse { stock_1: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_1}} ) { ...stock_fields } stock_2: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_2}} ) { ...stock_fields } stock_3: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_3}} ) { ...stock_fields } stock_4: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_4}} ) { stock_real } stock_5: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_5}} ) { ...stock_fields } } } fragment stock_fields on product_branch { stock_real stock_reserved stock_pending_issue stock_pending_receive } ``` -------------------------------- ### Product Information (Scoped and Branch-Specific) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves complete product information by first querying the product by its unique ID (scoped) and then fetching branch-specific details. ```APIDOC ## GET /warehouse/product ### Description Retrieves detailed product information, including branch-specific properties, by using a unique product ID and then querying for branch-specific data. ### Method GET ### Endpoint `/warehouse/product` ### Parameters #### Query Parameters - **by** (Object) - Required - Specifies the lookup criteria for the product: - **unique_id** (String) - Required - The unique identifier for the product. #### Nested Query Parameters (for `product_branch`) - **product_branch** (Object) - Optional - Retrieves branch-specific product details: - **by** (Object) - Required - Specifies the lookup criteria for the product branch: - **key** (Object) - Required - Identifies the product branch by its key: - **company_id** (Int) - Required - The ID of the company. - **branch_id** (Int) - Required - The ID of the branch. ### Request Example ```json { "query": "query GetProductDetails($uniqueId: String!, $companyId: Int!, $branchId: Int!) {\n warehouse {\n product(by: {unique_id: $uniqueId}) {\n product_id\n reference\n product_branch(by: {key: {company_id: $companyId, branch_id: $branchId}}) {\n packing_unit_sales\n stock_reserved\n }\n }\n }\n}", "variables": { "uniqueId": "PROD-XYZ-789", "companyId": 1, "branchId": 0 } } ``` ### Response #### Success Response (200) - **product_id** (Int) - The ID of the product. - **reference** (String) - The reference code of the product. - **product_branch** (Object) - Contains branch-specific product details: - **packing_unit_sales** (String) - The sales packing unit for the product. - **stock_reserved** (Int) - The reserved stock quantity for the product. #### Response Example ```json { "data": { "warehouse": { "product": { "product_id": 9876, "reference": "WIDGET-A", "product_branch": { "packing_unit_sales": "BOX", "stock_reserved": 50 } } } } } ``` ``` -------------------------------- ### GraphQL Paginated Query for Customers Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql GraphQL query to retrieve a specific page of customer records. It uses variables for 'first' (number of records per page) and 'offset' (starting point) to fetch data in blocks. ```graphql query GetCustomersPage($first: Int!, $offset: Int!) { master_files { customers( where: {key: {customer_ambit: {equals: 0}}} first: $first offset: $offset ) { nodes { customer_id name } } } } ``` -------------------------------- ### Retrieve Product Details with Branch-Specific Information (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Demonstrates fetching a product by its unique ID and then retrieving branch-specific details like packing unit and stock reserved. This requires querying both the general product table and the product_branch table. ```graphql warehouse { product(by: {unique_id: $unique_id}) { product_id reference product_branch(by: {key: {company_id: 1, branch_id: 0}}) { packing_unit_sales stock_reserved } } } ``` -------------------------------- ### Fetch Products by Classification (GraphQL) Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Retrieves product information including pricing, packaging, barcodes, and images for a specific classification. It requires various IDs for company, branch, customer types, and an image document type. The output includes product levels, unique ID, brand, reference, short description, barcodes, sales packing units, vendor ID, pricing details (B2C and B2B), and attached files. ```graphql query ProductsByClassification($first: Int = 10, $offset: Int = 0, $product_ambit: Int!, $classification_id: Int!, $company_id: Int!, $branch_id: Int!, $customer_b2b_id: Int!, $customer_b2c_id: Int!, $image_document_type: String) { warehouse { products_by_classification( first: $first where: {product_classification_id: {equals: $classification_id}, key: {product_ambit: {equals: $product_ambit}}} order: {product_id: ASC} offset: $offset ) { nodes { level_1 { description } level_2 { description } product { unique_id product_id brand_name reference description_short barcodes { barcode code_type } product_branch(by: {key: {company_id: $company_id, branch_id: $branch_id}}) { sales_packing_unit { packing_unit_id minimum_quantity multiple_quantity } vendor_id pricing_b2c: pricing(by: {key: {customer_id: $customer_b2c_id}}) { ...pricing_fields } pricing_b2b: pricing(by: {key: {customer_id: $customer_b2b_id}}) { ...pricing_fields } } attached_files(where: {document_type: {equals: $image_document_type}}) { file_name file_blob } } } } } } fragment pricing_fields on sales_pricing { price price_quantity equivalent_discount currency_id net_price } ``` -------------------------------- ### Multiple Queries with Fragments Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/graph_ql Demonstrates how to perform multiple queries simultaneously using GraphQL fragments to unify returned fields. ```APIDOC ## POST /graphql ### Description Performs multiple queries simultaneously using GraphQL fragments to unify returned fields. This example retrieves stock information for multiple products. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **query** (String!) - Required - The GraphQL query string. ### Request Body ```json { "query": "query GetMultipleProducts($company_id: Int!, $branch_id: Int!, $product_ambit: Int!, $product_id_1: String!, $product_id_2: String!, $product_id_3: String!, $product_id_4: String!, $product_id_5: String!) {\n warehouse {\n stock_1: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_1}} ) { ...stock_fields }\n stock_2: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_2}} ) { ...stock_fields }\n stock_3: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_3}} ) { ...stock_fields }\n stock_4: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_4}} ) { stock_real }\n stock_5: product_branch( by: {key: {company_id: $company_id, branch_id: $branch_id, product_ambit: $product_ambit, product_id: $product_id_5}} ) { ...stock_fields }\n }\n}\n\nfragment stock_fields on product_branch {\n stock_real\n stock_reserved\n stock_pending_issue\n stock_pending_receive\n}" } ``` ### Response #### Success Response (200) - **data** (Object) - The response data containing stock information for multiple products. - **warehouse** (Object) - **stock_1**, **stock_2**, etc. (Object) - Stock details for each queried product. - **stock_real** (Int) - The real stock quantity. - **stock_reserved** (Int) - The reserved stock quantity. - **stock_pending_issue** (Int) - The pending issue stock quantity. - **stock_pending_receive** (Int) - The pending receive stock quantity. #### Response Example ```json { "data": { "warehouse": { "stock_1": { "stock_real": 100, "stock_reserved": 10, "stock_pending_issue": 5, "stock_pending_receive": 0 }, "stock_2": { "stock_real": 200, "stock_reserved": 20, "stock_pending_issue": 10, "stock_pending_receive": 5 }, "stock_3": { "stock_real": 150, "stock_reserved": 15, "stock_pending_issue": 8, "stock_pending_receive": 2 }, "stock_4": { "stock_real": 120 }, "stock_5": { "stock_real": 180, "stock_reserved": 18, "stock_pending_issue": 9, "stock_pending_receive": 3 } } } } ``` ``` -------------------------------- ### Product Catalog API Source: https://help.telematel.com/documentation/gomanage/v2024.4/help/good_practices This API allows retrieval of products from GO!Manage. It only returns products marked as published. Additionally, it can provide related documents, sales conditions (for single or multiple items), and stock information (for single or multiple items). ```APIDOC ## GET /Apitmt-products ### Description Retrieves product information, including related documents, sales conditions, and stock levels. Only published products are returned. ### Method GET ### Endpoint /Apitmt-products ### Parameters #### Query Parameters - **lastReplicationDate** (string) - Optional - The date of the last replication to fetch incremental changes. - **productId** (string) - Optional - Filters results for a specific product. - **articleIds** (array of strings) - Optional - Filters results for a list of article IDs. ### Request Example ```json { "example": "GET /Apitmt-products?lastReplicationDate=2023-10-27T10:00:00Z" } ``` ### Response #### Success Response (200) - **products** (array) - List of product objects. - **productId** (string) - The unique identifier for the product. - **name** (string) - The name of the product. - **published** (boolean) - Indicates if the product is published. - **relatedDocuments** (array) - List of documents related to the product. - **salesConditions** (object) - Commercial sales conditions for the product. - **stock** (object) - Stock information for the product. #### Response Example ```json { "example": { "products": [ { "productId": "P123", "name": "Example Product", "published": true, "relatedDocuments": [], "salesConditions": {}, "stock": {} } ] } } ``` ```