Agentivity API

<back to all web services

GetAccounts

The following routes are available for this service:
All Verbs/Accounts
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 PagingMetadata:
    # @ApiMember(DataType="string", Description="Starting Record", Name="Offset", ParameterType="query")
    offset: Optional[str] = None
    """
    Starting Record
    """


    # @ApiMember(DataType="string", Description="Number of records to return (PageSize)", Name="Limit", ParameterType="query")
    limit: Optional[str] = None
    """
    Number of records to return (PageSize)
    """


    # @ApiMember(DataType="string", Description="Total Number of Records in a Full Reponse (if no paging)", Name="TotalRecords", ParameterType="query")
    total_records: int = 0
    """
    Total Number of Records in a Full Reponse (if no paging)
    """


    # @ApiMember(DataType="string", Description="Total Number of Records in this Reponse (on this page)", Name="ResponseRecords", ParameterType="query")
    response_records: int = 0
    """
    Total Number of Records in this Reponse (on this page)
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CompanyLevelRequestBase(PagingMetadata, IMemberUsername, IMemberOwningCompanyCode):
    owning_company_code: Optional[List[str]] = None
    """
    Comma Delimited List of Owning Company Codes
    """

    user_name: Optional[str] = None
    """
    UserName in form of an email address
    """


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


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AgencyAccount:
    id: Optional[str] = None
    name: Optional[str] = None
    manager: Optional[str] = None
    creation_date_time: Optional[datetime.datetime] = None
    owning_agency_locations: Optional[List[AgencyAccountOwningAgencyLocation]] = None
    company_id: int = 0
    last_matched_date: Optional[datetime.datetime] = None


TItemResponse = TypeVar('TItemResponse')
TItem = TypeVar('TItem')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Report(Generic[TItemResponse, TItem]):
    item: Optional[TItem] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetAccountsResponseReport(Report[GetAccountsItemResponse, AgencyAccount]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CacheMetadata:
    cached_at: datetime.datetime = datetime.datetime(1, 1, 1)
    cache_expires_at: datetime.datetime = datetime.datetime(1, 1, 1)
    is_from_cache: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ResponseMetadata:
    success: bool = False
    has_cache: bool = False
    has_paging: bool = False
    cache_metadata: Optional[CacheMetadata] = None
    paging_metadata: Optional[PagingMetadata] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AgentivityError:
    error_code: Optional[str] = None
    message: Optional[str] = None
    status_code: Optional[str] = None
    verbose_message: Optional[str] = None


TItem = TypeVar('TItem')
TReport = TypeVar('TReport')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ItemResponse(Generic[TItem, TReport]):
    response_metadata: Optional[ResponseMetadata] = None
    response_report: Optional[TReport] = None
    response_error: Optional[AgentivityError] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetAccountsItemResponse(ItemResponse[AgencyAccount, GetAccountsResponseReport]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetAccounts(CompanyLevelRequestBase, IMemberOwningAgencyLocationID):
    include_owning_agency_locations: bool = False
    """
    Includes Owning Agency Locations for Accounts in the Result
    """

    owning_agency_location_i_d: Optional[List[str]] = None
    """
    Comma Delimited List of PCCs
    """

Python GetAccounts 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 /Accounts HTTP/1.1 
Host: api.agentivity.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"IncludeOwningAgencyLocations":false,"OwningAgencyLocationID":["String"],"OwningCompanyCode":["String"],"UserName":"String","Offset":"String","Limit":"String","TotalRecords":0,"ResponseRecords":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ResponseMetadata":{"Success":false,"HasCache":false,"HasPaging":false,"CacheMetadata":{"IsFromCache":false,"CachedAt":"\/Date(-62135596800000-0000)\/","CacheExpiresAt":"\/Date(-62135596800000-0000)\/"},"PagingMetadata":{"Offset":"String","Limit":"String","TotalRecords":0,"ResponseRecords":0}},"ResponseReport":{"Item":{"ID":"String","Name":"String","Manager":"String","CreationDateTime":"\/Date(-62135596800000-0000)\/","OwningAgencyLocations":[{"ID":"String","LastMatchedDate":"\/Date(-62135596800000-0000)\/"}],"CompanyId":0,"LastMatchedDate":"\/Date(-62135596800000-0000)\/"}},"ResponseError":{"ErrorCode":"String","Message":"String","StatusCode":"String","VerboseMessage":"String"}}