# README
Go API client for openapi
Digiseg API documentation
Introduction
This API let you harness the power of Digisegs powerful and tracking-free segmentation engine.
Audiences by Digiseg are available in 50+ countries, probablistically mapping neighborhood characteristics to the IP addresses observed on the internet - Household targeting & measurement for the post-cookie world.
Developer SDKs
In addition to using these APIs directly through any HTTP client, we provide a set of API client SDKs for popular programming languages:
Audience taxonomy
Digiseg audiences are grouped into private and business audiences. In each group there are categories that then contain the audiences. The API endpoints that communicate audiences and household characteristics, audience codes are being used.
The following table can be used as a reference for audience codes. Note that Digiseg will at times update names of audiences for purposes of internationalization, clarity or other such purposes - but the codes will remain as-is and should be considered a stable point of reference for the audience.
Group | Category | Audience Code | Audience Name |
---|---|---|---|
private | home_type | a1 | Apartment |
a2 | House | ||
savings | b1 | No Savings | |
b2 | Smaller Savings | ||
b3 | Larger Savings | ||
lifecycle | c1 | Young couples and singles | |
c2 | Early family life | ||
c3 | Middle-aged families | ||
c4 | Mature families | ||
c5 | Pensioners / Retirees | ||
cars | d1 | No cars | |
d2 | 1 car | ||
d3 | 2 or more cars | ||
children | e1 | No children | |
e2 | 1 child | ||
e3 | 2 or more children | ||
education | f1 | Basic | |
f2 | Medium | ||
f3 | Higher | ||
neighbourhood_type | g1 | Countryside | |
g2 | Village | ||
g3 | Suburban | ||
g4 | City | ||
income | h1 | Lowest 20% | |
h2 | Lowest 20-40% | ||
h3 | Middle 40-60% | ||
h4 | Highest 60-80% | ||
h5 | Top 20% | ||
home_ownership | j1 | Rent | |
j2 | Own | ||
building_age | k1 | Pre 1945 | |
k2 | 1945-1989 | ||
k3 | 1990 until today | ||
living_space | l1 | Small | |
l2 | Medium | ||
l3 | Large | ||
tech_level | n1 | Basic | |
n2 | Medium | ||
n3 | High | ||
business | size | ba1 | Small Business |
ba2 | Medium Business | ||
ba3 | Larger Business |
There is also an interactive Audience builder which lets you discover the targeting reach and power of combining various household characteristics into composite audiences.
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1.0.0
- Package version: 1.0.0
- Generator version: 7.6.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import openapi "github.com/digiseg-labs/api-client-go"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value openapi.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using openapi.ContextOperationServerIndices
and openapi.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to https://api.digiseg.net
Class | Method | HTTP request | Description |
---|---|---|---|
AccountsAPI | CreateUserInAccount | Post /accounts/{account_id}/users | Create user |
AccountsAPI | DeleteAccountLogo | Delete /accounts/{account_id}/assets/logo | Delete account logo |
AccountsAPI | GetAccountById | Get /accounts/{account_id} | Get account |
AccountsAPI | GetAccountLogo | Get /accounts/{account_id}/assets/logo | Get account logo |
AccountsAPI | GetAccountSubscriptionById | Get /accounts/{account_id}/subscriptions/{subscription_id} | Get account subscription |
AccountsAPI | GetAccountSubscriptions | Get /accounts/{account_id}/subscriptions | Get account subscriptions summary |
AccountsAPI | ListApiKeysByAccountId | Get /accounts/{account_id}/apikeys | List API keys for account |
AccountsAPI | ListUsersByAccountId | Get /accounts/{account_id}/users | List users for account |
AccountsAPI | UpdateAccountById | Put /accounts/{account_id} | Update account |
AccountsAPI | UploadAccountLogo | Put /accounts/{account_id}/assets/logo | Upload account logo |
AudiencesAPI | ResolveAudiencesOfClient | Get /audiences | Get audiences of the API client |
AudiencesAPI | ResolveAudiencesOfMultiple | Post /audiences | Get audiences for multiple IP addresses |
AudiencesAPI | ResolveAudiencesOfSingle | Get /audiences/{user_ip} | Get audiences for a given IP address |
AuthAPI | CreateAccessToken | Post /auth/token | Authenticate and create access token |
AuthAPI | CreateApiKey | Post /users/{user_id}/apikeys | Create API key |
AuthAPI | DeleteApiKeyById | Delete /users/{user_id}/apikeys/{key_id} | Delete API key |
AuthAPI | GetApiKeyById | Get /users/{user_id}/apikeys/{key_id} | Get API key |
AuthAPI | ListApiKeysByAccountId | Get /accounts/{account_id}/apikeys | List API keys for account |
AuthAPI | ListApiKeysByUserId | Get /users/{user_id}/apikeys | List API keys for user |
AuthAPI | UpdateApiKeyById | Put /users/{user_id}/apikeys/{key_id} | Update API key |
MeasurementClientsAPI | CreateMeasurementClient | Post /measurement/clients | Create measurement client |
MeasurementClientsAPI | DeleteClientLogo | Delete /measurement/clients/{client_id}/assets/logo | Delete measurement client logo |
MeasurementClientsAPI | DeleteMeasurementClientById | Delete /measurement/clients/{client_id} | Delete measurement client |
MeasurementClientsAPI | GetClientLogo | Get /measurement/clients/{client_id}/assets/logo | Get measurement client logo |
MeasurementClientsAPI | GetMeasurementClientById | Get /measurement/clients/{client_id} | Get measurement client |
MeasurementClientsAPI | ListMeasurementClients | Get /measurement/clients | List measurement clients |
MeasurementClientsAPI | UpdateMeasurementClientById | Put /measurement/clients/{client_id} | Update measurement client |
MeasurementClientsAPI | UploadClientLogo | Put /measurement/clients/{client_id}/assets/logo | Upload measurement client logo |
MeasurementLabelsAPI | ListMeasurementLabels | Get /measurement/labels | List measurement labels |
PopulationsAPI | GetPopuplationByKey | Get /populations/{category_key}/{population_key} | Get Population by key |
PopulationsAPI | ListPopuplations | Get /populations/{category_key} | List populations of category |
StudiesAPI | CreateStudy | Post /studies | Create study |
StudiesAPI | DeleteStudyBannerImage | Delete /studies/{study_id}/assets/banner_image | Delete study banner image logo |
StudiesAPI | DeleteStudyById | Delete /studies/{study_id} | Delete study |
StudiesAPI | GetStudyBannerImage | Get /studies/{study_id}/assets/banner_image | Get study banner image |
StudiesAPI | GetStudyById | Get /studies/{study_id} | Get study |
StudiesAPI | ListStudies | Get /studies | List studies |
StudiesAPI | QueryStudyAudienceStats | Get /studies/{study_id}/stats/audiences | Audience statistics for study |
StudiesAPI | QueryStudyCountryStats | Get /studies/{study_id}/stats/countries | Country statistics for study |
StudiesAPI | QueryStudyFrequencyStats | Get /studies/{study_id}/stats/frequencies | Frequency statistics for study |
StudiesAPI | QueryStudyTimingStats | Get /studies/{study_id}/stats/timing | Timing statistics for study |
StudiesAPI | UpdateStudyById | Put /studies/{study_id} | Update study |
StudiesAPI | UploadStudyBannerImage | Put /studies/{study_id}/assets/banner_image | Upload study banner image |
SubscriptionsAPI | GetAccountSubscriptionById | Get /accounts/{account_id}/subscriptions/{subscription_id} | Get account subscription |
SubscriptionsAPI | GetAccountSubscriptions | Get /accounts/{account_id}/subscriptions | Get account subscriptions summary |
SubscriptionsAPI | ListSubscriptionPlans | Get /subscription_plans | List subscription plans |
UsageAPI | ListAudienceDataDailyUsage | Get /usage/audience_data/daily | List daily usage of Audience Data |
UsageAPI | ListAudienceDataMonthlyUsage | Get /usage/audience_data/monthly | List monthly usage of Audience Data |
UsageAPI | ListAudienceDataRealtimeUsage | Get /usage/audience_data/realtime | List realtime usage of Audience Data |
UsersAPI | CreateApiKey | Post /users/{user_id}/apikeys | Create API key |
UsersAPI | CreateUserInAccount | Post /accounts/{account_id}/users | Create user |
UsersAPI | DeleteApiKeyById | Delete /users/{user_id}/apikeys/{key_id} | Delete API key |
UsersAPI | DeleteUserAvatar | Delete /users/{user_id}/assets/avatar | Delete user avatar |
UsersAPI | DeleteUserById | Delete /users/{user_id} | Delete user |
UsersAPI | GetApiKeyById | Get /users/{user_id}/apikeys/{key_id} | Get API key |
UsersAPI | GetCurrentUser | Get /user | Get current user |
UsersAPI | GetUserAvatar | Get /users/{user_id}/assets/avatar | Get user avatar |
UsersAPI | GetUserById | Get /users/{user_id} | Get user |
UsersAPI | ListApiKeysByUserId | Get /users/{user_id}/apikeys | List API keys for user |
UsersAPI | ListUsersByAccountId | Get /accounts/{account_id}/users | List users for account |
UsersAPI | UpdateApiKeyById | Put /users/{user_id}/apikeys/{key_id} | Update API key |
UsersAPI | UpdateUserById | Put /users/{user_id} | Update user |
UsersAPI | UploadUserAvatar | Put /users/{user_id}/assets/avatar | Upload user avatar |
Documentation For Models
- AccessTokenData
- AccountAux
- AccountBase
- AccountCreation
- AccountCreationAux
- AccountFull
- AccountItem
- AccountLinks
- AccountMutation
- AccountMutationAux
- AccountOwnerCreation
- AccountSubscriptionBase
- AccountSubscriptionCreation
- AccountSubscriptionFull
- AccountSubscriptionFullAux
- AccountSubscriptionItem
- AccountSubscriptionItemAux
- AccountSubscriptionPaymentConfiguration
- AccountSubscriptionsSummary
- ApiKeyAux
- ApiKeyBase
- ApiKeyCreation
- ApiKeyFull
- ApiKeyFullWithToken
- ApiKeyItem
- ApiKeyLinks
- ApiKeyMutation
- ApiKeyStatus
- ApiKeyToken
- Audience
- AudienceCategoryStats
- AudienceDataDailyUsage
- AudienceDataMonthlyUsage
- AudienceDataRealtimeUsage
- AudienceDataUsage
- AudienceExampleInput
- AudienceExampleInputsResponse
- AudienceResponse
- AudienceResponseStatus
- AudienceStats
- AuthTokenRequest
- AuthTokenResponse
- BusinessAudienceStats
- BusinessAudienceStatsAudienceCategories
- CategoryPopulationsFull
- CompanySize
- CompanyType
- Comparison
- ComparisonsContainer
- CountryStats
- CreateApiKey201Response
- CreateMeasurementClient201Response
- CreateStudy201Response
- CreateUserInAccount201Response
- DayOfMonthStats
- DayOfWeekStats
- ErrorResponse
- FrequencyStats
- GetAccountById200Response
- GetAccountSubscriptionById200Response
- GetAccountSubscriptions200Response
- GetApiKeyById200Response
- GetPopuplationByKey200Response
- HourOfDayStats
- IdentifyableObject
- IdentifyableObject1
- LimitedOrFullFeature
- ListApiKeysByAccountId200Response
- ListAudienceDataDailyUsage200Response
- ListAudienceDataMonthlyUsage200Response
- ListAudienceDataRealtimeUsage200Response
- ListMeasurementClients200Response
- ListMeasurementLabels200Response
- ListPaginationLinks
- ListPaginationMeta
- ListPaginationMetaPage
- ListPopuplations200Response
- ListStudies200Response
- ListSubscriptionPlans200Response
- ListUsersByAccountId200Response
- Measurement
- MeasurementClientBase
- MeasurementClientFull
- MeasurementClientItem
- MeasurementClientMutation
- MeasurementEventLink
- MeasurementEventLinkParameterInfo
- MeasurementEventLinks
- MeasurementEventSet
- MeasurementIntegrationPlatform
- MeasurementsContainer
- PasswordlessAuthRequest
- PermissionScopes
- PlanFeatureSet
- PopulationAudienceCategorySetBusinessSection
- PopulationAudienceCategorySetPrivateSection
- PopulationAudienceCategorySetSection
- PopulationFull
- PopulationItem
- PopulationSource
- PopulationSourceBusinessCategorySet
- PopulationSourceBusinessCategorySetSize
- PopulationSourceBusinessSection
- PopulationSourceNotResolvedSection
- PopulationSourcePrivateCategorySet
- PopulationSourcePrivateCategorySetBuildingAge
- PopulationSourcePrivateCategorySetCars
- PopulationSourcePrivateCategorySetChildren
- PopulationSourcePrivateCategorySetEducation
- PopulationSourcePrivateCategorySetHomeOwnership
- PopulationSourcePrivateCategorySetHomeType
- PopulationSourcePrivateCategorySetIncome
- PopulationSourcePrivateCategorySetLifecycle
- PopulationSourcePrivateCategorySetLivingSpace
- PopulationSourcePrivateCategorySetNeighbourhoodType
- PopulationSourcePrivateCategorySetSavings
- PopulationSourcePrivateCategorySetTechLevel
- PopulationSourcePrivateSection
- PostalAddress
- PrivateAudienceStats
- PrivateAudienceStatsAudienceCategories
- QueryStudyAudienceStats200Response
- QueryStudyCountryStats200Response
- QueryStudyFrequencyStats200Response
- QueryStudyTimingStats200Response
- RegistrationByIdResponseData
- RegistrationCreationResponseData
- RegistrationRequest
- RegistrationVerificationResponseData
- RegistrationVerificationResponseLinks
- ResolveAudiencesOfMultipleRequest
- ResolveAudiencesOfMultipleRequestItem
- ResolveAudiencesOfMultipleResponse
- ResolveAudiencesOfMultipleResponseItem
- StudyAudienceStats
- StudyAux
- StudyBase
- StudyCountryStats
- StudyCreation
- StudyCreationData
- StudyFrequencyStats
- StudyFull
- StudyIngestionStatus
- StudyItem
- StudyLifecycleStage
- StudyLinks
- StudyMeta
- StudyMutation
- StudyPermissions
- StudySummaryStats
- StudyTimingStats
- SubscriptionPlanAux
- SubscriptionPlanBase
- SubscriptionPlanFull
- SubscriptionPlanItem
- SubscriptionPrice
- SubscriptionPriceCurrency
- SubscriptionPriceInterval
- SubscriptionProductType
- TimestampedObject
- TimestampedObject1
- UserAccountMembership
- UserAccountRole
- UserAux
- UserBase
- UserCreation
- UserCreationNotification
- UserCredentials
- UserFull
- UserItem
- UserLinks
- UserMutation
- UserPlatformRole
- UserSortOption
Documentation For Authorization
Authentication schemes defined for the API:
bearerAuth
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
apiKeyHeaderAuth
- Type: API key
- API key parameter name: X-API-KEY
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: X-API-KEY and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"X-API-KEY": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
apiKeyQueryParamAuth
- Type: API key
- API key parameter name: api_key
- Location: URL query string
Note, each API key must be added to a map of map[string]APIKey
where the key is: api_key and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"api_key": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
oAuth
- Type: OAuth
- Flow: password
- Authorization URL:
- Scopes: N/A
Example
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, openapi.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime