### Example Request to Get Product Details Source: https://developer.getfly.vn/docs/6.1/product/detail An example using curl to request product details, specifying the fields and product code, and including the necessary API key. ```Shell curl --location 'https://xxxx.getflycrm.com/api/v6.1/product?fields=id%2Cproduct_name%2Cproduct_code%2Cprice_online%2Ccreated_at&product_code=SP.00192' \ --header 'X-API-KEY: {your_api_key}' ``` -------------------------------- ### Get API Fields Example Source: https://developer.getfly.vn/docs/6.1/needed_info This example demonstrates how to specify fields to retrieve in a GET request. It shows a JSON object where the 'fields' key is used to list the desired information. ```JSON { "fields": "info1,info2" } ``` -------------------------------- ### Product Details Response Example Source: https://developer.getfly.vn/docs/6.1/product/detail Example JSON response containing comprehensive details of a product, including its ID, name, pricing, descriptions, attributes, and images. ```JSON { "id": 2531, "category_id": 2, "category_name": "Giả dược", "origin_id": 1, "origin_name": "Nhật", "unit_id": 18, "unit_name": "Bánh", "manufacturer_id": 1, "manufacturer_name": "T.c áo đen", "services": 0, "saleoff_price": 10, "created_at": "2025-03-13 14:58:11", "updated_at": "2025-03-13 14:58:11", "featured_image": "https://linhpq.getflycrm.com/uploads/", "product_name": "Sản phẩm Demo API", "product_code": "SP.00192", "last_active": "2025-03-13 14:58:11", "description": "

Mô tả dài

", "cover_price": 19000, "price_wholesale": 25000, "discount": 5, "short_description": "Mô tả ngắn", "discount_wholesale": 5, "price_online": 21000, "discount_online": 5, "price_average_in": 15000, "discount_in": 10, "product_vat": 10, "weight": 16, "detail_custom_fields": { "ngay_nhap": "1741798800", "truong_so": "12", "gia_si": "111111" }, "variant_attribute_values": [ { "value_id": 12, "attribute_id": 6, "attribute_name": "Loại nhân", "value_name": "Trứng thịt" }, { "value_id": 31, "attribute_id": 6, "attribute_name": "Loại nhân", "value_name": "Thập cẩm" }, { "value_id": 15, "attribute_id": 7, "attribute_name": "Vỏ bánh", "value_name": "Nướng giòn" }, { "value_id": 16, "attribute_id": 7, "attribute_name": "Vỏ bánh", "value_name": "Mềm" } ], "variant_attributes": [ { "attribute_id": 6, "attribute_name": "Loại nhân" }, { "attribute_id": 7, "attribute_name": "Vỏ bánh" } ], "images": [ { "id": 5, "file_name": "fixed_sleepy_coder.png", "thumbnail_file": "https://linhpq.getflycrm.com/uploads/", "created_at": 1741852691, "product_id": 2531 } ] } ``` -------------------------------- ### Get API Limit Example Source: https://developer.getfly.vn/docs/6.1/needed_info This example shows how to limit the number of results returned in a GET request. The 'limit' key specifies the maximum number of records to retrieve. ```JSON { "limit": 5 } ``` -------------------------------- ### Get API Direction Example Source: https://developer.getfly.vn/docs/6.1/needed_info This example demonstrates how to set the sorting direction for a GET request. The 'direction' key can be set to 'asc' (ascending) or 'desc' (descending). ```JSON { "direction": "asc" } ``` -------------------------------- ### Sample Purchase Order Response Source: https://developer.getfly.vn/docs/6.1/purchase-order/list Example JSON response for the purchase orders API, showing a single order with details like ID, order code, amounts, dates, status, customer information, assigned user, and order details including products. ```JSON { "data": [ { "id": 123, "order_code": "PO001", "real_amount": 1000000, "f_amount": 1000000, "discount": 0, "discount_amount": 0, "vat_amount": 0, "account_id": null, "account_code": "", "account_email": "", "account_phone": "", "account_address": "", "order_date": "2025-05-12 00:00:00", "created_at": "2025-05-12 09:10:48", "updated_at": "2025-05-12 09:10:48", "status": 1, "assigned_user": 2, "assigned_user_name": "Assigned User", "contact_name": "", "contact_phone": "", "contact_email": "", "detail_custom_fields": { "ma_phu": "", "ghi_chu_rieng": "" }, "custom_fields": [], "order_details": [ { "id": 456, "product_id": 789, "product_name": "Product A Name", "product_code": "SP123", "quantity": 2, "price": 500000, "amount": 1000000, "unit_name": "Piece", "product_avatar": "https://example.com/image.png" } ] } ], "has_more": true, "offset": 1, "limited": 2, "sorted": { "order_date": "DESC" } } ``` -------------------------------- ### Create Product API Request Body Example Source: https://developer.getfly.vn/docs/6.1/product/create An example of a complete request body for creating a new product, including all optional and required fields. ```json { "product_name": "Sản phẩm API Test", "product_code": "SP.TEST.001", "unit_name": "Hộp", "category_name": "Thiết bị", "origin_name": "Việt Nam", "manufacturer_name": "Công ty ABC", "short_description": "Sản phẩm dùng thử", "description": "

Mô tả chi tiết sản phẩm

", "cover_price": 20000, "price_wholesale": 18000, "discount": 10, "discount_wholesale": 15, "price_online": 19000, "discount_online": 5, "price_average_in": 15000, "discount_in": 8, "saleoff_price": 12, "product_vat": 5, "barcode": "BAR123456", "weight": 500, "custom_fields": { "ngay_nhap": 1742317200, "so_luong": 100, "gia_ban": "20000" }, "variant_attribute_values": [ { "attribute_name": "Màu sắc", "value_name": "Đỏ", "additional_price": 2000 }, { "attribute_name": "Kích thước", "value_name": "Lớn", "additional_price": 5000 } ] } ``` -------------------------------- ### Get API Offset Example Source: https://developer.getfly.vn/docs/6.1/needed_info This example illustrates how to set an offset for pagination in a GET request. The 'offset' key determines the number of records to skip from the beginning of the result set. ```JSON { "offset": 5 } ``` -------------------------------- ### Get API Sorting Example Source: https://developer.getfly.vn/docs/6.1/needed_info This example shows how to specify a field for sorting the results in a GET request. The 'sort' key indicates the field by which the data should be ordered. ```JSON { "sort": "info1" } ``` -------------------------------- ### API Request Example (cURL) Source: https://developer.getfly.vn/docs/6.1/product/list This example demonstrates how to make a request to the Getfly API v6.1 to fetch product data using cURL. It includes query parameters for specifying fields and limit, and sets the required API key and session cookie. ```Shell curl --location '/api/v6.1/products?fields=id%2Cproduct_name%2Cproduct_code%2Cprice_online%2Ccreated_at&limit=1' \ --header 'X-API-KEY: {your_api_key}' \ --header 'Cookie: v6_getflycrm_session={your_session_token}' ``` -------------------------------- ### Create Product API Success Response Example Source: https://developer.getfly.vn/docs/6.1/product/create An example of a successful response after creating a new product, including a success message and the new product's ID and code. ```json { "message": "Thêm mới thành công", "data": { "product_id": 1001, "product_code": "SP.TEST.001" } } ``` -------------------------------- ### Get Product Details Source: https://developer.getfly.vn/docs/6.1/product/detail Retrieves detailed information for a specific product using its code. Requires an API key for authentication. ```HTTP GET /api/v6.1/product Headers: { "Content-Type": "application/json", "X-API-KEY": "{your_api_key}" } Query Parameters: fields: string (optional) - List of data fields to retrieve. product_code: string (required) - The code of the product to retrieve information for. ``` -------------------------------- ### Get Tasks List with Parameters Source: https://developer.getfly.vn/docs/6.1/task/list Retrieves a list of tasks using the GetFly API v6.1. This example demonstrates how to specify fields, limit, offset, sort order, and includes the required API key in the request header. ```curl curl --location 'https://xxxx.getflycrm.com/api/v6.1/tasks?fields=id%2Ctask_code%2Ctask_name%2Ctask_start_date%2Ctask_end_date%2Ctask_status%2Ctask_receiver_display_name%2Cproject_name&limit=5&offset=0&sort_by=task_start_date&order=desc' \ --header 'X-API-KEY: ' ``` -------------------------------- ### Get Product List API Endpoint Source: https://developer.getfly.vn/docs/6.1/product/list This snippet shows the GET endpoint for retrieving a list of products from the Getfly API v6.1. It includes the base path and version. ```HTTP GET /api/v6.1/products ``` -------------------------------- ### cURL Example for Creating Ticket Source: https://developer.getfly.vn/docs/6.1/ticket/create This example demonstrates how to use cURL to send a POST request to create a new support ticket, including all necessary headers and the JSON payload. ```curl curl --location 'https:///api/v6.1/ticket' \ --header 'Content-Type: application/json' \ --header 'X-API-KEY: ' \ --header 'Cookie: ' \ --data-raw '{ "ticket_title": "Tiêu đề phiếu", "ticket_content": "

Nội dung hỗ trợ

", "cate_name": "Danh mục", "account_email": "email@domain.com", "account_code": "ma-khach-hang", "contact_name": "Người liên hệ", "status_name": "Trạng thái", "expected_at": "2025-01-01", "custom_fields": { "truong_mo_rong": "giá trị" }, "emergency_phone": "0123456789" }' ``` -------------------------------- ### Get API Filtering Conditions Source: https://developer.getfly.vn/docs/6.1/needed_info This example illustrates various condition operations for filtering data in a GET request. It includes operations like 'eq' (equal to), 'in' (within an array), 'contains', and range comparisons. ```JSON { "filtering": { "info1:eq": 1, "info1:is": 1, "info1:in": [1,2,3], "info1:not_in": [1,2,3], "info1:contains": "info", "info1:between": [1,10], "info1:not_between": [1,10], "info1:gte": 1, "info1:gt": 1, "info1:lte": 1, "info1:lt": 1 } } ``` -------------------------------- ### Get Purchase Orders List Source: https://developer.getfly.vn/docs/6.1/purchase-order/list Retrieves a list of purchase orders using the GET method. Requires an API key and session cookie. Supports filtering by status, pagination, and sorting. ```HTTP GET /api/v6.1/purchase_orders Headers: X-API-KEY: Cookie: Query Parameters: fields: string (comma-separated list of fields to retrieve) filtering[status:eq]: int (filter by order status, e.g., 1 for confirmed) limit: int (number of records to retrieve) offset: int (starting position for pagination) sort: string (field to sort by, e.g., order_date) direction: string (sort direction: asc or desc) ``` -------------------------------- ### Get Opportunities List Source: https://developer.getfly.vn/docs/6.1/opportunity/list This snippet shows how to retrieve a list of opportunities from the GetFly CRM API. It specifies the endpoint and includes an example of how to make the request using cURL, including necessary API key and session token headers. ```HTTP GET /api/v6.1/opportunities ``` ```shell curl --location --globoff 'https://demo.getflycrm.com/api/v6.1/opportunities?fields=id%2Copportunity_name%2Copportunity_code%2Cprobability%2Copportunity_status%2Copportunity_status_name%2Crecipient%2Crcpt_avatar%2Crcpt_display_name%2Crcpt_role_name%2Crcpt_department_name%2Ccreated_at%2Ctime_registed%2Cresponsible%2Cc_display_name%2Ccreate_user%2Caccount_id%2Caccount_name%2Cphone_office%2Caccount_email%2Ccampaign_id%2Ccampaign_name&filtering[campaign_code]=CD0008' \ --header 'X-API-KEY: YOUR_API_KEY' \ --header 'Cookie: v6_getflycrm_session=YOUR_SESSION_TOKEN' ``` -------------------------------- ### Custom Fields Example Source: https://developer.getfly.vn/docs/6.1/needed_info This example demonstrates how to include custom fields in an API request. It shows a JSON object where 'custom_fields' holds user-defined data that is not part of the standard system fields. ```JSON { "custom_fields": { "custom_field_1": "info 1" } } ``` -------------------------------- ### GetFly API v6.1 Tasks Response Structure Source: https://developer.getfly.vn/docs/6.1/task/list Example JSON response structure for the GetFly API v6.1 tasks endpoint. It includes a list of tasks with detailed fields, pagination information, and sorting details. ```json { "data": [ { "id": 92, "task_code": "CVI/2025-02/0076", "task_name": "aaa", "task_start_date": "2025-02-25 09:33:50", "task_end_date": "2025-02-25 10:33:50", "notifications_count": 0, "task_status": 11, "task_progress": 0, "user_important": 0, "task_receiver": 2, "task_receiver_display_name": "Người nhận công việc", "task_receiver_email": "email@example.com", "task_receiver_phone": "", "task_receiver_avatar": "https://example.com/avatar.png...", "task_color": "", "project_id": 1, "project_name": "Công việc", "task_status_title": "Còn 1 ngày", "task_accounts": [] } ], "has_more": true, "offset": 0, "limited": 5, "sorted": { "task_start_date": "DESC" } } ``` -------------------------------- ### Get Campaign Details using cURL Source: https://developer.getfly.vn/docs/6.1/campaign/detail This snippet demonstrates how to retrieve detailed information for a specific campaign using the cURL command. It specifies the API endpoint, required fields, and authentication headers. ```shell curl --location 'https://demo.getflycrm.com/api/v6.1/campaign?fields=id%2Ccampaign_code%2Ccampaign_name%2Ccreate_user%2Cresponsible%2Ctime_registed%2Callow_duplicate_opp%2Copportunity_status%2Crelated_users%2Cis_lock&campaign_code=CD_OAN' \ --header 'X-API-KEY: ADP8QgZR2f0dd6ryjfrXQhtM38Z7MP' ``` -------------------------------- ### Create Product API Headers Source: https://developer.getfly.vn/docs/6.1/product/create This snippet details the necessary headers for the Create Product API request, including Content-Type and API Key. ```json { "Content-Type": "application/json", "X-API-KEY": "{your_api_key}" } ``` -------------------------------- ### Create Product API Endpoint Source: https://developer.getfly.vn/docs/6.1/product/create This snippet shows the HTTP method and endpoint for creating a new product via the Getfly API. ```http POST /api/v6.1/product ``` -------------------------------- ### Get Task Details API Request Source: https://developer.getfly.vn/docs/6.1/task/detail This snippet shows how to make a GET request to the /api/v6.1/task endpoint to retrieve detailed information about a specific task. It includes the necessary API key in the headers and the task code as a query parameter. ```curl curl --location 'https://xxx.getflycrm.com/api/v6.1/task?fields=id%2Ctask_code%2Ctask_name%2Ctask_start_date%2Ctask_end_date%2Ctask_status%2Ctask_receiver_display_name%2Cproject_name&task_code=CVI%2F2025-02%2F0075' \ --header 'X-API-KEY: ' ``` -------------------------------- ### Sample Response for Campaign Update Source: https://developer.getfly.vn/docs/6.1/campaign/update This JSON snippet shows a sample response after successfully updating a campaign. It includes the updated campaign details such as ID, name, code, description, and other related information. The `message` field indicates the success of the operation. ```json { "message": "Cập nhật thành công", "data": { "id": 29, "campaign_name": "Chiến dịch nhìn ngày nhìn mưa vội vàng", "campaign_code": "YEUDIMA2", "description": "Nhìn ngày nhìn mưa vội vàng,...ai ngập tràn", "time_registed": 0, "auto_divide_opp": 1, "hide_info": 0, "is_lock": 0, "allow_duplicate_opp": 1, "opportunity_status": [ { "status_id": 51, "name": "Đi gặp chào nhau cái", "order": 1 }, { "status_id": 52, "name": "Lấy đầy đủ thông tin của nhau", "order": 2 }, { "status_id": 53, "name": "Trò chuyện thân thiết", "order": 3 }, { "status_id": 54, "name": "Tham dò đối phương, chờ tín hiệu", "order": 4 }, { "status_id": 55, "name": "Tỏ tềnh hêhehehehe", "order": 5 } ], "responsible": 1, "related_users": [ { "accept_opp": 1, "user_id": 2 }, { "accept_opp": 1, "user_id": 1 }, { "accept_opp": 0, "user_id": 4 } ], "updated_at": 1751013215, "created_at": 1751012986, "create_user": 1, "token_api": "GQKeucYQgm", "topic_id": 29, "project_id": null, "campaign_divide_condition": null } } ``` -------------------------------- ### API Request Headers Source: https://developer.getfly.vn/docs/6.1/product/list This snippet outlines the necessary headers for making requests to the Getfly API v6.1. It specifies the 'Content-Type' as 'application/json' and requires an 'X-API-KEY' for authentication. ```JSON { "Content-Type": "application/json", "X-API-KEY": "{your_api_key}" } ``` -------------------------------- ### Headers dùng chung cho API Source: https://developer.getfly.vn/docs/6.1/purchase-order/others Các headers cần thiết để xác thực và gửi yêu cầu đến các API quản lý đơn hàng. ```http Content-Type: application/json X-API-KEY: Cookie: ``` -------------------------------- ### Lấy danh sách Ticket (API) Source: https://developer.getfly.vn/docs/6.1/ticket/list API này dùng để lấy danh sách các phiếu hỗ trợ (ticket) từ hệ thống CRM. Yêu cầu phương thức GET với header X-API-KEY và có thể tùy chọn các trường dữ liệu qua query parameter 'fields'. ```http GET /api/v6.1/tickets --header 'X-API-KEY: ' ?fields=id,ticket_title,ticket_code,ticket_content,cate_id,emergency_phone,account_id,account_name,custom_fields ``` -------------------------------- ### Ví dụ cURL để lấy danh sách Ticket Source: https://developer.getfly.vn/docs/6.1/ticket/list Ví dụ sử dụng cURL để gọi API lấy danh sách ticket. Bao gồm URL endpoint, phương thức GET, và header xác thực API key. Các trường dữ liệu có thể được chỉ định trong query parameter. ```bash curl --location 'https:///api/v6.1/tickets?fields=id,ticket_title,ticket_code,ticket_content,cate_id,emergency_phone,account_id,account_name,custom_fields' \ --header 'X-API-KEY: ' ``` -------------------------------- ### Lấy danh sách đơn hàng bán (GET /api/v6.1/sale_orders) Source: https://developer.getfly.vn/docs/6.1/sale-order/list Sử dụng phương thức GET với endpoint `/api/v6.1/sale_orders` để lấy danh sách các đơn hàng bán. Yêu cầu xác thực bằng `X-API-KEY` trong header. Có thể tùy chỉnh kết quả bằng các tham số lọc, sắp xếp và phân trang. ```HTTP GET /api/v6.1/sale_orders Host: your_getfly_domain.com X-API-KEY: ```