{
  "info": {
    "name": "Zal Pro API Collection",
    "description": "Official Zal Pro ISP CRM API collection. Set the collection variables (baseUrl, api_username, api_password) after importing. All requests use HTTP Basic Auth inherited from the collection.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "basic",
    "basic": [
      { "key": "username", "value": "{{api_username}}", "type": "string" },
      { "key": "password", "value": "{{api_password}}", "type": "string" }
    ]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://your-domain.com", "type": "string" },
    { "key": "api_username", "value": "your_api_username", "type": "string" },
    { "key": "api_password", "value": "your_api_password", "type": "string" }
  ],
  "item": [
    {
      "name": "Subscribers",
      "item": [
        {
          "name": "Fetch Subscribers",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/api/user/users?limit=50",
              "host": ["{{baseUrl}}"],
              "path": ["api", "user", "users"],
              "query": [
                { "key": "limit", "value": "50" },
                { "key": "offset", "value": "0", "disabled": true },
                { "key": "username", "value": "", "disabled": true },
                { "key": "package_id", "value": "", "disabled": true },
                { "key": "connection_status", "value": "", "disabled": true }
              ]
            },
            "description": "Fetch subscribers. All query parameters are optional filters."
          }
        },
        {
          "name": "Create Subscriber",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "post_type", "value": "1" },
                { "key": "isp_id", "value": "1" },
                { "key": "name", "value": "John Doe" },
                { "key": "username", "value": "john123" },
                { "key": "password", "value": "Secret123" },
                { "key": "package_id", "value": "5" },
                { "key": "connection_type_id", "value": "1" },
                { "key": "salesperson_id", "value": "3" },
                { "key": "nas_id", "value": "2" },
                { "key": "nic_number", "value": "1990123456789" },
                { "key": "mobile_number", "value": "01710000000" },
                { "key": "phone_number", "value": "", "disabled": true },
                { "key": "email", "value": "", "disabled": true },
                { "key": "address", "value": "", "disabled": true }
              ]
            },
            "url": {
              "raw": "{{baseUrl}}/api/user/users",
              "host": ["{{baseUrl}}"],
              "path": ["api", "user", "users"]
            },
            "description": "Create a subscriber (post_type=1)."
          }
        },
        {
          "name": "Update Subscriber",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "post_type", "value": "2" },
                { "key": "username", "value": "john123" },
                { "key": "isp_id", "value": "1" },
                { "key": "name", "value": "John A. Doe" },
                { "key": "password", "value": "Secret123" },
                { "key": "package_id", "value": "6" },
                { "key": "connection_type_id", "value": "1" },
                { "key": "salesperson_id", "value": "3" },
                { "key": "nas_id", "value": "2" },
                { "key": "nic_number", "value": "1990123456789" },
                { "key": "mobile_number", "value": "01710000000" }
              ]
            },
            "url": {
              "raw": "{{baseUrl}}/api/user/users",
              "host": ["{{baseUrl}}"],
              "path": ["api", "user", "users"]
            },
            "description": "Update an existing subscriber (post_type=2). Keyed by username."
          }
        }
      ]
    },
    {
      "name": "Tickets",
      "item": [
        {
          "name": "Fetch Tickets",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/api/ticket/ticket",
              "host": ["{{baseUrl}}"],
              "path": ["api", "ticket", "ticket"],
              "query": [
                { "key": "status", "value": "", "disabled": true },
                { "key": "priority", "value": "", "disabled": true },
                { "key": "user_id", "value": "", "disabled": true },
                { "key": "ticket_category", "value": "", "disabled": true }
              ]
            },
            "description": "Fetch tickets. All query parameters are optional filters."
          }
        },
        {
          "name": "Create Ticket",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "post_type", "value": "1" },
                { "key": "title", "value": "No internet since morning" },
                { "key": "user_id", "value": "1024" },
                { "key": "admin_id", "value": "2" },
                { "key": "user_type", "value": "1" },
                { "key": "assign_to", "value": "4" },
                { "key": "priority", "value": "2" },
                { "key": "status", "value": "1" },
                { "key": "ticket_category", "value": "3" },
                { "key": "description", "value": "Customer reports full outage." }
              ]
            },
            "url": {
              "raw": "{{baseUrl}}/api/ticket/ticket",
              "host": ["{{baseUrl}}"],
              "path": ["api", "ticket", "ticket"]
            },
            "description": "Create a ticket (post_type=1). assign_to is required when user_type=1."
          }
        },
        {
          "name": "Update Ticket",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "post_type", "value": "2" },
                { "key": "ticket_id", "value": "58" },
                { "key": "title", "value": "No internet since morning" },
                { "key": "user_type", "value": "1" },
                { "key": "user_id", "value": "1024" },
                { "key": "assign_to", "value": "4" },
                { "key": "priority", "value": "2" },
                { "key": "status", "value": "2" },
                { "key": "ticket_category", "value": "3" },
                { "key": "description", "value": "Technician dispatched." }
              ]
            },
            "url": {
              "raw": "{{baseUrl}}/api/ticket/ticket",
              "host": ["{{baseUrl}}"],
              "path": ["api", "ticket", "ticket"]
            },
            "description": "Update a ticket (post_type=2). Keyed by ticket_id."
          }
        },
        {
          "name": "Delete Ticket",
          "request": {
            "method": "DELETE",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/api/ticket/ticket/58",
              "host": ["{{baseUrl}}"],
              "path": ["api", "ticket", "ticket", "58"]
            },
            "description": "Delete a ticket by ID."
          }
        },
        {
          "name": "Update Ticket Status",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "ticket_id", "value": "58" },
                { "key": "status", "value": "3" }
              ]
            },
            "url": {
              "raw": "{{baseUrl}}/api/ticket/status",
              "host": ["{{baseUrl}}"],
              "path": ["api", "ticket", "status"]
            },
            "description": "Change only the status of a ticket."
          }
        },
        {
          "name": "Reply to Ticket",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "ticket_id", "value": "58" },
                { "key": "user_type", "value": "1" },
                { "key": "user_id", "value": "2" },
                { "key": "comment", "value": "We have dispatched a technician." }
              ]
            },
            "url": {
              "raw": "{{baseUrl}}/api/ticket/reply",
              "host": ["{{baseUrl}}"],
              "path": ["api", "ticket", "reply"]
            },
            "description": "Add a reply/comment to a ticket."
          }
        }
      ]
    }
  ]
}
