پرش به مطلب اصلی

Create Service Group API

POST /createServiceGroup

Description

This API endpoint allows users to create a new service group with specific attributes such as name, description, language, and various discount tiers. It also allows configuration of gateways and geolocation restrictions.

A service group in your platform is a logical grouping or categorization of services that share common attributes, settings, or features. By organizing services into service groups, you can manage and control these services more efficiently and uniformly. Each service group can dictate specific aspects of the services it contains, such as discounts, geolocation restrictions, and available gateways, thereby allowing for customized user experiences and operational flexibility.

Key Aspects of Service Groups:

  1. Discount Management:

    • Service groups allow you to apply discounts across multiple services within the group. Different discount tiers (e.g., 3-month, 6-month, 12-month) can be set to provide incentives for longer commitments. This way, if you want to offer a promotional discount or adjust pricing, you can do it at the group level rather than individually for each service.
  2. Localization and Language:

    • Services within a group can be tailored for specific languages and regions. By setting the language attribute, the service group ensures that all services within it are provided in the appropriate language, which is critical for reaching diverse user bases.
  3. Geolocation Restrictions:

    • Service groups can control where certain services are available by defining allowed and disallowed geolocations. This is useful for complying with regional regulations, tailoring services to local markets, or restricting access based on the user's location.
  4. Gateways and Access Control:

    • A service group can also define which payment gateways or access points are available to the services within it. This ensures that only the preferred or required gateways are used, simplifying transaction processing and ensuring compliance with any regional or operational requirements.
  5. Feature Control and Customization:

    • By assigning a service to a specific group, you can control and customize features that are enabled or disabled within that service. For instance, one group might have enhanced security features enabled, while another might offer additional storage options. This modular approach allows for greater flexibility and scalability, making it easier to introduce new features or modify existing ones without affecting the entire platform.
  6. Operational Efficiency:

    • Service groups streamline the management of multiple services by allowing administrators to make bulk updates and enforce consistency across all services within a group. This reduces the complexity of managing services on an individual basis and helps maintain a uniform user experience across different services.

In essence, service groups serve as a powerful tool for organizing and managing services in a way that is efficient, scalable, and customizable, providing you with granular control over how each service operates within your platform.

Request Body

The request utilizes GraphQL to perform the createServiceGroup mutation.

Mutation:

mutation createServiceGroup ($serviceGroup: ServiceGroupEdit!) {
createServiceGroup (serviceGroup: $serviceGroup) {
id
name
description
language
discount
discount3
discount6
discount12
discount24
discount36
discountLifetime
}
}

Variables:

{
"serviceGroup": {
"name": "<Service_Group_Name>",
"description": "<Service_Group_Description>",
"language": "<Language_Code>",
"discount": "<Base_Discount>",
"discount3": "<3_Month_Discount>",
"discount6": "<6_Month_Discount>",
"discount12": "<12_Month_Discount>",
"discount24": "<24_Month_Discount>",
"discount36": "<36_Month_Discount>",
"discountLifetime": "<Lifetime_Discount>",
"gateways": [0],
"allowedGeolocations": [0],
"disAllowedGeolocations": [0]
}
}
  • serviceGroup (ServiceGroupEdit Object): An object containing the service group details.
    • name (String): The name of the service group.
    • description (String): A description of the service group.
    • language (String): The language code in which the service group is offered.
    • discount (String): The base discount applied to the service group.
    • discount3 (String): The discount applied for a 3-month subscription.
    • discount6 (String): The discount applied for a 6-month subscription.
    • discount12 (String): The discount applied for a 12-month subscription.
    • discount24 (String): The discount applied for a 24-month subscription.
    • discount36 (String): The discount applied for a 36-month subscription.
    • discountLifetime (String): The discount applied for a lifetime subscription.
    • gateways (Array): An array of gateway IDs associated with the service group.
    • allowedGeolocations (Array): An array of allowed geolocation IDs for the service group.
    • disAllowedGeolocations (Array): An array of disallowed geolocation IDs for the service group.

Response:

  • Success (200 OK):

    {
    "data": {
    "createServiceGroup": {
    "id": "<Service_Group_ID>",
    "name": "<Service_Group_Name>",
    "description": "<Service_Group_Description>",
    "language": "<Language_Code>",
    "discount": "<Base_Discount>",
    "discount3": "<3_Month_Discount>",
    "discount6": "<6_Month_Discount>",
    "discount12": "<12_Month_Discount>",
    "discount24": "<24_Month_Discount>",
    "discount36": "<36_Month_Discount>",
    "discountLifetime": "<Lifetime_Discount>"
    }
    }
    }
    • id (String): The unique identifier of the created service group.
    • name (String): The name of the service group.
    • description (String): The description of the service group.
    • language (String): The language code in which the service group is offered.
    • discount (String): The base discount applied to the service group.
    • discount3 (String): The discount applied for a 3-month subscription.
    • discount6 (String): The discount applied for a 6-month subscription.
    • discount12 (String): The discount applied for a 12-month subscription.
    • discount24 (String): The discount applied for a 24-month subscription.
    • discount36 (String): The discount applied for a 36-month subscription.
    • discountLifetime (String): The discount applied for a lifetime subscription.
  • Error (4XX/5XX):

    • Appropriate error messages and status codes will be returned in cases of invalid data, missing required fields, or server errors.

Note:

Ensure that all required fields are provided and correctly formatted. The service group configuration should align with the platform's specifications, particularly in terms of geolocation restrictions and associated gateways.