Skip to content

Latest commit

 

History

History
482 lines (346 loc) · 19 KB

CampaignsApi.md

File metadata and controls

482 lines (346 loc) · 19 KB

sparkfly_client.CampaignsApi

All URIs are relative to https://api.sparkfly.com

Method HTTP request Description
create_campaign POST /v1.0/campaigns Create a new campaign
delete_campaign DELETE /v1.0/campaigns/{campaign_id} Delete the campaign
get_active_reward_program_campaigns GET /v1.0/campaigns/search Get active reward program campaigns
get_campaign GET /v1.0/campaigns/{campaign_id} Retrieve Campaign
get_campaign_by_external_id GET /v1.0/campaigns Get campaign by external ID
update_campaign PUT /v1.0/campaigns/{campaign_id} Update Campaign

create_campaign

CampaignResponse create_campaign(campaign_input_request=campaign_input_request)

Create a new campaign

Example

  • Api Key Authentication (X-Auth-Token):
import time
import os
import sparkfly_client
from sparkfly_client.models.campaign_input_request import CampaignInputRequest
from sparkfly_client.models.campaign_response import CampaignResponse
from sparkfly_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.sparkfly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = sparkfly_client.Configuration(
    host = "https://api.sparkfly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: X-Auth-Token
configuration.api_key['X-Auth-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Auth-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with sparkfly_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sparkfly_client.CampaignsApi(api_client)
    campaign_input_request = sparkfly_client.CampaignInputRequest() # CampaignInputRequest | Campaign to create (optional)

    try:
        # Create a new campaign
        api_response = api_instance.create_campaign(campaign_input_request=campaign_input_request)
        print("The response of CampaignsApi->create_campaign:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CampaignsApi->create_campaign: %s\n" % e)

Parameters

Name Type Description Notes
campaign_input_request CampaignInputRequest Campaign to create [optional]

Return type

CampaignResponse

Authorization

X-Auth-Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful creation of campaign * Cache-Control -
* Content-Length -
* Date -
400 Error parsing request * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* Set-Cookie -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
401 Unauthorized * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_campaign

delete_campaign(campaign_id)

Delete the campaign

Example

  • Api Key Authentication (X-Auth-Token):
import time
import os
import sparkfly_client
from sparkfly_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.sparkfly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = sparkfly_client.Configuration(
    host = "https://api.sparkfly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: X-Auth-Token
configuration.api_key['X-Auth-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Auth-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with sparkfly_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sparkfly_client.CampaignsApi(api_client)
    campaign_id = 56 # int | The id of the campaign

    try:
        # Delete the campaign
        api_instance.delete_campaign(campaign_id)
    except Exception as e:
        print("Exception when calling CampaignsApi->delete_campaign: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int The id of the campaign

Return type

void (empty response body)

Authorization

X-Auth-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
200 Successful deletion * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Etag -
* Server -
* Set-Cookie -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
401 Unauthorized * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
404 Campaign was not found by id * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* Set-Cookie -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_active_reward_program_campaigns

List[CampaignSimplified] get_active_reward_program_campaigns(channel_id)

Get active reward program campaigns

Example

  • Api Key Authentication (X-Auth-Token):
import time
import os
import sparkfly_client
from sparkfly_client.models.campaign_simplified import CampaignSimplified
from sparkfly_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.sparkfly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = sparkfly_client.Configuration(
    host = "https://api.sparkfly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: X-Auth-Token
configuration.api_key['X-Auth-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Auth-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with sparkfly_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sparkfly_client.CampaignsApi(api_client)
    channel_id = 56 # int | The id of the channel

    try:
        # Get active reward program campaigns
        api_response = api_instance.get_active_reward_program_campaigns(channel_id)
        print("The response of CampaignsApi->get_active_reward_program_campaigns:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CampaignsApi->get_active_reward_program_campaigns: %s\n" % e)

Parameters

Name Type Description Notes
channel_id int The id of the channel

Return type

List[CampaignSimplified]

Authorization

X-Auth-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful retrieval of active reward program campaigns * Cache-Control -
* Content-Length -
* Date -
* Etag -
* Server -
* Set-Cookie -
* X-Auth-Token -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
401 Unauthorized * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_campaign

CampaignResponse get_campaign(campaign_id)

Retrieve Campaign

Example

  • Api Key Authentication (X-Auth-Token):
import time
import os
import sparkfly_client
from sparkfly_client.models.campaign_response import CampaignResponse
from sparkfly_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.sparkfly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = sparkfly_client.Configuration(
    host = "https://api.sparkfly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: X-Auth-Token
configuration.api_key['X-Auth-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Auth-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with sparkfly_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sparkfly_client.CampaignsApi(api_client)
    campaign_id = 56 # int | The id of the campaign

    try:
        # Retrieve Campaign
        api_response = api_instance.get_campaign(campaign_id)
        print("The response of CampaignsApi->get_campaign:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CampaignsApi->get_campaign: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int The id of the campaign

Return type

CampaignResponse

Authorization

X-Auth-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful retrieval of campaign * Cache-Control -
* Content-Length -
* Content-Type -
* Server -
* Etag -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
* Date -
401 Unauthorized * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
404 Event was not found by id * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* Set-Cookie -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_campaign_by_external_id

CampaignResponse get_campaign_by_external_id(external_id=external_id)

Get campaign by external ID

Example

  • Api Key Authentication (X-Auth-Token):
import time
import os
import sparkfly_client
from sparkfly_client.models.campaign_response import CampaignResponse
from sparkfly_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.sparkfly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = sparkfly_client.Configuration(
    host = "https://api.sparkfly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: X-Auth-Token
configuration.api_key['X-Auth-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Auth-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with sparkfly_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sparkfly_client.CampaignsApi(api_client)
    external_id = 'external_id_example' # str | The id of the record in an external system (optional)

    try:
        # Get campaign by external ID
        api_response = api_instance.get_campaign_by_external_id(external_id=external_id)
        print("The response of CampaignsApi->get_campaign_by_external_id:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CampaignsApi->get_campaign_by_external_id: %s\n" % e)

Parameters

Name Type Description Notes
external_id str The id of the record in an external system [optional]

Return type

CampaignResponse

Authorization

X-Auth-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful retrieval of campaign * Cache-Control -
* Content-Length -
* Date -
401 Unauthorized * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_campaign

CampaignResponse update_campaign(campaign_id, campaign_input_request=campaign_input_request)

Update Campaign

Example

  • Api Key Authentication (X-Auth-Token):
import time
import os
import sparkfly_client
from sparkfly_client.models.campaign_input_request import CampaignInputRequest
from sparkfly_client.models.campaign_response import CampaignResponse
from sparkfly_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.sparkfly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = sparkfly_client.Configuration(
    host = "https://api.sparkfly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: X-Auth-Token
configuration.api_key['X-Auth-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-Auth-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with sparkfly_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sparkfly_client.CampaignsApi(api_client)
    campaign_id = 56 # int | The id of the campaign
    campaign_input_request = sparkfly_client.CampaignInputRequest() # CampaignInputRequest | The object that passes the updated campaign (optional)

    try:
        # Update Campaign
        api_response = api_instance.update_campaign(campaign_id, campaign_input_request=campaign_input_request)
        print("The response of CampaignsApi->update_campaign:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CampaignsApi->update_campaign: %s\n" % e)

Parameters

Name Type Description Notes
campaign_id int The id of the campaign
campaign_input_request CampaignInputRequest The object that passes the updated campaign [optional]

Return type

CampaignResponse

Authorization

X-Auth-Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful update of campaign * Cache-Control -
* Content-Length -
* Content-Type -
* Server -
* Etag -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
* Date -
400 Error parsing request * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* Set-Cookie -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
401 Unauthorized * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -
404 Campaign was not found by id * Cache-Control -
* Content-Length -
* Content-Type -
* Date -
* Server -
* Set-Cookie -
* X-Request-Id -
* X-Runtime -
* X-Ua-Compatible -

[Back to top] [Back to API list] [Back to Model list] [Back to README]