Skip to content

liferays/talon_one.py

 
 

Repository files navigation

talon_one

Use the Talon.One API to integrate with your application and to manage applications and campaigns:

Determining the base URL of the endpoints

The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at https://yourbaseurl.talon.one/, the URL for the updateCustomerSessionV2 endpoint is https://yourbaseurl.talon.one/v2/customer_sessions/{Id}

This Python package is automatically generated by the OpenAPI Generator project:

  • API version:
  • Package version: 4.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/talon-one/talon_one.py.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/talon-one/talon_one.py.git)

Then import the package:

import talon_one

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import talon_one

Getting Started

Please follow the installation procedure and then run the following:

Integration API

Note: The Integration API's V1 Update customer session and Update customer profile endpoints are now deprecated. Use their V2 instead. See Migrating to V2 for more information.

import talon_one
from talon_one.rest import ApiException
from pprint import pprint

# Create configuration with your host destination and authorization using api_key_v1
configuration = talon_one.Configuration(
    host = "https://yourbaseurl.talon.one",
    api_key_prefix = {
        "Authorization": "ApiKey-v1"
    },
    api_key = {
        "Authorization": "e18149e88f42247f0123456789abcdef9302722577ad60cebc86c4333b6fb70"
    }
)

# Integration API example to send a session update
integration_api = talon_one.IntegrationApi(talon_one.ApiClient(configuration))

# Preparing a NewCustomerSessionV2 object
customer_session = talon_one.NewCustomerSessionV2(
  "PROFILE_ID"
)
customer_session.cart_items = [
    talon_one.CartItem(name="Red Spring Blouse",
                       sku="rdbs-1111",
                       quantity=1,
                       price=49,
                       category="Shirts"),
    talon_one.CartItem(name="Denim Trousers",
                       sku="dtr-2222",
                       quantity=1,
                       price=74,
                       category="Trousers"),
]
customer_session.coupon_codes = [
    "Cool_Stuff"
]

# Instantiating a new IntegrationRequest object
integration_request = talon_one.IntegrationRequest(
    customer_session,
    # Optional list of requested information to be present on the response.
    # See models/integration_request.py for full list
    # ["customerSession", "loyalty"]
)

try:
    # Create/update a customer session using `update_customer_session_v2` function
    api_response = integration_api.update_customer_session_v2("my_unique_session_v2_id", integration_request)
    pprint(api_response)

    # Parsing the returned effects list, please consult https://developers.talon.one/Integration-API/handling-effects-v2 for the full list of effects and their corresponding properties
    for effect in api_response.effects:
        if effect.effect_type == "setDiscount":
            # Initiating right props instance according to the effect type
            setDiscountProps = integration_api.api_client.deserialize_model(effect.props, talon_one.SetDiscountEffectProps)

            # Access the specific effect's properties
            print("Set a discount '{name}' of {value}".format(
                name = setDiscountProps.name,
                value = setDiscountProps.value
            ))
        elif effect.effect_type == "rejectCoupon":
            rejectCouponEffectProps = integration_api.api_client.deserialize_model(effect.props, talon_one.RejectCouponEffectProps)

            # Work with AcceptCouponEffectProps' properties
            # ...
except ApiException as e:
    print("Exception when calling IntegrationApi->update_customer_session_v2: %s\n" % e)

Management API

# Create configuration with your host destination and authorization using management_key
configuration = talon_one.Configuration(
    host = "https://yourbaseurl.talon.one"
    api_key_prefix = {
        "Authorization": "ManagementKey-v1"
    },
    api_key = {
        "Authorization": "2f0dce055da01ae595005d7d79154bae7448d319d5fc7c5b2951fadd6ba1ea07"
    }
)

# Management API example to load application with id 7
management_api = talon_one.ManagementApi(talon_one.ApiClient(configuration))

try:
    # Calling get_application function with the desired id (7)
    application = management_api.get_application(7)
    pprint(application)
except ApiException as e:
    print("Exception when calling ManagementApi: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://yourbaseurl.talon.one

Class Method HTTP request Description
IntegrationApi create_audience_v2 POST /v2/audiences Create audience
IntegrationApi create_coupon_reservation POST /v1/coupon_reservations/{couponValue} Create coupon reservation
IntegrationApi create_referral POST /v1/referrals Create referral code for an advocate
IntegrationApi create_referrals_for_multiple_advocates POST /v1/referrals_for_multiple_advocates Create referral codes for multiple advocates
IntegrationApi delete_audience_memberships_v2 DELETE /v2/audiences/{audienceId}/memberships Delete audience memberships
IntegrationApi delete_audience_v2 DELETE /v2/audiences/{audienceId} Delete audience
IntegrationApi delete_coupon_reservation DELETE /v1/coupon_reservations/{couponValue} Delete coupon reservations
IntegrationApi delete_customer_data DELETE /v1/customer_data/{integrationId} Delete customer's personal data
IntegrationApi get_customer_inventory GET /v1/customer_profiles/{integrationId}/inventory List customer data
IntegrationApi get_customer_session GET /v2/customer_sessions/{customerSessionId} Get customer session
IntegrationApi get_loyalty_balances GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/balances Get customer's loyalty points
IntegrationApi get_loyalty_card_balances GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/balances Get card's point balances
IntegrationApi get_loyalty_card_transactions GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/transactions List card's transactions
IntegrationApi get_loyalty_program_profile_transactions GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/transactions List customer's loyalty transactions
IntegrationApi get_reserved_customers GET /v1/coupon_reservations/customerprofiles/{couponValue} List customers that have this coupon reserved
IntegrationApi link_loyalty_card_to_profile POST /v2/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/link_profile Link customer profile to card
IntegrationApi reopen_customer_session PUT /v2/customer_sessions/{customerSessionId}/reopen Reopen customer session
IntegrationApi return_cart_items POST /v2/customer_sessions/{customerSessionId}/returns Return cart items
IntegrationApi sync_catalog PUT /v1/catalogs/{catalogId}/sync Sync cart item catalog
IntegrationApi track_event POST /v1/events Track event
IntegrationApi track_event_v2 POST /v2/events Track event V2
IntegrationApi update_audience_customers_attributes PUT /v2/audience_customers/{audienceId}/attributes Update profile attributes for all customers in audience
IntegrationApi update_audience_v2 PUT /v2/audiences/{audienceId} Update audience name
IntegrationApi update_customer_profile_audiences POST /v2/customer_audiences Update multiple customer profiles' audiences
IntegrationApi update_customer_profile_v2 PUT /v2/customer_profiles/{integrationId} Update customer profile
IntegrationApi update_customer_profiles_v2 PUT /v2/customer_profiles Update multiple customer profiles
IntegrationApi update_customer_session_v2 PUT /v2/customer_sessions/{customerSessionId} Update customer session
ManagementApi add_loyalty_card_points PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/add_points Add points to card
ManagementApi add_loyalty_points PUT /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/add_points Add points to customer profile
ManagementApi copy_campaign_to_applications POST /v1/applications/{applicationId}/campaigns/{campaignId}/copy Copy the campaign into the specified Application
ManagementApi create_account_collection POST /v1/collections Create account-level collection
ManagementApi create_additional_cost POST /v1/additional_costs Create additional cost
ManagementApi create_attribute POST /v1/attributes Create custom attribute
ManagementApi create_campaign_from_template POST /v1/applications/{applicationId}/create_campaign_from_template Create campaign from campaign template
ManagementApi create_collection POST /v1/applications/{applicationId}/campaigns/{campaignId}/collections Create collection
ManagementApi create_coupons POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Create coupons
ManagementApi create_coupons_async POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_async Create coupons asynchronously
ManagementApi create_coupons_for_multiple_recipients POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_with_recipients Create coupons for multiple recipients
ManagementApi create_notification_webhook POST /v1/applications/{applicationId}/notification_webhooks Create notification about campaign-related changes
ManagementApi create_password_recovery_email POST /v1/password_recovery_emails Request a password reset
ManagementApi create_session POST /v1/sessions Create session
ManagementApi deduct_loyalty_card_points PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/deduct_points Deduct points from card
ManagementApi delete_account_collection DELETE /v1/collections/{collectionId} Delete account-level collection
ManagementApi delete_campaign DELETE /v1/applications/{applicationId}/campaigns/{campaignId} Delete campaign
ManagementApi delete_collection DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId} Delete collection
ManagementApi delete_coupon DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId} Delete coupon
ManagementApi delete_coupons DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Delete coupons
ManagementApi delete_loyalty_card DELETE /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId} Delete loyalty card
ManagementApi delete_notification_webhook DELETE /v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId} Delete notification about campaign-related changes
ManagementApi delete_referral DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/{referralId} Delete referral
ManagementApi destroy_session DELETE /v1/sessions Destroy session
ManagementApi export_account_collection_items GET /v1/collections/{collectionId}/export Export account-level collection's items
ManagementApi export_collection_items GET /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}/export Export a collection's items
ManagementApi export_coupons GET /v1/applications/{applicationId}/export_coupons Export coupons
ManagementApi export_customer_sessions GET /v1/applications/{applicationId}/export_customer_sessions Export customer sessions
ManagementApi export_effects GET /v1/applications/{applicationId}/export_effects Export triggered effects
ManagementApi export_loyalty_balance GET /v1/loyalty_programs/{loyaltyProgramId}/export_customer_balance Export customer loyalty balance to CSV
ManagementApi export_loyalty_balances GET /v1/loyalty_programs/{loyaltyProgramId}/export_customer_balances Export customer loyalty balances
ManagementApi export_loyalty_card_balances GET /v1/loyalty_programs/{loyaltyProgramId}/export_card_balances Export all card transaction logs
ManagementApi export_loyalty_card_ledger GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/export_log Export card's ledger log
ManagementApi export_loyalty_ledger GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/export_log Export customer's transaction logs
ManagementApi export_referrals GET /v1/applications/{applicationId}/export_referrals Export referrals
ManagementApi get_access_logs_without_total_count GET /v1/applications/{applicationId}/access_logs/no_total Get access logs for Application
ManagementApi get_account GET /v1/accounts/{accountId} Get account details
ManagementApi get_account_analytics GET /v1/accounts/{accountId}/analytics Get account analytics
ManagementApi get_account_collection GET /v1/collections/{collectionId} Get account-level collection
ManagementApi get_additional_cost GET /v1/additional_costs/{additionalCostId} Get additional cost
ManagementApi get_additional_costs GET /v1/additional_costs List additional costs
ManagementApi get_all_access_logs GET /v1/access_logs List access logs
ManagementApi get_all_roles GET /v1/roles List roles
ManagementApi get_application GET /v1/applications/{applicationId} Get Application
ManagementApi get_application_api_health GET /v1/applications/{applicationId}/health_report Get Application health
ManagementApi get_application_customer GET /v1/applications/{applicationId}/customers/{customerId} Get application's customer
ManagementApi get_application_customer_friends GET /v1/applications/{applicationId}/profile/{integrationId}/friends List friends referred by customer profile
ManagementApi get_application_customers GET /v1/applications/{applicationId}/customers List application's customers
ManagementApi get_application_customers_by_attributes POST /v1/applications/{applicationId}/customer_search List application customers matching the given attributes
ManagementApi get_application_event_types GET /v1/applications/{applicationId}/event_types List Applications event types
ManagementApi get_application_events_without_total_count GET /v1/applications/{applicationId}/events/no_total List Applications events
ManagementApi get_application_session GET /v1/applications/{applicationId}/sessions/{sessionId} Get Application session
ManagementApi get_application_sessions GET /v1/applications/{applicationId}/sessions List Application sessions
ManagementApi get_applications GET /v1/applications List Applications
ManagementApi get_attribute GET /v1/attributes/{attributeId} Get custom attribute
ManagementApi get_attributes GET /v1/attributes List custom attributes
ManagementApi get_audiences GET /v1/audiences List audiences
ManagementApi get_campaign GET /v1/applications/{applicationId}/campaigns/{campaignId} Get campaign
ManagementApi get_campaign_analytics GET /v1/applications/{applicationId}/campaigns/{campaignId}/analytics Get analytics of campaigns
ManagementApi get_campaign_by_attributes POST /v1/applications/{applicationId}/campaigns_search List campaigns that match the given attributes
ManagementApi get_campaign_templates GET /v1/campaign_templates List campaign templates
ManagementApi get_campaigns GET /v1/applications/{applicationId}/campaigns List campaigns
ManagementApi get_changes GET /v1/changes Get audit logs for an account
ManagementApi get_collection GET /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId} Get collection
ManagementApi get_collection_items GET /v1/collections/{collectionId}/items Get collection items
ManagementApi get_coupons_without_total_count GET /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/no_total List coupons
ManagementApi get_customer_activity_report GET /v1/applications/{applicationId}/customer_activity_reports/{customerId} Get customer's activity report
ManagementApi get_customer_activity_reports_without_total_count GET /v1/applications/{applicationId}/customer_activity_reports/no_total Get Activity Reports for Application Customers
ManagementApi get_customer_analytics GET /v1/applications/{applicationId}/customers/{customerId}/analytics Get customer's analytics report
ManagementApi get_customer_profile GET /v1/customers/{customerId} Get customer profile
ManagementApi get_customer_profiles GET /v1/customers/no_total List customer profiles
ManagementApi get_customers_by_attributes POST /v1/customer_search/no_total List customer profiles matching the given attributes
ManagementApi get_event_types GET /v1/event_types List event types
ManagementApi get_exports GET /v1/exports Get exports
ManagementApi get_loyalty_card GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId} Get loyalty card
ManagementApi get_loyalty_card_transaction_logs GET /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/logs List card's transactions
ManagementApi get_loyalty_cards GET /v1/loyalty_programs/{loyaltyProgramId}/cards List loyalty cards
ManagementApi get_loyalty_points GET /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId} Get customer's full loyalty ledger
ManagementApi get_loyalty_program GET /v1/loyalty_programs/{loyaltyProgramId} Get loyalty program
ManagementApi get_loyalty_program_transactions GET /v1/loyalty_programs/{loyaltyProgramId}/transactions List loyalty program transactions
ManagementApi get_loyalty_programs GET /v1/loyalty_programs List loyalty programs
ManagementApi get_loyalty_statistics GET /v1/loyalty_programs/{loyaltyProgramId}/statistics Get loyalty program statistics
ManagementApi get_notification_webhook GET /v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId} Get notification about campaign-related changes
ManagementApi get_notification_webhooks GET /v1/applications/{applicationId}/notification_webhooks List notifications about campaign-related changes
ManagementApi get_referrals_without_total_count GET /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/no_total List referrals
ManagementApi get_role GET /v1/roles/{roleId} Get role
ManagementApi get_ruleset GET /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets/{rulesetId} Get ruleset
ManagementApi get_rulesets GET /v1/applications/{applicationId}/campaigns/{campaignId}/rulesets List campaign rulesets
ManagementApi get_user GET /v1/users/{userId} Get user
ManagementApi get_users GET /v1/users List users in account
ManagementApi get_webhook GET /v1/webhooks/{webhookId} Get webhook
ManagementApi get_webhook_activation_logs GET /v1/webhook_activation_logs List webhook activation log entries
ManagementApi get_webhook_logs GET /v1/webhook_logs List webhook log entries
ManagementApi get_webhooks GET /v1/webhooks List webhooks
ManagementApi import_account_collection POST /v1/collections/{collectionId}/import Import data in existing account-level collection
ManagementApi import_allowed_list POST /v1/attributes/{attributeId}/allowed_list/import Import allowed values for attribute
ManagementApi import_collection POST /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}/import Import data in existing collection
ManagementApi import_coupons POST /v1/applications/{applicationId}/campaigns/{campaignId}/import_coupons Import coupons
ManagementApi import_loyalty_cards POST /v1/loyalty_programs/{loyaltyProgramId}/import_cards Import loyalty cards
ManagementApi import_loyalty_points POST /v1/loyalty_programs/{loyaltyProgramId}/import_points Import loyalty points
ManagementApi import_pool_giveaways POST /v1/giveaways/pools/{poolId}/import Import giveaway codes into a giveaway pool
ManagementApi import_referrals POST /v1/applications/{applicationId}/campaigns/{campaignId}/import_referrals Import referrals
ManagementApi list_account_collections GET /v1/collections List collections in account
ManagementApi list_collections GET /v1/applications/{applicationId}/campaigns/{campaignId}/collections List collections
ManagementApi list_collections_in_application GET /v1/applications/{applicationId}/collections List collections in application
ManagementApi post_added_deducted_points_notification POST /v1/loyalty_programs/{loyaltyProgramId}/notifications/added_deducted_points Create notification about added or deducted loyalty points
ManagementApi post_catalogs_strikethrough_notification POST /v1/catalogs/{applicationId}/notifications/strikethrough Create strikethrough notification
ManagementApi remove_loyalty_points PUT /v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/deduct_points Deduct points from customer profile
ManagementApi reset_password POST /v1/reset_password Reset password
ManagementApi search_coupons_advanced_application_wide_without_total_count POST /v1/applications/{applicationId}/coupons_search_advanced/no_total List coupons that match the given attributes (without total count)
ManagementApi search_coupons_advanced_without_total_count POST /v1/applications/{applicationId}/campaigns/{campaignId}/coupons_search_advanced/no_total List coupons that match the given attributes in campaign (without total count)
ManagementApi transfer_loyalty_card PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/transfer Transfer card data
ManagementApi update_account_collection PUT /v1/collections/{collectionId} Update account-level collection
ManagementApi update_additional_cost PUT /v1/additional_costs/{additionalCostId} Update additional cost
ManagementApi update_attribute PUT /v1/attributes/{attributeId} Update custom attribute
ManagementApi update_campaign PUT /v1/applications/{applicationId}/campaigns/{campaignId} Update campaign
ManagementApi update_collection PUT /v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId} Update collection description
ManagementApi update_coupon PUT /v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId} Update coupon
ManagementApi update_coupon_batch PUT /v1/applications/{applicationId}/campaigns/{campaignId}/coupons Update coupons
ManagementApi update_loyalty_card PUT /v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId} Update loyalty card status
ManagementApi update_notification_webhook PUT /v1/applications/{applicationId}/notification_webhooks/{notificationWebhookId} Update notification about campaign-related changes
ManagementApi update_referral PUT /v1/applications/{applicationId}/campaigns/{campaignId}/referrals/{referralId} Update referral

Documentation For Models

Documentation For Authorization

api_key_v1

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

management_key

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

manager_auth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%