Skip to content

Latest commit

 

History

History
312 lines (249 loc) · 10.5 KB

File metadata and controls

312 lines (249 loc) · 10.5 KB

Voucherify.Api.SegmentsApi

All URIs are relative to https://api.voucherify.io

Method HTTP request Description
CreateSegment POST /v1/segments Create Segment
DeleteSegment DELETE /v1/segments/{segmentId} Delete Segment
GetSegment GET /v1/segments/{segmentId} Get Segment

CreateSegment

SegmentsCreateResponseBody CreateSegment (SegmentsCreateRequestBody segmentsCreateRequestBody)

Create Segment

Create a customer segment. 🚧 Limit on static segments There is a cap on the number of customers that you can assign to a static segment: 20,000. If you would like to create a bigger segment, then you can use the unlimited auto-update or passive segment instead and use some customer metadata to build this segment. 🚧 Limit on Active and Passive segments You can create a maximum of 100 passive and active segments.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;

namespace Example
{
    public class CreateSegmentExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.voucherify.io";
            // Configure API key authorization: X-App-Id
            config.AddApiKey("X-App-Id", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("X-App-Id", "Bearer");
            // Configure API key authorization: X-App-Token
            config.AddApiKey("X-App-Token", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("X-App-Token", "Bearer");
            // Configure OAuth2 access token for authorization: X-Voucherify-OAuth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new SegmentsApi(config);
            var segmentsCreateRequestBody = new SegmentsCreateRequestBody(); // SegmentsCreateRequestBody | Specify the boundary conditions for the customer segment.

            try
            {
                // Create Segment
                SegmentsCreateResponseBody result = apiInstance.CreateSegment(segmentsCreateRequestBody);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SegmentsApi.CreateSegment: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateSegmentWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Segment
    ApiResponse<SegmentsCreateResponseBody> response = apiInstance.CreateSegmentWithHttpInfo(segmentsCreateRequestBody);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SegmentsApi.CreateSegmentWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
segmentsCreateRequestBody SegmentsCreateRequestBody Specify the boundary conditions for the customer segment.

Return type

SegmentsCreateResponseBody

Authorization

X-App-Id, X-App-Token, X-Voucherify-OAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Returns a customer segment object. -

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

DeleteSegment

void DeleteSegment (string segmentId)

Delete Segment

This method deletes a customer segment.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;

namespace Example
{
    public class DeleteSegmentExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.voucherify.io";
            // Configure API key authorization: X-App-Id
            config.AddApiKey("X-App-Id", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("X-App-Id", "Bearer");
            // Configure API key authorization: X-App-Token
            config.AddApiKey("X-App-Token", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("X-App-Token", "Bearer");
            // Configure OAuth2 access token for authorization: X-Voucherify-OAuth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new SegmentsApi(config);
            var segmentId = "segmentId_example";  // string | A unique customer segment ID.

            try
            {
                // Delete Segment
                apiInstance.DeleteSegment(segmentId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SegmentsApi.DeleteSegment: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DeleteSegmentWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete Segment
    apiInstance.DeleteSegmentWithHttpInfo(segmentId);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SegmentsApi.DeleteSegmentWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
segmentId string A unique customer segment ID.

Return type

void (empty response body)

Authorization

X-App-Id, X-App-Token, X-Voucherify-OAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 Returns no content if deletion is successful. -

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

GetSegment

SegmentsGetResponseBody GetSegment (string segmentId)

Get Segment

Retrieves the segment with a given segment ID.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;

namespace Example
{
    public class GetSegmentExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.voucherify.io";
            // Configure API key authorization: X-App-Id
            config.AddApiKey("X-App-Id", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("X-App-Id", "Bearer");
            // Configure API key authorization: X-App-Token
            config.AddApiKey("X-App-Token", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("X-App-Token", "Bearer");
            // Configure OAuth2 access token for authorization: X-Voucherify-OAuth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new SegmentsApi(config);
            var segmentId = "segmentId_example";  // string | A unique customer segment ID.

            try
            {
                // Get Segment
                SegmentsGetResponseBody result = apiInstance.GetSegment(segmentId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SegmentsApi.GetSegment: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetSegmentWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Segment
    ApiResponse<SegmentsGetResponseBody> response = apiInstance.GetSegmentWithHttpInfo(segmentId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SegmentsApi.GetSegmentWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
segmentId string A unique customer segment ID.

Return type

SegmentsGetResponseBody

Authorization

X-App-Id, X-App-Token, X-Voucherify-OAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Returns segment object. -

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