Evo Voice

<back to all web services

NewCustomer

Creates a new customer

Requires Authentication
Requires any of the roles:SystemAdministrator, Manager, Customer
The following routes are available for this service:
POST/customers
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EntityInfo:
    # @ApiMember(Description="The ID of the object")
    id: Optional[str] = None
    """
    The ID of the object
    """


    # @ApiMember(Description="The date the object was created")
    date_created: Optional[str] = None
    """
    The date the object was created
    """


    # @ApiMember(Description="The date the object was last modified")
    date_last_modified: Optional[str] = None
    """
    The date the object was last modified
    """


    # @ApiMember(Description="The user that created this object")
    created_by: Optional[str] = None
    """
    The user that created this object
    """


    # @ApiMember(Description="The user that last modified this object")
    last_modified_by: Optional[str] = None
    """
    The user that last modified this object
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerBreadcrumb:
    id: Optional[str] = None
    name: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Value:
    bool_value: Optional[bool] = None
    string_value: Optional[str] = None
    number_value: Optional[float] = None
    list_value: Optional[List[Struct]] = None
    struct_value: Optional[Struct] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Struct(Dict[str,Value]):
    pass


class TagColors(str, Enum):
    MAGENTA = 'Magenta'
    RED = 'Red'
    VOLCANO = 'Volcano'
    ORANGE = 'Orange'
    GOLD = 'Gold'
    LIME = 'Lime'
    GREEN = 'Green'
    CYAN = 'Cyan'
    BLUE = 'Blue'
    GEEK_BLUE = 'GeekBlue'
    PURPLE = 'Purple'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Tag:
    id: Optional[str] = None
    name: Optional[str] = None
    color: Optional[TagColors] = None


class SimpleSchedulingRuleTypes(str, Enum):
    ALWAYS = 'Always'
    CUSTOMER_STATE = 'CustomerState'
    TIME = 'Time'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ScheduleDay:
    offset: Optional[int] = None
    day_of_week: Optional[DayOfWeek] = None


class SchedulingRuleFrequency(str, Enum):
    NONE = 'None'
    SECONDLY = 'Secondly'
    MINUTELY = 'Minutely'
    HOURLY = 'Hourly'
    DAILY = 'Daily'
    WEEKLY = 'Weekly'
    MONTHLY = 'Monthly'
    YEARLY = 'Yearly'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SchedulingRule:
    id: Optional[str] = None
    name: Optional[str] = None
    priority: Optional[int] = None
    state: Optional[str] = None
    source: Optional[str] = None
    condition: Optional[str] = None
    simple_rule_type: Optional[SimpleSchedulingRuleTypes] = None
    customer_state: Optional[str] = None
    flow_id: Optional[str] = None
    flow_params: Optional[Struct] = None
    is_all_day: Optional[bool] = None
    start_date: Optional[str] = None
    start_time: Optional[str] = None
    end_time: Optional[str] = None
    by_set_position: Optional[List[int]] = None
    by_month: Optional[List[int]] = None
    by_week_no: Optional[List[int]] = None
    by_year_day: Optional[List[int]] = None
    by_month_day: Optional[List[int]] = None
    by_day: Optional[List[ScheduleDay]] = None
    by_hour: Optional[List[int]] = None
    by_minute: Optional[List[int]] = None
    interval: Optional[int] = None
    count: Optional[int] = None
    until_date: Optional[str] = None
    frequency: Optional[SchedulingRuleFrequency] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Schedule:
    time_zone_id: Optional[str] = None
    inherit: Optional[bool] = None
    force_closed: Optional[bool] = None
    rules: Optional[List[SchedulingRule]] = None
    default_state: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class IntegrationData:
    third_party_id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EntityIntegrationData(Dict[str,IntegrationData]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BillingItem:
    base_cost: Optional[float] = None
    raw_unit_multiplier: Optional[float] = None
    unit_cost: Optional[float] = None
    allowance: Optional[int] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BillingSettings:
    base: Optional[BillingItem] = None
    local_numbers: Optional[BillingItem] = None
    toll_free_numbers: Optional[BillingItem] = None
    inbound_voice_calls: Optional[BillingItem] = None
    outbound_voice_calls: Optional[BillingItem] = None
    inbound_faxes: Optional[BillingItem] = None
    outbound_faxes: Optional[BillingItem] = None
    inbound_sms_messages: Optional[BillingItem] = None
    outbound_sms_messages: Optional[BillingItem] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AppSettings:
    enable_phone_number_management: Optional[bool] = None
    enable_device_management: Optional[bool] = None
    enable_dialer: Optional[bool] = None
    enable_call_history: Optional[bool] = None
    show_file_name_in_message_center: Optional[bool] = None
    chakra_theme: Optional[str] = None
    custom_css: Optional[str] = None
    page_title: Optional[str] = None
    string_mappings: Optional[str] = None
    logout_url: Optional[str] = None
    port_my_number_url: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerInfo(EntityInfo):
    # @ApiMember(Description="The ID of the account associated with this customer")
    account_id: Optional[str] = None
    """
    The ID of the account associated with this customer
    """


    # @ApiMember(Description="The parent customer ID for this customer")
    parent_customer_id: Optional[str] = None
    """
    The parent customer ID for this customer
    """


    # @ApiMember(Description="The breadcrumb to this customer")
    breadcrumb: Optional[List[CustomerBreadcrumb]] = None
    """
    The breadcrumb to this customer
    """


    # @ApiMember(Description="The name of the account associated with this customer")
    account_name: Optional[str] = None
    """
    The name of the account associated with this customer
    """


    # @ApiMember(Description="Is this customer staging or production?")
    is_staging: Optional[bool] = None
    """
    Is this customer staging or production?
    """


    # @ApiMember(Description="The name of the company")
    name: Optional[str] = None
    """
    The name of the company
    """


    # @ApiMember(Description="The reference ID for this company")
    reference_id: Optional[str] = None
    """
    The reference ID for this company
    """


    # @ApiMember(Description="This customer's data values")
    data: Optional[Struct] = None
    """
    This customer's data values
    """


    # @ApiMember(Description="The list of tags for this customer")
    tags: Optional[List[Tag]] = None
    """
    The list of tags for this customer
    """


    # @ApiMember(Description="This customer's schedule")
    schedule: Optional[Schedule] = None
    """
    This customer's schedule
    """


    # @ApiMember(Description="Integration data for this customer")
    integration_data: Optional[EntityIntegrationData] = None
    """
    Integration data for this customer
    """


    # @ApiMember(Description="Override this customer's billing settings? Otherwise inherits from parent")
    override_billing_settings: Optional[bool] = None
    """
    Override this customer's billing settings? Otherwise inherits from parent
    """


    # @ApiMember(Description="Billing settings for this customer")
    billing_settings: Optional[BillingSettings] = None
    """
    Billing settings for this customer
    """


    # @ApiMember(Description="Should this customer override the parent customer's app settings")
    override_app_settings: Optional[bool] = None
    """
    Should this customer override the parent customer's app settings
    """


    # @ApiMember(Description="App / Portal settings for this customer")
    app_settings: Optional[AppSettings] = None
    """
    App / Portal settings for this customer
    """


# @Api(Description="Creates a new customer")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class NewCustomer(IPost):
    """
    Creates a new customer
    """

    # @ApiMember(Description="The account ID to associate this customer with")
    account_id: Optional[str] = None
    """
    The account ID to associate this customer with
    """


    # @ApiMember(Description="The name of the customer")
    name: Optional[str] = None
    """
    The name of the customer
    """


    # @ApiMember(Description="The parent customer for this customer")
    parent_customer_id: Optional[str] = None
    """
    The parent customer for this customer
    """


    # @ApiMember(Description="The reference ID for this customer (e.g. in a third party system)")
    reference_id: Optional[str] = None
    """
    The reference ID for this customer (e.g. in a third party system)
    """


    # @ApiMember(Description="Data values for this customer")
    data: Optional[Struct] = None
    """
    Data values for this customer
    """

Python NewCustomer DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /customers HTTP/1.1 
Host: evovoice.io 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"accountId":"String","name":"String","parentCustomerId":"String","referenceId":"String","data":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}}}}}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"accountId":"String","parentCustomerId":"String","breadcrumb":[{"id":"String","name":"String"}],"accountName":"String","isStaging":false,"name":"String","referenceId":"String","data":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}}}}},"tags":[{"id":"String","name":"String","color":"Magenta"}],"schedule":{"timeZoneId":"String","inherit":false,"forceClosed":false,"rules":[{"id":"String","name":"String","priority":0,"state":"String","source":"String","condition":"String","simpleRuleType":"Always","customerState":"String","flowId":"String","flowParams":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}],"structValue":{"String":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]}}}}}},"isAllDay":false,"startDate":"String","startTime":"String","endTime":"String","bySetPosition":[0],"byMonth":[0],"byWeekNo":[0],"byYearDay":[0],"byMonthDay":[0],"byDay":[{"offset":0,"dayOfWeek":"Sunday"}],"byHour":[0],"byMinute":[0],"interval":0,"count":0,"untilDate":"String","frequency":"None"}],"defaultState":"String"},"integrationData":{"String":{"thirdPartyId":"String"}},"overrideBillingSettings":false,"billingSettings":{"base":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"localNumbers":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"tollFreeNumbers":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"inboundVoiceCalls":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"outboundVoiceCalls":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"inboundFaxes":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"outboundFaxes":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"inboundSmsMessages":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0},"outboundSmsMessages":{"baseCost":0,"rawUnitMultiplier":0,"unitCost":0,"allowance":0}},"overrideAppSettings":false,"appSettings":{"enablePhoneNumberManagement":false,"enableDeviceManagement":false,"enableDialer":false,"enableCallHistory":false,"showFileNameInMessageCenter":false,"chakraTheme":"String","customCss":"String","pageTitle":"String","stringMappings":"String","logoutUrl":"String","portMyNumberUrl":"String"},"id":"String","dateCreated":"String","dateLastModified":"String","createdBy":"String","lastModifiedBy":"String"}