### Installing yclients-api Python Library Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Command to install the `yclients-api` Python package using pip. This is the first step to use the library. ```Shell pip install yclients-api ``` -------------------------------- ### Get Services Info - Yclients API Python Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Fetches a list of services available, potentially filtered by staff ID. The example extracts a service ID from the response. ```python services = api.get_services(staff_id=staff_id) print(services) service_id = services['data']['services'].get('id') ``` -------------------------------- ### Example Payload for Booking Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This JSON snippet provides an example of the data structure that might be sent as the request body when booking an appointment via the API. It includes customer contact information, an optional verification code, comments, notification preferences, and an array detailing the specific appointments being booked, including services, staff, datetime, and custom fields. ```json { "phone": "79000000000", "fullname": "ДИМА", "email": "d@yclients.com", "code": "38829", "comment": "тестовая запись!", "type": "mobile", "notify_by_sms": 6, "notify_by_email": 24, "api_id": "777", "appointments": [ { "id": 1, "services": [ 331 ], "staff_id": 6544, "datetime": 1443517200, "custom_fields": { "my_custom_field": 123, "some_another_field": [ "first value", "next value" ] } }, { "id": 2, "services": [ 99055 ], "staff_id": 6544, "datetime": 1443614400, "custom_fields": { "my_custom_field": 456, "some_another_field": [ "next value", "last value" ] } } ] } ``` -------------------------------- ### Get Booking Dates - Yclients API Python Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Retrieves available booking dates for a specific staff member and service. The example attempts to get the booking dates from the response data. ```python booking_days = api.get_available_days(staff_id=staff_id, service_id=service_id) print(booking_days) day = booking_days['data'].get('booking_dates') # or .get('booking_days') ``` -------------------------------- ### Get Staff Info - Yclients API Python Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Retrieves a list of staff members. The example then attempts to extract a staff ID from the response data. ```python all_staff = api.get_staff() print(all_staff) staff_id = all_staff['data'].get('id') ``` -------------------------------- ### Example Response for Booking Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This JSON snippet shows the structure of the response received after successfully booking an appointment. It typically includes a list of booked items, each with an internal ID, the record ID from the Yclients system, and a record hash. ```json { "success": true, "data": [ { "id": 1, "record_id": 2820023, "record_hash": "567df655304da9b98487769426d4e76e" }, { "id": 2, "record_id": 2820024, "record_hash": "34a45ddabdd446d5d33bdd27fbf855b2" } ], "meta": [] } ``` -------------------------------- ### Example Response for Available Times Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This JSON snippet shows the typical structure of the response returned by the `get_available_times` API call. It includes a list of available time slots, each with the time, seance length, and datetime timestamp. ```json { "success": true, "data": [ { "time": "12:00", "seance_length": 3600, "datetime": 1443513600 }, { "time": "13:00", "seance_length": 3600, "datetime": 1443517200 }, { "time": "14:00", "seance_length": 3600, "datetime": 1443520800 }, { "time": "15:00", "seance_length": 3600, "datetime": 1443524400 }, { "time": "16:00", "seance_length": 3600, "datetime": 1443528000 } ], "meta": [] } ``` -------------------------------- ### Get Client Visits using YCLIENTS API (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This snippet demonstrates how to retrieve visit records for a specific client using the YCLIENTS API Python client. The API returns visits in paginated groups, with a maximum size of 200 visits per page. The example fetches visits for a client ID and prints the results using pandas DataFrame. ```python cid = 20419758 client_visits = api.get_visits_for_client(cid) print(f'Client {cid} visits') print(f'{pd.DataFrame(client_visits)}') ``` -------------------------------- ### Get All Visits for All Clients (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Retrieves all visit data for a list of client IDs using the API client and prints the results formatted as pandas DataFrames for each client. ```python all_clients_visits = api.get_visits_data_for_clients_list(all_clients_ids) for cid in all_clients_visits.keys(): print(f'Client {cid} visits') print(f'{pd.DataFrame(all_clients_visits[cid])}') ``` -------------------------------- ### Getting User Token from YClients API (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Demonstrates how to obtain a user authentication token from the YClients API using a login (email) and password. This token can be saved and reused for subsequent API requests. ```python login = "example@gmail.com" password = "password" user_token = api.get_user_token(login, password) ``` -------------------------------- ### Get Attended Visits Information for Clients (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Retrieves summarized information about attended visits for a list of client IDs using the API client and prints the resulting pandas DataFrame. ```python df = api.get_attended_visits_dates_information(all_clients_ids) print(f'Attended visits dataframe: {df}') ``` -------------------------------- ### Get Attended Visits for Specific Client (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Fetches only the attended visits for a single client specified by their ID using the API client and prints the result as a pandas DataFrame. ```python cid = 20419758 client_visits = api.get_attended_visits_for_client(cid) print(f'Client {cid} attended visits') print(f'{pd.DataFrame(client_visits)}') ``` -------------------------------- ### Get Clients List from YCLIENTS API (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Retrieves a list of clients from the YCLIENTS API using the `get_clients_data` method of the API object. The API returns clients in paginated groups, typically up to 200 per page. The result is stored in the `clients_data_list` variable. ```python clients_data_list = api.get_clients_data() ``` -------------------------------- ### YCLIENTS API Get Client Visits Response Structure (JSON) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This JSON snippet shows the expected structure of the response data when retrieving client visits from the YCLIENTS API. It includes details about individual visits, associated staff, services, goods transactions, documents, and other relevant information. ```json { "success": true, "data": [ { "id": 2, "company_id": 4564, "staff_id": 9, "services": [ { "id": 1, "title": "Наращивание волос", "cost": 100, "manual_cost": 100, "cost_per_unit": 100, "discount": 0, "first_cost": 100, "amount": 1 } ], "goods_transactions": [], "staff": { "id": 9, "name": "Оксана", "specialization": "наращивание волос", "position": { "id": 1, "title": "Администратор" }, "avatar": "http://yclients.com/images/no-master-sm.png", "avatar_big": "http://yclients.com/images/no-master.png", "rating": 0, "votes_count": 0 }, "date": 1547654400, "datetime": 1547622000, "create_date": "2019-01-16T20:35:11+0900", "comment": "не записывать", "online": false, "visit_attendance": 0, "attendance": 0, "confirmed": 1, "seance_length": 3600, "length": 3600, "sms_before": 0, "sms_now": 0, "sms_now_text": "", "email_now": 0, "notified": 0, "master_request": 0, "api_id": "", "from_url": "", "review_requested": 0, "visit_id": "8262996", "created_user_id": 1073232, "deleted": false, "paid_full": 0, "prepaid": false, "prepaid_confirmed": false, "last_change_date": "2019-01-16T20:35:15+0900", "custom_color": "", "custom_font_color": "", "record_labels": [], "activity_id": 0, "custom_fields": [], "documents": [ { "id": 8172893, "type_id": 7, "storage_id": 0, "user_id": 746310, "company_id": 4564, "number": 4163, "comment": "", "date_created": 1530615600, "category_id": 0, "visit_id": 3, "record_id": 2, "type_title": "Визит" } ], "sms_remain_hours": 5, "email_remain_hours": 1, "bookform_id": 0, "record_from": "", "is_mobile": 0, "is_sale_bill_printed": false, "consumables": [], "finance_transactions": [] }, { "id": 9, "company_id": 4564, "staff_id": 49, "services": [], "goods_transactions": [], "staff": { "id": 49, "name": "Сергей", "specialization": "стилист", "position": { "id": 1, "title": "Администратор" }, "avatar": "http://yclients.com/images/no-master-sm.png", "avatar_big": "http://yclients.com/images/no-master.png", "rating": 0, "votes_count": 0 }, "date": 1547654400, "datetime": 1547622000, "create_date": "2019-01-16T20:35:11+0900", "comment": "", "online": true, "visit_attendance": 1, "attendance": 1, "confirmed": 1, "seance_length": 10800, "length": 10800, "sms_before": 0, "sms_now": 0, "sms_now_text": "", "email_now": 0, "notified": 0, "master_request": 1, "api_id": "", "from_url": "", "review_requested": 0, "visit_id": "8262996", "created_user_id": 1073232, "deleted": false, "paid_full": 0, "prepaid": false, "prepaid_confirmed": false, "last_change_date": "2017-01-09T20:45:30+0900", "custom_color": "f44336", "custom_font_color": "#ffffff", "record_labels": [ { "id": "67345", "title": "Сотрудник не важен", "color": "#009800", "icon": "unlock", "font_color": "#ffffff" }, { "id": "104474", "title": "важная категория", "color": "#3b2c54", "icon": "odnoklassniki", "font_color": "#ffffff" } ], "activity_id": 0, "custom_fields": [], "documents": [ { "id": 8172893, "type_id": 7, "storage_id": 0, "user_id": 746310, "company_id": 4564, "number": 4163, "comment": "", "date_created": 1530615600, "category_id": 0, "visit_id": 3, "record_id": 2, "type_title": "Визит" } ], "sms_remain_hours": 5, "email_remain_hours": 1, "bookform_id": 0, "record_from": "", "is_mobile": 0, "is_sale_bill_printed": false, } ] } ``` -------------------------------- ### Creating YClientsAPI Client Object in Python Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Demonstrates how to import the `YClientsAPI` class and create an instance of the API client. Requires a token, company ID, and form ID for initialization. ```Python from yclients import YClientsAPI TOKEN = "your token" СID = 'your company id' FID = 'form id' api = YClientsAPI(token=TOKEN, company_id=СID, form_id=FID) ``` -------------------------------- ### Book an Appointment (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This Python snippet demonstrates how to use the `book` method to create a new appointment. It requires various parameters including customer details (fullname, phone, email), service and staff IDs, the selected date and time, and an optional comment. ```python booked, message = api.book(booking_id=0, fullname='my name', phone='53425345', email='myemail@email.com, service_id=service_id, date_time=date_time, staff_id=staff_id, comment='some comment') ``` -------------------------------- ### Enabling Debugging for YClientsAPI Client in Python Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Shows how to call the `show_debugging()` method on the `YClientsAPI` instance to enable debugging output. ```Python api.show_debugging() ``` -------------------------------- ### Project Dependencies - Python Source: https://github.com/coolmixzero/yclients-api-python/blob/main/requirements.txt This snippet lists the core Python packages and their exact versions required for the project to run. The comments indicate compatibility requirements for Python versions and suggest alternative packages for older Python versions. ```Python aiogram==2.21 httpx==0.23.0 instaloader==4.9.2 pandas==1.3.5 pendulum==2.1.2 ujson==5.4.0 ``` -------------------------------- ### Showing User Permissions via YClients API (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Illustrates how to call the API method to retrieve and display the current user's permissions within the YClients system. This provides details on what actions the user is authorized to perform. ```python api.show_user_permissions() ``` -------------------------------- ### Display Client ID, Name, and Visits (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Prints specific columns ('id', 'name', 'visits') from the parsed client data DataFrame (`df`). This demonstrates how to access and display selected information for all clients. ```python print(df[['id', 'name', 'visits']]) ``` -------------------------------- ### Retrieve Available Time Slots (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This snippet calls the `get_available_times` method of the Yclients API client to fetch available time slots for a specific staff member, service, and date. It then shows how to print the response and extract the `time` or `datetime` value from the returned data. ```python time_slots = api.get_available_times(staff_id=staff_id, service_id=service_id, day=day) print(time_slots) date_time = time_slots['data'].get('time') # or .get('datetime') ``` -------------------------------- ### Updating API Authorization with User Token (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Shows how to update the authorization parameters of the API class instance with the previously obtained user token. This token is required in the headers of subsequent requests to authenticate the user. ```python api.update_user_token(user_token) ``` -------------------------------- ### Yclients API Access Permissions JSON Structure Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md This JSON object snippet illustrates the structure used to configure granular access permissions for different modules and actions within the Yclients API. Permissions are typically boolean flags, while some settings like `last_days_count` or `ids` use numeric or array values. ```JSON "finances_period_report_access": true, "finances_period_report_excel_access": true, "finances_year_report_access": true, "finances_year_report_excel_access": true, "finances_print_check_access": true, "finances_z_report_access": true, "finances_z_report_no_limit_today_access": true, "finances_z_report_excel_access": true }, "clients": { "clients_access": true, "client_phones_access": true, "clients_phones_email_access": true, "clients_card_phone_access": true, "clients_delete_access": true, "clients_excel_access": true, "excel_access": true, "client_comments_list_access": true, "client_comments_add_access": true, "client_comments_own_edit_access": true, "client_comments_other_edit_access": true, "client_files_list_access": true, "client_files_upload_access": true, "client_files_delete_access": true, "clients_visit_master_id": 0, "get_visit_master_id": 0 }, "dashboard": { "dashboard_access": true, "dash_access": true, "dash_phones_access": true, "dash_records_access": true, "dash_records_last_days_count": -1, "dash_records_excel_access": true, "dash_records_phones_access": true, "dash_message_access": true, "dash_message_excel_access": true, "dash_message_phones_access": true, "dash_reviews_access": true, "dash_reviews_delete_access": true, "dashboard_calls_access": true, "dashboard_calls_excel_access": true, "dashboard_calls_phones_access": true }, "notification": { "notification": true, "web_push": true, "web_phone_push": true, "notification_sms_ending_license": true, "notification_sms_low_balance": true, "notification_email_ending_license": true }, "loyalty": { "loyalty_access": true, "has_loyalty_access": true, "loyalty_cards_manual_transactions_access": true, "has_loyalty_cards_manual_transactions_access": true, "loyalty_certificate_and_abonement_manual_transactions_access": true }, "storages": { "storages_access": true, "storages_ids": [], "storages_transactions_access": true, "storages_last_days_count": -1, "storages_move_goods_access": true, "storages_create_transactions_access": true, "storages_create_last_days_count": -1, "storages_create_transactions_buy_access": true, "storages_create_transactions_sale_access": true, "storages_edit_transactions_access": true, "storages_edit_last_days_count": -1, "storages_edit_transactions_buy_access": true, "storages_edit_transactions_sale_access": true, "storages_delete_transactions_access": true, "storages_transactions_excel_access": true, "storages_transactions_types": [], "storages_inventory_access": true, "storages_inventory_create_edit_access": true, "storages_inventory_delete_access": true, "storages_inventory_excel_access": true, "storages_remnants_report_access": true, "storages_remnants_report_excel_access": true, "storages_sales_report_access": true, "storages_sales_report_excel_access": true, "storages_consumable_report_access": true, "storages_consumable_report_excel_access": true, "storages_write_off_report_access": true, "storages_write_off_report_excel_access": true, "storages_turnover_report_access": true, "storages_turnover_report_excel_access": true, "storages_goods_crud_access": true, "storages_goods_create_access": true, "storages_goods_update_access": true, "storages_goods_title_edit_access": true, "storages_goods_category_edit_access": true, "storages_goods_selling_price_edit_access": true, "storages_goods_cost_price_edit_access": true, "storages_goods_units_edit_access": true, "storages_goods_critical_balance_edit_access": true, "storages_goods_masses_edit_access": true, "storages_goods_comment_edit_access": true, "storages_goods_archive_access": true, "storages_goods_delete_access": true }, "settings": { "settings_access": true, "settings_basis_access": true, "settings_information_access": true, "users_access": true, "delete_users_access": true, "create_users_access": true, "edit_users_access": true, "limited_users_access": false, "settings_services_access": true, "settings_services_create_access": true, "services_edit": true, "settings_services_edit_title_access": true, "settings_services_relation_category_access": true, "settings_services_edit_price_access": true, "settings_services_edit_image_access": true, "settings_services_edit_online_seance_date_time_access": true, "settings_services_edit_online_pay_access": true, ``` -------------------------------- ### Parse Raw Client Data (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Parses the raw client data obtained from the API (e.g., using `get_clients_data`) into a structured format, likely a pandas DataFrame. This makes the data easier to manipulate and analyze. The parsed data is assigned to the `df` variable. ```python df = api.parse_clients_data(clients_data_list) ``` -------------------------------- ### Extract All Client IDs (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Extracts the 'id' column from the parsed client data DataFrame (`df`) and converts it into a Python list. This creates a list containing the IDs of all clients in the dataset. ```python all_clients_ids = list(df['id']) ``` -------------------------------- ### Filter Attended Visits Dataframe (Python) Source: https://github.com/coolmixzero/yclients-api-python/blob/main/README.md Filters a pandas DataFrame containing attended visit information to show only clients who have at least one visit (visits_number > 0). ```python print(f"Attended visits ndataframe with no gaps {df[df['visits_number']>0]}") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.