Skip to content

Latest commit

 

History

History
558 lines (384 loc) · 18.4 KB

File metadata and controls

558 lines (384 loc) · 18.4 KB

Keap\Core\V2\SubscriptionsApi

All URIs are relative to https://api.keap.com/crm, except if the operation defines another base path.

Method HTTP request Description
cancelSubscription() POST /rest/v2/subscriptions/{subscription_id}:deactivate Cancel Subscription
createSubscription() POST /rest/v2/subscriptions Create Subscription
createSubscriptionCustomField() POST /rest/v2/subscriptions/model/customFields Create a Subscription Custom Field
deleteSubscriptionCustomField() DELETE /rest/v2/subscriptions/model/customFields/{custom_field_id} Delete a Subscription Custom Field
getSubscription() GET /rest/v2/subscriptions/{subscription_id} Retrieve a Subscription
listSubscriptions() GET /rest/v2/subscriptions List Subscriptions
retrieveSubscriptionCustomFieldModel() GET /rest/v2/subscriptions/model Retrieve Subscription Custom Field Model
updateSubscription() PATCH /rest/v2/subscriptions/{subscription_id} Update a Subscription
updateSubscriptionCustomField() PATCH /rest/v2/subscriptions/model/customFields/{custom_field_id} Update a Subscription Custom Field

cancelSubscription()

cancelSubscription($subscription_id, $cancel_subscription_request)

Cancel Subscription

Cancels the specified subscription

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$subscription_id = 'subscription_id_example'; // string
$cancel_subscription_request = new \Keap\Core\V2\Model\CancelSubscriptionRequest(); // \Keap\Core\V2\Model\CancelSubscriptionRequest

try {
    $apiInstance->cancelSubscription($subscription_id, $cancel_subscription_request);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->cancelSubscription: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
subscription_id string
cancel_subscription_request \Keap\Core\V2\Model\CancelSubscriptionRequest

Return type

void (empty response body)

Authorization

oauth2

HTTP request headers

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

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

createSubscription()

createSubscription($create_subscription_request_detail): \Keap\Core\V2\Model\SubscriptionDetail

Create Subscription

Creates a subscription with the specified product and product subscription id.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$create_subscription_request_detail = new \Keap\Core\V2\Model\CreateSubscriptionRequestDetail(); // \Keap\Core\V2\Model\CreateSubscriptionRequestDetail

try {
    $result = $apiInstance->createSubscription($create_subscription_request_detail);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->createSubscription: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
create_subscription_request_detail \Keap\Core\V2\Model\CreateSubscriptionRequestDetail

Return type

\Keap\Core\V2\Model\SubscriptionDetail

Authorization

oauth2

HTTP request headers

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

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

createSubscriptionCustomField()

createSubscriptionCustomField($create_custom_field_request): \Keap\Core\V2\Model\CustomFieldMetaData

Create a Subscription Custom Field

Creates a custom field of the specified type and options to the Subscription object

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$create_custom_field_request = new \Keap\Core\V2\Model\CreateCustomFieldRequest(); // \Keap\Core\V2\Model\CreateCustomFieldRequest

try {
    $result = $apiInstance->createSubscriptionCustomField($create_custom_field_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->createSubscriptionCustomField: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
create_custom_field_request \Keap\Core\V2\Model\CreateCustomFieldRequest

Return type

\Keap\Core\V2\Model\CustomFieldMetaData

Authorization

oauth2

HTTP request headers

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

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

deleteSubscriptionCustomField()

deleteSubscriptionCustomField($custom_field_id)

Delete a Subscription Custom Field

Deletes a custom field from the Subscription object

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$custom_field_id = 'custom_field_id_example'; // string

try {
    $apiInstance->deleteSubscriptionCustomField($custom_field_id);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->deleteSubscriptionCustomField: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
custom_field_id string

Return type

void (empty response body)

Authorization

oauth2

HTTP request headers

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

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

getSubscription()

getSubscription($subscription_id): \Keap\Core\V2\Model\SubscriptionDetail

Retrieve a Subscription

Retrieves a single subscription

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$subscription_id = 'subscription_id_example'; // string

try {
    $result = $apiInstance->getSubscription($subscription_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->getSubscription: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
subscription_id string

Return type

\Keap\Core\V2\Model\SubscriptionDetail

Authorization

oauth2

HTTP request headers

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

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

listSubscriptions()

listSubscriptions($filter, $order_by, $page_size, $page_token): \Keap\Core\V2\Model\ListSubscriptionsResponseList

List Subscriptions

Retrieves a list of subscriptions using the specified search criteria.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$filter = 'filter_example'; // string | Filter to apply, allowed fields are: - (String) `contact_id` - (String) `subscription_plan_id` - (String) `status`
$order_by = 'order_by_example'; // string | Attribute and direction to order items. One of the following fields: - `id` - `contact_id` - `subscription_plan_id`  One of the following directions: - `asc` - `desc`
$page_size = 0; // int | Total number of items to return per page
$page_token = 'page_token_example'; // string | Page token

try {
    $result = $apiInstance->listSubscriptions($filter, $order_by, $page_size, $page_token);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->listSubscriptions: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
filter string Filter to apply, allowed fields are: - (String) `contact_id` - (String) `subscription_plan_id` - (String) `status` [optional]
order_by string Attribute and direction to order items. One of the following fields: - `id` - `contact_id` - `subscription_plan_id` One of the following directions: - `asc` - `desc` [optional]
page_size int Total number of items to return per page [optional]
page_token string Page token [optional]

Return type

\Keap\Core\V2\Model\ListSubscriptionsResponseList

Authorization

oauth2

HTTP request headers

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

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

retrieveSubscriptionCustomFieldModel()

retrieveSubscriptionCustomFieldModel(): \Keap\Core\V2\Model\ObjectModel

Retrieve Subscription Custom Field Model

Get the custom fields for the Subscription object

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->retrieveSubscriptionCustomFieldModel();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->retrieveSubscriptionCustomFieldModel: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Keap\Core\V2\Model\ObjectModel

Authorization

oauth2

HTTP request headers

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

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

updateSubscription()

updateSubscription($subscription_id, $update_subscription_request_detail, $update_mask): \Keap\Core\V2\Model\SubscriptionDetail

Update a Subscription

Updates a Subscription

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$subscription_id = 'subscription_id_example'; // string
$update_subscription_request_detail = new \Keap\Core\V2\Model\UpdateSubscriptionRequestDetail(); // \Keap\Core\V2\Model\UpdateSubscriptionRequestDetail
$update_mask = 'update_mask_example'; // string | An optional list of properties to be updated. If set, only the provided properties will be updated and others will be skipped.

try {
    $result = $apiInstance->updateSubscription($subscription_id, $update_subscription_request_detail, $update_mask);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->updateSubscription: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
subscription_id string
update_subscription_request_detail \Keap\Core\V2\Model\UpdateSubscriptionRequestDetail
update_mask string An optional list of properties to be updated. If set, only the provided properties will be updated and others will be skipped. [optional]

Return type

\Keap\Core\V2\Model\SubscriptionDetail

Authorization

oauth2

HTTP request headers

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

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

updateSubscriptionCustomField()

updateSubscriptionCustomField($custom_field_id, $update_custom_field_meta_data_request, $update_mask): \Keap\Core\V2\Model\CustomFieldMetaData

Update a Subscription Custom Field

Updates a custom field of the specified type and options to the Subscription object

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\SubscriptionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$custom_field_id = 'custom_field_id_example'; // string
$update_custom_field_meta_data_request = new \Keap\Core\V2\Model\UpdateCustomFieldMetaDataRequest(); // \Keap\Core\V2\Model\UpdateCustomFieldMetaDataRequest
$update_mask = 'update_mask_example'; // string | An optional list of properties to be updated. If set, only the provided properties will be updated and others will be skipped.

try {
    $result = $apiInstance->updateSubscriptionCustomField($custom_field_id, $update_custom_field_meta_data_request, $update_mask);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SubscriptionsApi->updateSubscriptionCustomField: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
custom_field_id string
update_custom_field_meta_data_request \Keap\Core\V2\Model\UpdateCustomFieldMetaDataRequest
update_mask string An optional list of properties to be updated. If set, only the provided properties will be updated and others will be skipped. [optional]

Return type

\Keap\Core\V2\Model\CustomFieldMetaData

Authorization

oauth2

HTTP request headers

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

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