customer
/customer
/customer
To make working with our API easier, we package an SDK in the languages listed to the right. Select the language that you are interested in and sample code with additional commentary will be available. All of our APIs are available on GitHub at:
http://www.github.com/UltraCart/
By using an SDK you receive a number of important benefits.
There are four steps to instantiating the API.
The customer REST API has the capability to expand everything related to the customer including
the original and rebill order records. By default, when you read an customer, a
limited object is returned. If you specify the _expand
parameter, additional properties of the customer
object are returned. We encourage you to limit the amount of information that you query for customers
to the minimal amount possible to have optimal communication. The following expansion operations are
available.
Retrieves customers from the account. If no parameters are specified, all customers will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
SDK Function Name: getCustomers
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
query | string | optional | ||
qb_class | Quickbooks class | query | string | optional |
quickbooks_code | Quickbooks code | query | string | optional |
last_modified_dts_start | Last modified date start | query | string | optional |
last_modified_dts_end | Last modified date end | query | string | optional |
signup_dts_start | Signup date start | query | string | optional |
signup_dts_end | Signup date end | query | string | optional |
billing_first_name | Billing first name | query | string | optional |
billing_last_name | Billing last name | query | string | optional |
billing_company | Billing company | query | string | optional |
billing_city | Billing city | query | string | optional |
billing_state | Billing state | query | string | optional |
billing_postal_code | Billing postal code | query | string | optional |
billing_country_code | Billing country code | query | string | optional |
billing_day_phone | Billing day phone | query | string | optional |
billing_evening_phone | Billing evening phone | query | string | optional |
shipping_first_name | Shipping first name | query | string | optional |
shipping_last_name | Shipping last name | query | string | optional |
shipping_company | Shipping company | query | string | optional |
shipping_city | Shipping city | query | string | optional |
shipping_state | Shipping state | query | string | optional |
shipping_postal_code | Shipping postal code | query | string | optional |
shipping_country_code | Shipping country code | query | string | optional |
shipping_day_phone | Shipping day phone | query | string | optional |
shipping_evening_phone | Shipping evening phone | query | string | optional |
pricing_tier_oid | Pricing tier oid | query | integer (int32) | optional |
pricing_tier_name | Pricing tier name | query | string | optional |
_limit | The maximum number of records to return on this one API call. (Max 200)
Default: 100 |
query | integer | optional |
_offset | Pagination of the record set. Offset is a zero based index.
Default: 0 |
query | integer | optional |
_since | Fetch customers that have been created/modified since this date/time. | query | dateTime | optional |
_sort | The sort order of the customers. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
Allowed Values
|
query | string | optional |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Collections.Generic;
using System.Linq;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class GetCustomers
{
/**
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
* This method was the first GetCustomers and has parameters for all the search terms. It's an ogre. Using
* GetCustomersByQuery is much easier to use.
*/
public static List<Customer> GetCustomerChunk(CustomerApi customerApi, int offset, int limit)
{
// The real devil in the GetCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
string expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: Seriously, use GetCustomersByQuery -- it's so much better than this old method.
string email = null;
string qbClass = null;
string quickbooksCode = null;
string lastModifiedDtsStart = null;
string lastModifiedDtsEnd = null;
string signupDtsStart = null;
string signupDtsEnd = null;
string billingFirstName = null;
string billingLastName = null;
string billingCompany = null;
string billingCity = null;
string billingState = null;
string billingPostalCode = null;
string billingCountryCode = null;
string billingDayPhone = null;
string billingEveningPhone = null;
string shippingFirstName = null;
string shippingLastName = null;
string shippingCompany = null;
string shippingCity = null;
string shippingState = null;
string shippingPostalCode = null;
string shippingCountryCode = null;
string shippingDayPhone = null;
string shippingEveningPhone = null;
int? pricingTierOid = null;
string pricingTierName = null;
string since = null;
string sort = null;
CustomersResponse apiResponse = customerApi.GetCustomers(
email, qbClass, quickbooksCode, lastModifiedDtsStart, lastModifiedDtsEnd, signupDtsStart, signupDtsEnd,
billingFirstName, billingLastName, billingCompany, billingCity, billingState, billingPostalCode,
billingCountryCode, billingDayPhone, billingEveningPhone, shippingFirstName, shippingLastName,
shippingCompany, shippingCity, shippingState, shippingPostalCode, shippingCountryCode,
shippingDayPhone, shippingEveningPhone, pricingTierOid, pricingTierName, limit, offset, since, sort, expand);
if (apiResponse.Customers != null)
{
return apiResponse.Customers.ToList();
}
return new List<Customer>();
}
public static void Execute()
{
try
{
CustomerApi customerApi = Samples.GetCustomerApi();
List<Customer> customers = new List<Customer>();
int iteration = 1;
int offset = 0;
int limit = 200;
bool moreRecordsToFetch = true;
while (moreRecordsToFetch)
{
Console.WriteLine($"Executing iteration {iteration}");
List<Customer> chunkOfCustomers = GetCustomerChunk(customerApi, offset, limit);
customers.AddRange(chunkOfCustomers);
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.Count == limit;
iteration++;
}
// This will be verbose...
Console.WriteLine(customers);
}
catch (Exception ex)
{
Console.Error.WriteLine($"Exception occurred: {ex.Message}");
Console.Error.WriteLine(ex);
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.Customer;
import com.ultracart.admin.v2.models.CustomersResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.util.ArrayList;
import java.util.List;
public class GetCustomers {
/**
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
* This method was the first GetCustomers and has parameters for all the search terms. It's an ogre. Using
* GetCustomersByQuery is much easier to use.
*/
public static List<Customer> getCustomerChunk(CustomerApi customerApi, int offset, int limit) throws ApiException {
// The real devil in the GetCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
String expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: Seriously, use GetCustomersByQuery -- it's so much better than this old method.
String email = null;
String qbClass = null;
String quickbooksCode = null;
String lastModifiedDtsStart = null;
String lastModifiedDtsEnd = null;
String signupDtsStart = null;
String signupDtsEnd = null;
String billingFirstName = null;
String billingLastName = null;
String billingCompany = null;
String billingCity = null;
String billingState = null;
String billingPostalCode = null;
String billingCountryCode = null;
String billingDayPhone = null;
String billingEveningPhone = null;
String shippingFirstName = null;
String shippingLastName = null;
String shippingCompany = null;
String shippingCity = null;
String shippingState = null;
String shippingPostalCode = null;
String shippingCountryCode = null;
String shippingDayPhone = null;
String shippingEveningPhone = null;
Integer pricingTierOid = null;
String pricingTierName = null;
String since = null;
String sort = null;
CustomersResponse apiResponse = customerApi.getCustomers(
email, qbClass, quickbooksCode, lastModifiedDtsStart, lastModifiedDtsEnd, signupDtsStart, signupDtsEnd,
billingFirstName, billingLastName, billingCompany, billingCity, billingState, billingPostalCode,
billingCountryCode, billingDayPhone, billingEveningPhone, shippingFirstName, shippingLastName,
shippingCompany, shippingCity, shippingState, shippingPostalCode, shippingCountryCode,
shippingDayPhone, shippingEveningPhone, pricingTierOid, pricingTierName, limit, offset, since, sort, expand);
if (apiResponse.getCustomers() != null) {
return apiResponse.getCustomers();
}
return new ArrayList<>();
}
public static void Execute() {
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
List<Customer> customers = new ArrayList<>();
int iteration = 1;
int offset = 0;
int limit = 200;
boolean moreRecordsToFetch = true;
while (moreRecordsToFetch) {
System.out.println("Executing iteration " + iteration);
List<Customer> chunkOfCustomers = getCustomerChunk(customerApi, offset, limit);
customers.addAll(chunkOfCustomers);
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.size() == limit;
iteration++;
}
// This will be verbose...
System.out.println(customers);
}
catch (Exception ex) {
System.err.println("Exception occurred: " + ex.getMessage());
System.err.println(ex);
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
export class GetCustomers {
/**
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
* This method was the first GetCustomers and has parameters for all the search terms. It's an ogre. Using
* GetCustomersByQuery is much easier to use.
*/
static async getCustomerChunk(offset, limit) {
// The real devil in the GetCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
const expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: Seriously, use GetCustomersByQuery -- it's so much better than this old method.
const params = {
email: undefined,
qbClass: undefined,
quickbooksCode: undefined,
lastModifiedDtsStart: undefined,
lastModifiedDtsEnd: undefined,
signupDtsStart: undefined,
signupDtsEnd: undefined,
billingFirstName: undefined,
billingLastName: undefined,
billingCompany: undefined,
billingCity: undefined,
billingState: undefined,
billingPostalCode: undefined,
billingCountryCode: undefined,
billingDayPhone: undefined,
billingEveningPhone: undefined,
shippingFirstName: undefined,
shippingLastName: undefined,
shippingCompany: undefined,
shippingCity: undefined,
shippingState: undefined,
shippingPostalCode: undefined,
shippingCountryCode: undefined,
shippingDayPhone: undefined,
shippingEveningPhone: undefined,
pricingTierOid: undefined,
pricingTierName: undefined,
_limit: limit,
_offset: offset,
_since: undefined,
_sort: undefined,
_expand: expand
};
const apiResponse = await new Promise((resolve, reject) => {
customerApi.getCustomers(params, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (apiResponse.customers) {
return apiResponse.customers;
}
return [];
}
static async execute() {
try {
const customers = [];
let iteration = 1;
let offset = 0;
const limit = 200;
let moreRecordsToFetch = true;
while (moreRecordsToFetch) {
console.log(`Executing iteration ${iteration}`);
const chunkOfCustomers = await GetCustomers.getCustomerChunk(offset, limit);
customers.push(...chunkOfCustomers);
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.length === limit;
iteration++;
}
// This will be verbose...
console.log(customers);
} catch (ex) {
console.error(`Exception occurred: ${ex.message}`);
console.error(ex);
process.exit(1);
}
}
}
<?php
set_time_limit(3000); // pulling all records could take a long time.
ini_set('max_execution_time', 3000);
ini_set('display_errors', 1);
/*
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
* This method was the first getCustomers and has parameters for all the search terms. It's an ogre. Using
* getCustomersByQuery is much easier to use.
*/
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
require_once '../vendor/autoload.php';
require_once '../samples.php';
$customer_api = Samples::getCustomerApi();
/**
* @throws ApiException
*/
function getCustomerChunk(CustomerApi $customer_api, int $offset, int $limit): array
{
// The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
$_expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: Seriously, use getCustomersByQuery -- it's so much better than this old method.
$email = null;
$qb_class = null;
$quickbooks_code = null;
$last_modified_dts_start = null;
$last_modified_dts_end = null;
$signup_dts_start = null;
$signup_dts_end = null;
$billing_first_name = null;
$billing_last_name = null;
$billing_company = null;
$billing_city = null;
$billing_state = null;
$billing_postal_code = null;
$billing_country_code = null;
$billing_day_phone = null;
$billing_evening_phone = null;
$shipping_first_name = null;
$shipping_last_name = null;
$shipping_company = null;
$shipping_city = null;
$shipping_state = null;
$shipping_postal_code = null;
$shipping_country_code = null;
$shipping_day_phone = null;
$shipping_evening_phone = null;
$pricing_tier_oid = null;
$pricing_tier_name = null;
$_limit = $limit;
$_offset = $offset;
$_since = null;
$_sort = null;
$api_response = $customer_api->getCustomers($email, $qb_class, $quickbooks_code, $last_modified_dts_start, $last_modified_dts_end, $signup_dts_start, $signup_dts_end, $billing_first_name, $billing_last_name, $billing_company, $billing_city, $billing_state, $billing_postal_code, $billing_country_code, $billing_day_phone, $billing_evening_phone, $shipping_first_name, $shipping_last_name, $shipping_company, $shipping_city, $shipping_state, $shipping_postal_code, $shipping_country_code, $shipping_day_phone, $shipping_evening_phone, $pricing_tier_oid, $pricing_tier_name, $_limit, $_offset, $_since, $_sort, $_expand);
if ($api_response->getCustomers() != null) {
return $api_response->getCustomers();
}
return [];
}
$customers = [];
$iteration = 1;
$offset = 0;
$limit = 200;
$more_records_to_fetch = true;
try {
while ($more_records_to_fetch) {
echo "executing iteration " . $iteration . '<br>';
$chunk_of_customers = getCustomerChunk($customer_api, $offset, $limit);
$orders = array_merge($customers, $chunk_of_customers);
$offset = $offset + $limit;
$more_records_to_fetch = count($chunk_of_customers) == $limit;
$iteration++;
}
} catch (ApiException $e) {
echo 'ApiException occurred on iteration ' . $iteration;
var_dump($e);
die(1);
}
// this will be verbose...
var_dump($customers);
import time
from typing import List, Optional
from ultracart.apis import CustomerApi
from ultracart.api_client import ApiException
from samples import api_client
def get_customer_chunk(
customer_api: CustomerApi,
offset: int,
limit: int
) -> List[dict]:
"""
Retrieve a chunk of customers with specified expansion and pagination.
Possible expansion values include:
attachments, billing, cards, cc_emails, loyalty, orders_summary,
pricing_tiers, privacy, properties, quotes_summary, reviewer,
shipping, software_entitlements, tags, tax_codes
"""
# Just the address fields. Contact support if unsure.
expand = "shipping,billing"
# Set all search parameters to None
search_params = {
'email': None,
'qb_class': None,
'quickbooks_code': None,
'last_modified_dts_start': None,
'last_modified_dts_end': None,
'signup_dts_start': None,
'signup_dts_end': None,
'billing_first_name': None,
'billing_last_name': None,
'billing_company': None,
'billing_city': None,
'billing_state': None,
'billing_postal_code': None,
'billing_country_code': None,
'billing_day_phone': None,
'billing_evening_phone': None,
'shipping_first_name': None,
'shipping_last_name': None,
'shipping_company': None,
'shipping_city': None,
'shipping_state': None,
'shipping_postal_code': None,
'shipping_country_code': None,
'shipping_day_phone': None,
'shipping_evening_phone': None,
'pricing_tier_oid': None,
'pricing_tier_name': None,
'limit': limit,
'offset': offset,
'since': None,
'sort': None,
'expand': expand
}
# Remove keys with None values to match UltraCart API expectations
filtered_params = {k: v for k, v in search_params.items() if v is not None}
# Retrieve customer chunk
api_response = customer_api.get_customers(**filtered_params)
# Return customers or empty list
return api_response.customers or []
def retrieve_all_customers():
"""
Retrieve all customers using pagination.
Note: TODO - Consider using getCustomersByQuery for easier retrieval.
"""
# Initialize parameters
customers = []
iteration = 1
offset = 0
limit = 200
more_records_to_fetch = True
try:
# Create API client
customer_api = CustomerApi(api_client())
# Pagination loop
while more_records_to_fetch:
print(f"executing iteration {iteration}")
# Fetch customer chunk
chunk_of_customers = get_customer_chunk(customer_api, offset, limit)
# Merge customers
customers.extend(chunk_of_customers)
# Update pagination parameters
offset += limit
more_records_to_fetch = len(chunk_of_customers) == limit
iteration += 1
except ApiException as e:
print(f'ApiException occurred on iteration {iteration}')
print(e)
raise
# Return or print customers
return customers
# Run the retrieval if script is executed directly
if __name__ == '__main__':
try:
# Simulate PHP's set_time_limit and ini_set
# Note: In Python, these are typically handled differently depending on the environment
# This is just a rough approximation
start_time = time.time()
max_execution_time = 3000 # 50 minutes
all_customers = retrieve_all_customers()
# Print or process customers
print(f"Total customers retrieved: {len(all_customers)}")
# Uncomment the following line to print full details (can be very verbose)
# print(all_customers)
except Exception as e:
print("An error occurred:")
print(e)
#!/usr/bin/env ruby
require 'ultracart_api'
require_relative '../constants'
# Adjust process time limits (Ruby doesn't have direct equivalents to PHP's set_time_limit and ini_set)
# Note: These are more commonly handled by the runtime environment in Ruby
=begin
This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
This method was the first getCustomers and has parameters for all the search terms. It's an ogre. Using
getCustomersByQuery is much easier to use.
=end
def get_customer_chunk(customer_api, offset, limit)
# The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
# returning everything since these objects are extremely large. The customer object can be truly large with
# all the order history. These are the possible expansion values:
#
# attachments billing cards cc_emails loyalty orders_summary pricing_tiers
# privacy properties quotes_summary reviewer shipping software_entitlements tags
# tax_codes
# Just the address fields. Contact us if you're unsure
expand = "shipping,billing"
# TODO: Seriously, use getCustomersByQuery -- it's so much better than this old method.
# Prepare all the nil parameters
search_params = {
email: nil,
qb_class: nil,
quickbooks_code: nil,
last_modified_dts_start: nil,
last_modified_dts_end: nil,
signup_dts_start: nil,
signup_dts_end: nil,
billing_first_name: nil,
billing_last_name: nil,
billing_company: nil,
billing_city: nil,
billing_state: nil,
billing_postal_code: nil,
billing_country_code: nil,
billing_day_phone: nil,
billing_evening_phone: nil,
shipping_first_name: nil,
shipping_last_name: nil,
shipping_company: nil,
shipping_city: nil,
shipping_state: nil,
shipping_postal_code: nil,
shipping_country_code: nil,
shipping_day_phone: nil,
shipping_evening_phone: nil,
pricing_tier_oid: nil,
pricing_tier_name: nil
}
# Call the API with all parameters
api_response = customer_api.get_customers(
**search_params,
limit: limit,
offset: offset,
since: nil,
sort: nil,
opts: {
'_expand' => expand
}
)
# Return customers or empty array
api_response.customers || []
end
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Prepare for pagination
customers = []
iteration = 1
offset = 0
limit = 200
more_records_to_fetch = true
begin
while more_records_to_fetch
puts "executing iteration #{iteration}"
# Fetch a chunk of customers
chunk_of_customers = get_customer_chunk(customer_api, offset, limit)
# Merge with existing customers
customers.concat(chunk_of_customers)
# Update offset and check if more records exist
offset += limit
more_records_to_fetch = chunk_of_customers.length == limit
iteration += 1
end
rescue UltracartClient::ApiError => e
puts "ApiError occurred on iteration #{iteration}"
p e
exit 1
end
# This will be verbose...
p customers
import { customerApi } from '../api';
import { Customer, CustomersResponse } from 'ultracart_rest_api_v2_typescript';
export class GetCustomers {
/**
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
* This method was the first GetCustomers and has parameters for all the search terms. It's an ogre. Using
* GetCustomersByQuery is much easier to use.
*/
private static async getCustomerChunk(offset: number, limit: number): Promise<Customer[]> {
// The real devil in the GetCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
const expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: Seriously, use GetCustomersByQuery -- it's so much better than this old method.
const params = {
email: undefined,
qbClass: undefined,
quickbooksCode: undefined,
lastModifiedDtsStart: undefined,
lastModifiedDtsEnd: undefined,
signupDtsStart: undefined,
signupDtsEnd: undefined,
billingFirstName: undefined,
billingLastName: undefined,
billingCompany: undefined,
billingCity: undefined,
billingState: undefined,
billingPostalCode: undefined,
billingCountryCode: undefined,
billingDayPhone: undefined,
billingEveningPhone: undefined,
shippingFirstName: undefined,
shippingLastName: undefined,
shippingCompany: undefined,
shippingCity: undefined,
shippingState: undefined,
shippingPostalCode: undefined,
shippingCountryCode: undefined,
shippingDayPhone: undefined,
shippingEveningPhone: undefined,
pricingTierOid: undefined as number | undefined,
pricingTierName: undefined,
limit: limit,
offset: offset,
since: undefined,
sort: undefined,
expand: expand
};
const apiResponse: CustomersResponse = await customerApi.getCustomers(params);
if (apiResponse.customers) {
return apiResponse.customers;
}
return [];
}
public static async execute(): Promise<void> {
try {
const customers: Customer[] = [];
let iteration = 1;
let offset = 0;
const limit = 200;
let moreRecordsToFetch = true;
while (moreRecordsToFetch) {
console.log(`Executing iteration ${iteration}`);
const chunkOfCustomers = await GetCustomers.getCustomerChunk(offset, limit);
customers.push(...chunkOfCustomers);
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.length === limit;
iteration++;
}
// This will be verbose...
console.log(customers);
} catch (ex) {
console.error(`Exception occurred: ${(ex as Error).message}`);
console.error(ex);
process.exit(1);
}
}
}
Insert a customer on the UltraCart account.
SDK Function Name: insertCustomer
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer | Customer to insert | body | Customer | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Client;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class InsertCustomer
{
public static void Execute()
{
try
{
int customerOid = CustomerFunctions.InsertSampleCustomer();
CustomerFunctions.DeleteSampleCustomer(customerOid);
}
catch (ApiException e)
{
Console.WriteLine("An ApiException occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.util.ApiException;
public class InsertCustomer {
public static void execute() {
try {
int customerOid = CustomerFunctions.insertSampleCustomer();
CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ApiException e) {
System.err.println("An ApiException occurred. Please review the following error:");
e.printStackTrace();
System.exit(1);
}
}
}
import { CustomerFunctions } from './customerFunctions.js';
export class InsertCustomer {
static async execute() {
const customerOid = await CustomerFunctions.insertSampleCustomer();
await CustomerFunctions.deleteSampleCustomer(customerOid);
}
}
<?php
use ultracart\v2\ApiException;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
try {
$customer_oid = insertSampleCustomer();
deleteSampleCustomer($customer_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.api_client import ApiException
from customer_functions import insert_sample_customer, delete_sample_customer
def create_and_delete_customer():
"""
Demonstrate creating and immediately deleting a sample customer.
"""
try:
# Insert a sample customer
customer_oid = insert_sample_customer()
# Delete the sample customer
delete_sample_customer(customer_oid)
except ApiException as e:
print('An ApiException occurred. Please review the following error:')
print(e)
raise
# Run the function if the script is executed directly
if __name__ == '__main__':
create_and_delete_customer()
# frozen_string_literal: true
require 'json'
require 'ultracart_api'
simple_key = '109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00'
customer_api = UltracartClient::CustomerApi.new_using_api_key(simple_key, false, false)
customer = UltracartClient::Customer.new
customer.email = "joe-#{rand}@aol.com"
customer.password = "pw#{rand}"
shipping = UltracartClient::CustomerShipping.new
shipping.first_name = 'Joe'
shipping.last_name = 'Smith'
shipping.address1 = '206 Washington St SW'
shipping.city = 'Atlanta'
shipping.state_region = 'GA'
shipping.postal_code = '30334'
customer.shipping = [shipping] # notice this is an array of one shipping address (for now)
billing = UltracartClient::CustomerBilling.new
billing.first_name = 'Joe'
billing.last_name = 'Smith'
billing.company = 'Joe Inc.'
billing.day_phone = '4046561776'
billing.address1 = '206 Washington St SW'
billing.city = 'Atlanta'
billing.state_region = 'GA'
billing.postal_code = '30334'
customer.billing = [billing] # notice this is an array of one shipping address (for now)
# by default, UltraCart returns a minimal object. If we want to see all the information we submitted, we need to
# ask for it back. If we're only doing an insert and we don't care, _expand may be left empty.
# Possible expansion components:
# shipping
# billing
# cards
# pricing_tiers
# cc_emails
# orders_summary
# quotes_summary
# tax_codes
# privacy
# reviewer
# attachments
# software_entitlements
# tags
# loyalty
opts = {_expand: 'shipping,billing'}
begin
customer_response = customer_api.insert_customer(customer, opts)
puts customer_response.to_json
rescue UltracartClient::ApiError => ex
puts "Error inserting customer: #{ex.json}"
# Ruby does not give detailed error information. Check the server logs.
# Login to secure.ultracart.com, navigate to Home->Configuration->Development->API Keys
# click the "log" button for your API key.
end
import {CustomerFunctions} from './CustomerFunctions';
export class InsertCustomer {
public static async execute(): Promise<void> {
const customerOid: number = await CustomerFunctions.insertSampleCustomer();
await CustomerFunctions.deleteSampleCustomer(customerOid);
}
}
Retrieves a single customer using the specified customer email address.
SDK Function Name: getCustomerByEmail
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
The email address of the customer to retrieve. | path | string | required | |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class GetCustomerByEmail
{
/**
* Of the two GetCustomer methods, you'll probably always use this one over GetCustomer.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But our sample functions return back the oid, so we'll ignore that and just
* use the email that we create.
*/
public static void Execute()
{
try
{
string email = CustomerFunctions.CreateRandomEmail();
int customerOid = CustomerFunctions.InsertSampleCustomer(email);
CustomerApi customerApi = Samples.GetCustomerApi();
// the _expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
CustomerResponse apiResponse = customerApi.GetCustomerByEmail(email, "billing,shipping");
Customer customer = apiResponse.Customer; // assuming this succeeded
Console.WriteLine(customer);
CustomerFunctions.DeleteSampleCustomer(customerOid);
}
catch (Exception ex)
{
Console.Error.WriteLine("An Exception occurred. Please review the following error:");
Console.Error.WriteLine(ex); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.Customer;
import com.ultracart.admin.v2.models.CustomerResponse;
import common.Constants;
public class GetCustomerByEmail {
/**
* Of the two GetCustomer methods, you'll probably always use this one over GetCustomer.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But our sample functions return back the oid, so we'll ignore that and just
* use the email that we create.
*/
public static void Execute() {
try {
String email = CustomerFunctions.createRandomEmail();
int customerOid = CustomerFunctions.insertSampleCustomer(email);
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// the _expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
CustomerResponse apiResponse = customerApi.getCustomerByEmail(email, "billing,shipping");
Customer customer = apiResponse.getCustomer(); // assuming this succeeded
System.out.println(customer);
CustomerFunctions.deleteSampleCustomer(customerOid);
}
catch (Exception ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex); // <-- change_me: handle gracefully
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {CustomerFunctions} from './customerFunctions.js';
export class GetCustomerByEmail {
/**
* Of the two GetCustomer methods, you'll probably always use this one over GetCustomer.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But our sample functions return back the oid, so we'll ignore that and just
* use the email that we create.
*/
static async execute() {
try {
const email = CustomerFunctions.createRandomEmail();
const customerOid = await CustomerFunctions.insertSampleCustomer(email);
// the expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
const apiResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerByEmail(email, {_expand: 'billing,shipping'}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const customer = apiResponse.customer; // assuming this succeeded
console.log(customer);
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
/** @noinspection SpellCheckingInspection */
/** @noinspection GrazieInspection */
use ultracart\v2\ApiException;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
// Of the two getCustomer methods, you'll probably always use this one over getCustomer.
// Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
// key in the UltraCart databases. But our sample functions return back the oid, so we'll ignore that and just
// use the email that we create.
try {
$email = createRandomEmail();
$customer_oid = insertSampleCustomer($email);
$customer_api = Samples::getCustomerApi();
// the _expand variable is set to return just the address fields.
// see customer_functions.php for a list of expansions, or consult the source: https://www.ultracart.com/api/
$api_response = $customer_api->getCustomerByEmail($email, "billing,shipping");
$customer = $api_response->getCustomer(); // assuming this succeeded
var_dump($customer);
deleteSampleCustomer($customer_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from samples import api_client
from customer_functions import (
insert_sample_customer,
delete_sample_customer,
create_random_email
)
def main():
try:
# Create a sample customer with a random email
email = create_random_email()
customer_oid = insert_sample_customer(email)
# Create customer API instance
customer_api = CustomerApi(api_client())
# Retrieve customer by email with expanded billing and shipping details
# Most customer logic revolves around email, not customer OID
api_response = customer_api.get_customer_by_email(email, expand="billing,shipping")
customer = api_response.customer # Assuming retrieval succeeded
# Print customer details
print(customer)
# Clean up the sample customer
delete_sample_customer(customer_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
require 'ultracart_api'
require_relative '../constants'
require_relative './customer_functions'
# Of the two getCustomer methods, you'll probably always use this one over getCustomer.
# Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
# key in the UltraCart databases. But our sample functions return back the oid, so we'll ignore that and just
# use the email that we create.
begin
# Create a random email and insert a sample customer
email = create_random_email
customer_oid = insert_sample_customer(email)
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# The _expand variable is set to return just the address fields.
# See customer_functions.rb for a list of expansions, or consult the source: https://www.ultracart.com/api/
api_response = customer_api.get_customer_by_email(
email,
opts: {
'_expand' => 'billing,shipping'
}
)
# Assuming this succeeded
customer = api_response.customer
# Output the customer details
p customer
# Delete the sample customer
delete_sample_customer(customer_oid)
rescue UltracartClient::ApiError => e
puts 'An ApiError occurred. Please review the following error:'
p e
exit 1
end
import {customerApi} from '../api';
import {Customer, CustomerResponse} from 'ultracart_rest_api_v2_typescript';
import {CustomerFunctions} from './CustomerFunctions';
export class GetCustomerByEmail {
/**
* Of the two GetCustomer methods, you'll probably always use this one over GetCustomer.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But our sample functions return back the oid, so we'll ignore that and just
* use the email that we create.
*/
public static async execute(): Promise<void> {
try {
const email: string = CustomerFunctions.createRandomEmail();
const customerOid: number = await CustomerFunctions.insertSampleCustomer(email);
// the expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
const apiResponse: CustomerResponse = await customerApi.getCustomerByEmail({
email: email,
expand: 'billing,shipping'
});
const customer: Customer | undefined = apiResponse.customer; // assuming this succeeded
console.log(customer);
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Retrieves customers from the account. If no searches are specified, all customers will be returned.
SDK Function Name: getCustomersForDataTables
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
// This is an internal method used by our Customer management screen. It won't be of much use to you, so we're
// not including a sample. getCustomer, getCustomerByEmail, getCustomers and getCustomersByQuery are more useful
// This is an internal method used by our Customer management screen. It won't be of much use to you, so we're
// not including a sample. getCustomer, getCustomerByEmail, getCustomers and getCustomersByQuery are more useful
// This is an internal method used by our Customer management screen. It won't be of much use to you, so we're
// not including a sample. getCustomer, getCustomerByEmail, getCustomers and getCustomersByQuery are more useful
<?php
// This is an internal method used by our Customer management screen. It won't be of much use to you, so we're
// not including a sample. getCustomer, getCustomerByEmail, getCustomers and getCustomersByQuery are more useful
# This is an internal method used by our Customer management screen. It won't be of much use to you, so we're
# not including a sample. getCustomer, getCustomerByEmail, getCustomers and getCustomersByQuery are more useful
# This is an internal method used by our Customer management screen. It won't be of much use to you, so we're
# not including a sample. getCustomer, getCustomerByEmail, getCustomers and getCustomersByQuery are more useful
// This is an internal method used by our Customer management screen. It won't be of much use to you, so we're
// not including a sample. getCustomer, getCustomerByEmail, getCustomers and getCustomersByQuery are more useful
Create a token that can be used to verify a customer email address. The implementation of how a customer interacts with this token is left to the merchant.
SDK Function Name: getEmailVerificationToken
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
token_request | Token request | body | EmailVerifyTokenRequest | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class GetEmailVerificationToken
{
/*
GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
ValidateEmailVerificationToken will validate the token.
Notice that GetEmailVerificationToken requires both the email and password.
*/
public static void Execute()
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
string email = "test@ultracart.com";
string password = "squirrel";
EmailVerifyTokenRequest tokenRequest = new EmailVerifyTokenRequest();
tokenRequest.Email = email;
tokenRequest.Password = password;
EmailVerifyTokenResponse tokenResponse = customerApi.GetEmailVerificationToken(tokenRequest);
string token = tokenResponse.Token;
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
EmailVerifyTokenValidateRequest verifyRequest = new EmailVerifyTokenValidateRequest();
verifyRequest.Token = token;
EmailVerifyTokenValidateResponse verifyResponse = customerApi.ValidateEmailVerificationToken(verifyRequest);
Console.WriteLine("Was the correct token provided? " + verifyResponse.Success);
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.EmailVerifyTokenRequest;
import com.ultracart.admin.v2.models.EmailVerifyTokenResponse;
import com.ultracart.admin.v2.models.EmailVerifyTokenValidateRequest;
import com.ultracart.admin.v2.models.EmailVerifyTokenValidateResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
/*
GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
ValidateEmailVerificationToken will validate the token.
Notice that GetEmailVerificationToken requires both the email and password.
*/
public class GetEmailVerificationToken {
public static void execute() {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
String email = "test@ultracart.com";
String password = "squirrel";
EmailVerifyTokenRequest tokenRequest = new EmailVerifyTokenRequest();
tokenRequest.email(email);
tokenRequest.password(password);
try {
EmailVerifyTokenResponse tokenResponse = customerApi.getEmailVerificationToken(tokenRequest);
String token = tokenResponse.getToken();
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
EmailVerifyTokenValidateRequest verifyRequest = new EmailVerifyTokenValidateRequest();
verifyRequest.token(token);
EmailVerifyTokenValidateResponse verifyResponse = customerApi.validateEmailVerificationToken(verifyRequest);
System.out.println("Was the correct token provided? " + verifyResponse.getSuccess());
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import {customerApi} from '../api.js';
export class GetEmailVerificationToken {
/*
GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
ValidateEmailVerificationToken will validate the token.
Notice that GetEmailVerificationToken requires both the email and password.
*/
static async execute() {
const email = "test@ultracart.com";
const password = "squirrel";
const tokenRequest = {
email: email,
password: password
};
const tokenResponse = await new Promise((resolve, reject) => {
customerApi.getEmailVerificationToken(tokenRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const token = tokenResponse.token;
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
const verifyRequest = {
token: token
};
const verifyResponse = await new Promise((resolve, reject) => {
customerApi.validateEmailVerificationToken(verifyRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
console.log("Was the correct token provided? " + verifyResponse.success);
}
}
<?php
ini_set('display_errors', 1);
/*
getEmailVerificationToken and validateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. getEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
validateEmailVerificationToken will validate the token.
Notice that getEmailVerificationToken requires both the email and password.
*/
use ultracart\v2\api\CustomerApi;
use ultracart\v2\models\AdjustInternalCertificateRequest;
use ultracart\v2\models\EmailVerifyTokenRequest;
use ultracart\v2\models\EmailVerifyTokenValidateRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
$email = "test@ultracart.com";
$password = "squirrel";
$tokenRequest = new EmailVerifyTokenRequest();
$tokenRequest->setEmail($email);
$tokenRequest->setPassword($password);
$tokenResponse = $customer_api->getEmailVerificationToken($tokenRequest);
$token = $tokenResponse->getToken();
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
$verifyRequest = new EmailVerifyTokenValidateRequest();
$verifyRequest->setToken($token);
$verifyResponse = $customer_api->validateEmailVerificationToken($verifyRequest);
echo 'Was the correct token provided? ' . $verifyResponse->getSuccess();
from ultracart.apis import CustomerApi
from ultracart.models import EmailVerifyTokenRequest, EmailVerifyTokenValidateRequest
from samples import api_client
def email_verification_demo():
"""
Demonstrates the email verification token process:
1. Get an email verification token
2. Validate the token
In a real-world scenario, you would:
- Email the token to the customer
- Have the customer enter the token back into your system
"""
# Create API client
customer_api = CustomerApi(api_client())
# Email and password for verification
email = "test@ultracart.com"
password = "squirrel"
# Create token request
token_request = EmailVerifyTokenRequest(
email=email,
password=password
)
try:
# Get email verification token
token_response = customer_api.get_email_verification_token(token_request)
token = token_response.token
# TODO: In a real application, email this token to the customer
# Verify the token
verify_request = EmailVerifyTokenValidateRequest(
token=token
)
verify_response = customer_api.validate_email_verification_token(verify_request)
# Print verification result
print(f'Was the correct token provided? {verify_response.success}')
except Exception as e:
print("An error occurred during email verification:")
print(e)
# Run the demo if script is executed directly
if __name__ == '__main__':
email_verification_demo()
require 'ultracart_api'
require_relative '../constants'
=begin
getEmailVerificationToken and validateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. getEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
validateEmailVerificationToken will validate the token.
Notice that getEmailVerificationToken requires both the email and password.
=end
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Set email and password
email = "test@ultracart.com"
password = "squirrel"
# Create token request
token_request = UltracartClient::EmailVerifyTokenRequest.new(
email: email,
password: password
)
# Get email verification token
token_response = customer_api.get_email_verification_token(token_request)
token = token_response.token
# TODO - email the token to the customer, have them enter it back into another page...
# TODO - verify the token with the following call
# Create verify request
verify_request = UltracartClient::EmailVerifyTokenValidateRequest.new(
token: token
)
# Validate email verification token
verify_response = customer_api.validate_email_verification_token(verify_request)
# Print verification result
puts "Was the correct token provided? #{verify_response.success}"
import {customerApi} from '../api';
import {
EmailVerifyTokenRequest,
EmailVerifyTokenResponse,
EmailVerifyTokenValidateRequest,
EmailVerifyTokenValidateResponse
} from 'ultracart_rest_api_v2_typescript';
export class GetEmailVerificationToken {
/*
GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
ValidateEmailVerificationToken will validate the token.
Notice that GetEmailVerificationToken requires both the email and password.
*/
public static async execute(): Promise<void> {
const email = "test@ultracart.com";
const password = "squirrel";
const tokenRequest: EmailVerifyTokenRequest = {
email: email,
password: password
};
const tokenResponse: EmailVerifyTokenResponse = await customerApi.getEmailVerificationToken({
tokenRequest: tokenRequest
});
const token = tokenResponse.token;
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
const verifyRequest: EmailVerifyTokenValidateRequest = {
token: token
};
const verifyResponse: EmailVerifyTokenValidateResponse = await customerApi.validateEmailVerificationToken({
validationRequest: verifyRequest
});
console.log("Was the correct token provided? " + verifyResponse.success);
}
}
Validate a token that can be used to verify a customer email address. The implementation of how a customer interacts with this token is left to the merchant.
SDK Function Name: validateEmailVerificationToken
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
validation_request | Token validation request | body | EmailVerifyTokenValidateRequest | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class ValidateEmailVerificationToken
{
public static void Execute()
{
/*
GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
ValidateEmailVerificationToken will validate the token.
Notice that GetEmailVerificationToken requires both the email and password.
*/
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
string email = "test@ultracart.com";
string password = "squirrel";
EmailVerifyTokenRequest tokenRequest = new EmailVerifyTokenRequest();
tokenRequest.Email = email;
tokenRequest.Password = password;
EmailVerifyTokenResponse tokenResponse = customerApi.GetEmailVerificationToken(tokenRequest);
string token = tokenResponse.Token;
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
EmailVerifyTokenValidateRequest verifyRequest = new EmailVerifyTokenValidateRequest();
verifyRequest.Token = token;
EmailVerifyTokenValidateResponse verifyResponse = customerApi.ValidateEmailVerificationToken(verifyRequest);
Console.WriteLine("Was the correct token provided? " + verifyResponse.Success);
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.*;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class ValidateEmailVerificationToken {
public static void execute() {
/*
GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
ValidateEmailVerificationToken will validate the token.
Notice that GetEmailVerificationToken requires both the email and password.
*/
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
String email = "test@ultracart.com";
String password = "squirrel";
EmailVerifyTokenRequest tokenRequest = new EmailVerifyTokenRequest();
tokenRequest.email(email);
tokenRequest.password(password);
EmailVerifyTokenResponse tokenResponse = customerApi.getEmailVerificationToken(tokenRequest);
String token = tokenResponse.getToken();
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
EmailVerifyTokenValidateRequest verifyRequest = new EmailVerifyTokenValidateRequest();
verifyRequest.token(token);
EmailVerifyTokenValidateResponse verifyResponse = customerApi.validateEmailVerificationToken(verifyRequest);
System.out.println("Was the correct token provided? " + verifyResponse.getSuccess());
} catch (ApiException e) {
e.printStackTrace();
}
}
}
import {customerApi} from '../api.js';
export class ValidateEmailVerificationToken {
/**
* GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
* a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
* they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
* it back into a website. Once the customer enters the token back into a site (along with their email),
* ValidateEmailVerificationToken will validate the token.
*
* Notice that GetEmailVerificationToken requires both the email and password.
*/
static async Execute() {
const email = "test@ultracart.com";
const password = "squirrel";
try {
// Create token request
const tokenRequest = {
email: email,
password: password
};
// Get email verification token
const tokenResponse = await new Promise((resolve, reject) => {
customerApi.getEmailVerificationToken(tokenRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const token = tokenResponse.token;
if (token == undefined) {
console.error("Token not found.");
return;
}
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
// Create verify request
const verifyRequest = {
token: token
};
// Validate email verification token
const verifyResponse = await new Promise((resolve, reject) => {
customerApi.validateEmailVerificationToken(verifyRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
console.log("Was the correct token provided? " + verifyResponse.success);
} catch (error) {
console.error("An error occurred during email verification:", error);
}
}
}
<?php
ini_set('display_errors', 1);
/*
getEmailVerificationToken and validateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. getEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
validateEmailVerificationToken will validate the token.
Notice that getEmailVerificationToken requires both the email and password.
*/
use ultracart\v2\api\CustomerApi;
use ultracart\v2\models\AdjustInternalCertificateRequest;
use ultracart\v2\models\EmailVerifyTokenRequest;
use ultracart\v2\models\EmailVerifyTokenValidateRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
$email = "test@ultracart.com";
$password = "squirrel";
$tokenRequest = new EmailVerifyTokenRequest();
$tokenRequest->setEmail($email);
$tokenRequest->setPassword($password);
$tokenResponse = $customer_api->getEmailVerificationToken($tokenRequest);
$token = $tokenResponse->getToken();
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
$verifyRequest = new EmailVerifyTokenValidateRequest();
$verifyRequest->setToken($token);
$verifyResponse = $customer_api->validateEmailVerificationToken($verifyRequest);
echo 'Was the correct token provided? ' . $verifyResponse->getSuccess();
from ultracart.apis import CustomerApi
from ultracart.models import EmailVerifyTokenRequest, EmailVerifyTokenValidateRequest
from samples import api_client
def email_verification_demo():
"""
Demonstrates the email verification token process:
1. Get an email verification token
2. Validate the token
In a real-world scenario, you would:
- Email the token to the customer
- Have the customer enter the token back into your system
"""
# Create API client
customer_api = CustomerApi(api_client())
# Email and password for verification
email = "test@ultracart.com"
password = "squirrel"
# Create token request
token_request = EmailVerifyTokenRequest(
email=email,
password=password
)
try:
# Get email verification token
token_response = customer_api.get_email_verification_token(token_request)
token = token_response.token
# TODO: In a real application, email this token to the customer
# Verify the token
verify_request = EmailVerifyTokenValidateRequest(
token=token
)
verify_response = customer_api.validate_email_verification_token(verify_request)
# Print verification result
print(f'Was the correct token provided? {verify_response.success}')
except Exception as e:
print("An error occurred during email verification:")
print(e)
# Run the demo if script is executed directly
if __name__ == '__main__':
email_verification_demo()
require 'ultracart_api'
require_relative '../constants'
=begin
getEmailVerificationToken and validateEmailVerificationToken are tandem functions that allow a merchant to verify
a customer's email address. getEmailVerificationToken returns back a token that the merchant can use however
they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
it back into a website. Once the customer enters the token back into a site (along with their email),
validateEmailVerificationToken will validate the token.
Notice that getEmailVerificationToken requires both the email and password.
=end
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Set email and password
email = "test@ultracart.com"
password = "squirrel"
# Create token request
token_request = UltracartClient::EmailVerifyTokenRequest.new(
email: email,
password: password
)
# Get email verification token
token_response = customer_api.get_email_verification_token(token_request)
token = token_response.token
# TODO - email the token to the customer, have them enter it back into another page...
# TODO - verify the token with the following call
# Create verify request
verify_request = UltracartClient::EmailVerifyTokenValidateRequest.new(
token: token
)
# Validate email verification token
verify_response = customer_api.validate_email_verification_token(verify_request)
# Print verification result
puts "Was the correct token provided? #{verify_response.success}"
import {
CustomerApi,
EmailVerifyTokenRequest,
EmailVerifyTokenResponse,
EmailVerifyTokenValidateRequest,
EmailVerifyTokenValidateResponse
} from 'ultracart_rest_api_v2_typescript';
import {customerApi} from '../api';
export class ValidateEmailVerificationToken {
/**
* GetEmailVerificationToken and ValidateEmailVerificationToken are tandem functions that allow a merchant to verify
* a customer's email address. GetEmailVerificationToken returns back a token that the merchant can use however
* they wish to present to a customer. Usually this will be emailed to the customer within instructions to enter
* it back into a website. Once the customer enters the token back into a site (along with their email),
* ValidateEmailVerificationToken will validate the token.
*
* Notice that GetEmailVerificationToken requires both the email and password.
*/
public static async Execute(): Promise<void> {
const email: string = "test@ultracart.com";
const password: string = "squirrel";
try {
// Create token request
const tokenRequest: EmailVerifyTokenRequest = {
email: email,
password: password
};
// Get email verification token
const tokenResponse: EmailVerifyTokenResponse = await customerApi.getEmailVerificationToken({tokenRequest});
const token: string | undefined = tokenResponse.token;
if (token == undefined) {
console.error("Token not found.");
return;
}
// TODO - email the token to the customer, have them enter it back into another page...
// TODO - verify the token with the following call
// Create verify request
const verifyRequest: EmailVerifyTokenValidateRequest = {
token: token
};
// Validate email verification token
const verifyResponse: EmailVerifyTokenValidateResponse = await customerApi.validateEmailVerificationToken({validationRequest: verifyRequest});
console.log("Was the correct token provided? " + verifyResponse.success);
} catch (error) {
console.error("An error occurred during email verification:", error);
}
}
}
Retrieves customers from the account. If no parameters are specified, all customers will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
SDK Function Name: getCustomersByQuery
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_query | Customer query | body | CustomerQuery | required |
_limit | The maximum number of records to return on this one API call. (Max 200)
Default: 100 |
query | integer | optional |
_offset | Pagination of the record set. Offset is a zero based index.
Default: 0 |
query | integer | optional |
_since | Fetch customers that have been created/modified since this date/time. | query | dateTime | optional |
_sort | The sort order of the customers. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
Allowed Values
|
query | string | optional |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using System.Collections.Generic;
using System.Linq;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class GetCustomersByQuery
{
/*
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
*/
public static void Execute()
{
// pulling all records could take a long time.
CustomerApi customerApi = Samples.GetCustomerApi();
List<Customer> customers = new List<Customer>();
int iteration = 1;
int offset = 0;
int limit = 200;
bool moreRecordsToFetch = true;
try
{
while (moreRecordsToFetch)
{
Console.WriteLine("executing iteration " + iteration);
List<Customer> chunkOfCustomers = GetCustomerChunk(customerApi, offset, limit);
customers = customers.Concat(chunkOfCustomers).ToList();
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.Count == limit;
iteration++;
}
}
catch (Exception e)
{
Console.WriteLine("Exception occurred on iteration " + iteration);
Console.WriteLine(e);
Environment.Exit(1);
}
// this will be verbose...
foreach (Customer customer in customers)
{
Console.WriteLine(customer);
}
}
/// <summary>
/// Retrieves a chunk of customers based on specified parameters
/// </summary>
/// <param name="customerApi">The customer API client</param>
/// <param name="offset">Starting position for retrieval</param>
/// <param name="limit">Maximum number of records to retrieve</param>
/// <returns>List of customers</returns>
private static List<Customer> GetCustomerChunk(CustomerApi customerApi, int offset, int limit)
{
// The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
string expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: This is just showing all the possibilities. In reality, you'll just assign the filters you need.
CustomerQuery query = new CustomerQuery();
//query.Email = null;
//query.QbClass = null;
//query.QuickbooksCode = null;
//query.LastModifiedDtsStart = null;
//query.LastModifiedDtsEnd = null;
//query.SignupDtsStart = null;
//query.SignupDtsEnd = null;
//query.BillingFirstName = null;
//query.BillingLastName = null;
//query.BillingCompany = null;
//query.BillingCity = null;
//query.BillingState = null;
//query.BillingPostalCode = null;
//query.BillingCountryCode = null;
//query.BillingDayPhone = null;
//query.BillingEveningPhone = null;
//query.ShippingFirstName = null;
//query.ShippingLastName = null;
//query.ShippingCompany = null;
//query.ShippingCity = null;
//query.ShippingState = null;
//query.ShippingPostalCode = null;
//query.ShippingCountryCode = null;
//query.ShippingDayPhone = null;
//query.ShippingEveningPhone = null;
//query.PricingTierOid = null;
//query.PricingTierName = null;
string since = null;
string sort = "email";
CustomersResponse apiResponse = customerApi.GetCustomersByQuery(query, offset, limit, since, sort, expand);
if (apiResponse.Customers != null)
{
return apiResponse.Customers;
}
return new List<Customer>();
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.Customer;
import com.ultracart.admin.v2.models.CustomerQuery;
import com.ultracart.admin.v2.models.CustomersResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.util.ArrayList;
import java.util.List;
public class GetCustomersByQuery {
/*
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
*/
public static void Execute() {
// pulling all records could take a long time.
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
List<Customer> customers = new ArrayList<>();
int iteration = 1;
int offset = 0;
int limit = 200;
boolean moreRecordsToFetch = true;
try {
while (moreRecordsToFetch) {
System.out.println("executing iteration " + iteration);
List<Customer> chunkOfCustomers = getCustomerChunk(customerApi, offset, limit);
customers.addAll(chunkOfCustomers);
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.size() == limit;
iteration++;
}
}
catch (Exception e) {
System.out.println("Exception occurred on iteration " + iteration);
System.out.println(e);
System.exit(1);
}
// this will be verbose...
for (Customer customer : customers) {
System.out.println(customer);
}
}
/**
* Retrieves a chunk of customers based on specified parameters
*
* @param customerApi The customer API client
* @param offset Starting position for retrieval
* @param limit Maximum number of records to retrieve
* @return List of customers
*/
private static List<Customer> getCustomerChunk(CustomerApi customerApi, int offset, int limit) throws ApiException {
// The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
String expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: This is just showing all the possibilities. In reality, you'll just assign the filters you need.
CustomerQuery query = new CustomerQuery();
//query.setEmail(null);
//query.setQbClass(null);
//query.setQuickbooksCode(null);
//query.setLastModifiedDtsStart(null);
//query.setLastModifiedDtsEnd(null);
//query.setSignupDtsStart(null);
//query.setSignupDtsEnd(null);
//query.setBillingFirstName(null);
//query.setBillingLastName(null);
//query.setBillingCompany(null);
//query.setBillingCity(null);
//query.setBillingState(null);
//query.setBillingPostalCode(null);
//query.setBillingCountryCode(null);
//query.setBillingDayPhone(null);
//query.setBillingEveningPhone(null);
//query.setShippingFirstName(null);
//query.setShippingLastName(null);
//query.setShippingCompany(null);
//query.setShippingCity(null);
//query.setShippingState(null);
//query.setShippingPostalCode(null);
//query.setShippingCountryCode(null);
//query.setShippingDayPhone(null);
//query.setShippingEveningPhone(null);
//query.setPricingTierOid(null);
//query.setPricingTierName(null);
String since = null;
String sort = "email";
CustomersResponse apiResponse = customerApi.getCustomersByQuery(query, offset, limit, since, sort, expand);
if (apiResponse.getCustomers() != null) {
return apiResponse.getCustomers();
}
return new ArrayList<>();
}
}
import { customerApi } from '../api.js';
export class GetCustomersByQuery {
/*
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
*/
static async execute() {
// pulling all records could take a long time.
const customers = [];
let iteration = 1;
let offset = 0;
const limit = 200;
let moreRecordsToFetch = true;
try {
while (moreRecordsToFetch) {
console.log("executing iteration " + iteration);
const chunkOfCustomers = await GetCustomersByQuery.getCustomerChunk(offset, limit);
customers.push(...chunkOfCustomers);
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.length === limit;
iteration++;
}
} catch (e) {
console.log("Exception occurred on iteration " + iteration);
console.log(e);
process.exit(1);
}
// this will be verbose...
for (const customer of customers) {
console.log(customer);
}
}
/**
* Retrieves a chunk of customers based on specified parameters
* @param offset Starting position for retrieval
* @param limit Maximum number of records to retrieve
* @returns Array of customers
*/
static async getCustomerChunk(offset, limit) {
// The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
const expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: This is just showing all the possibilities. In reality, you'll just assign the filters you need.
const query = {
//email: undefined,
//qbClass: undefined,
//quickbooksCode: undefined,
//lastModifiedDtsStart: undefined,
//lastModifiedDtsEnd: undefined,
//signupDtsStart: undefined,
//signupDtsEnd: undefined,
//billingFirstName: undefined,
//billingLastName: undefined,
//billingCompany: undefined,
//billingCity: undefined,
//billingState: undefined,
//billingPostalCode: undefined,
//billingCountryCode: undefined,
//billingDayPhone: undefined,
//billingEveningPhone: undefined,
//shippingFirstName: undefined,
//shippingLastName: undefined,
//shippingCompany: undefined,
//shippingCity: undefined,
//shippingState: undefined,
//shippingPostalCode: undefined,
//shippingCountryCode: undefined,
//shippingDayPhone: undefined,
//shippingEveningPhone: undefined,
//pricingTierOid: undefined,
//pricingTierName: undefined
};
const opts = {
_offset: offset,
_limit: limit,
_since: undefined,
_sort: "email",
_expand: expand
};
const apiResponse = await new Promise((resolve, reject) => {
customerApi.getCustomersByQuery(query, opts, function(error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (apiResponse.customers) {
return apiResponse.customers;
}
return [];
}
}
<?php
set_time_limit(3000); // pulling all records could take a long time.
ini_set('max_execution_time', 3000);
ini_set('display_errors', 1);
/*
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
*/
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerQuery;
require_once '../vendor/autoload.php';
require_once '../samples.php';
$customer_api = Samples::getCustomerApi();
/**
* @throws ApiException
*/
function getCustomerChunk(CustomerApi $customer_api, int $offset, int $limit): array
{
// The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
$_expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: This is just showing all the possibilities. In reality, you'll just assign the filters you need.
$query = new CustomerQuery();
// $query->setEmail(null);
// $query->setQbClass(null);
// $query->setQuickbooksCode(null);
// $query->setLastModifiedDtsStart(null);
// $query->setLastModifiedDtsEnd(null);
// $query->setSignupDtsStart(null);
// $query->setSignupDtsEnd(null);
// $query->setBillingFirstName(null);
// $query->setBillingLastName(null);
// $query->setBillingCompany(null);
// $query->setBillingCity(null);
// $query->setBillingState(null);
// $query->setBillingPostalCode(null);
// $query->setBillingCountryCode(null);
// $query->setBillingDayPhone(null);
// $query->setBillingEveningPhone(null);
// $query->setShippingFirstName(null);
// $query->setShippingLastName(null);
// $query->setShippingCompany(null);
// $query->setShippingCity(null);
// $query->setShippingState(null);
// $query->setShippingPostalCode(null);
// $query->setShippingCountryCode(null);
// $query->setShippingDayPhone(null);
// $query->setShippingEveningPhone(null);
// $query->setPricingTierOid(null);
// $query->setPricingTierName(null);
$_since = null;
$_sort = "email";
$api_response = $customer_api->getCustomersByQuery($query, $offset, $limit, $_since, $_sort, $_expand);
if ($api_response->getCustomers() != null) {
return $api_response->getCustomers();
}
return [];
}
$customers = [];
$iteration = 1;
$offset = 0;
$limit = 200;
$more_records_to_fetch = true;
try {
while ($more_records_to_fetch) {
echo "executing iteration " . $iteration . '<br>';
$chunk_of_customers = getCustomerChunk($customer_api, $offset, $limit);
$orders = array_merge($customers, $chunk_of_customers);
$offset = $offset + $limit;
$more_records_to_fetch = count($chunk_of_customers) == $limit;
$iteration++;
}
} catch (ApiException $e) {
echo 'ApiException occurred on iteration ' . $iteration;
var_dump($e);
die(1);
}
// this will be verbose...
var_dump($customers);
import time
from typing import List, Optional
from ultracart.apis import CustomerApi
from ultracart.models import CustomerQuery
from ultracart.api_client import ApiException
from samples import api_client
def get_customer_chunk(
customer_api: CustomerApi,
offset: int,
limit: int
) -> List[dict]:
"""
Retrieve a chunk of customers using query method.
Possible expansion values include:
attachments, billing, cards, cc_emails, loyalty, orders_summary,
pricing_tiers, privacy, properties, quotes_summary, reviewer,
shipping, software_entitlements, tags, tax_codes
"""
# Just the address fields. Contact support if unsure.
expand = "shipping,billing"
# Create a query object (currently with no filters)
query = CustomerQuery()
# Optional sorting
sort = "email"
since = None
# Retrieve customer chunk
api_response = customer_api.get_customers_by_query(
query,
offset,
limit,
since=since,
sort=sort,
expand=expand
)
# Return customers or empty list
return api_response.customers or []
def retrieve_all_customers():
"""
Retrieve all customers using pagination with query method.
"""
# Initialize parameters
customers = []
iteration = 1
offset = 0
limit = 200
more_records_to_fetch = True
try:
# Create API client
customer_api = CustomerApi(api_client())
# Pagination loop
while more_records_to_fetch:
print(f"executing iteration {iteration}")
# Fetch customer chunk
chunk_of_customers = get_customer_chunk(customer_api, offset, limit)
# Extend customers list
customers.extend(chunk_of_customers)
# Update pagination parameters
offset += limit
more_records_to_fetch = len(chunk_of_customers) == limit
iteration += 1
except ApiException as e:
print(f'ApiException occurred on iteration {iteration}')
print(e)
raise
# Return or print customers
return customers
# Run the retrieval if script is executed directly
if __name__ == '__main__':
try:
# Simulate PHP's set_time_limit and ini_set
# Note: In Python, these are typically handled differently depending on the environment
start_time = time.time()
max_execution_time = 3000 # 50 minutes
all_customers = retrieve_all_customers()
# Print or process customers
print(f"Total customers retrieved: {len(all_customers)}")
# Uncomment the following line to print full details (can be very verbose)
# print(all_customers)
except Exception as e:
print("An error occurred:")
print(e)
#!/usr/bin/env ruby
require 'ultracart_api'
require_relative '../constants'
=begin
This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers
using the getCustomersByQuery method.
=end
def get_customer_chunk(customer_api, offset, limit)
# The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
# returning everything since these objects are extremely large. The customer object can be truly large with
# all the order history. These are the possible expansion values:
#
# attachments billing cards cc_emails loyalty orders_summary pricing_tiers
# privacy properties quotes_summary reviewer shipping software_entitlements tags
# tax_codes
# Just the address fields. Contact us if you're unsure
expand = "shipping,billing"
# TODO: This is just showing all the possibilities. In reality, you'll just assign the filters you need.
query = UltracartClient::CustomerQuery.new
# Uncomment and set as needed:
# query.email = nil
# query.qb_class = nil
# query.quickbooks_code = nil
# query.last_modified_dts_start = nil
# query.last_modified_dts_end = nil
# query.signup_dts_start = nil
# query.signup_dts_end = nil
# query.billing_first_name = nil
# query.billing_last_name = nil
# query.billing_company = nil
# query.billing_city = nil
# query.billing_state = nil
# query.billing_postal_code = nil
# query.billing_country_code = nil
# query.billing_day_phone = nil
# query.billing_evening_phone = nil
# query.shipping_first_name = nil
# query.shipping_last_name = nil
# query.shipping_company = nil
# query.shipping_city = nil
# query.shipping_state = nil
# query.shipping_postal_code = nil
# query.shipping_country_code = nil
# query.shipping_day_phone = nil
# query.shipping_evening_phone = nil
# query.pricing_tier_oid = nil
# query.pricing_tier_name = nil
since = nil
sort = "email"
# Call the API with query parameters
api_response = customer_api.get_customers_by_query(
query,
offset,
limit,
since,
sort,
opts: {
'_expand' => expand
}
)
# Return customers or empty array
api_response.customers || []
end
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Prepare for pagination
customers = []
iteration = 1
offset = 0
limit = 200
more_records_to_fetch = true
begin
while more_records_to_fetch
puts "executing iteration #{iteration}"
# Fetch a chunk of customers
chunk_of_customers = get_customer_chunk(customer_api, offset, limit)
# Merge with existing customers
customers.concat(chunk_of_customers)
# Update offset and check if more records exist
offset += limit
more_records_to_fetch = chunk_of_customers.length == limit
iteration += 1
end
rescue UltracartClient::ApiError => e
puts "ApiError occurred on iteration #{iteration}"
p e
exit 1
end
# This will be verbose...
p customers
# Add a final carriage return
import {customerApi} from '../api';
import {Customer, CustomersResponse, CustomerQuery} from 'ultracart_rest_api_v2_typescript';
export class GetCustomersByQuery {
/*
* This example illustrates how to retrieve customers. It uses the pagination logic necessary to query all customers.
*/
public static async execute(): Promise<void> {
// pulling all records could take a long time.
const customers: Customer[] = [];
let iteration = 1;
let offset = 0;
const limit = 200;
let moreRecordsToFetch = true;
try {
while (moreRecordsToFetch) {
console.log("executing iteration " + iteration);
const chunkOfCustomers = await GetCustomersByQuery.getCustomerChunk(offset, limit);
customers.push(...chunkOfCustomers);
offset = offset + limit;
moreRecordsToFetch = chunkOfCustomers.length === limit;
iteration++;
}
} catch (e) {
console.log("Exception occurred on iteration " + iteration);
console.log(e);
process.exit(1);
}
// this will be verbose...
for (const customer of customers) {
console.log(customer);
}
}
/**
* Retrieves a chunk of customers based on specified parameters
* @param offset Starting position for retrieval
* @param limit Maximum number of records to retrieve
* @returns Array of customers
*/
private static async getCustomerChunk(offset: number, limit: number): Promise<Customer[]> {
// The real devil in the getCustomers calls is the expansion, making sure you return everything you need without
// returning everything since these objects are extremely large. The customer object can be truly large with
// all the order history. These are the possible expansion values.
/*
attachments billing cards cc_emails loyalty orders_summary pricing_tiers
privacy properties quotes_summary reviewer shipping software_entitlements tags
tax_codes
*/
const expand = "shipping,billing"; // just the address fields. contact us if you're unsure
// TODO: This is just showing all the possibilities. In reality, you'll just assign the filters you need.
const query: CustomerQuery = {
//email: undefined,
//qbClass: undefined,
//quickbooksCode: undefined,
//lastModifiedDtsStart: undefined,
//lastModifiedDtsEnd: undefined,
//signupDtsStart: undefined,
//signupDtsEnd: undefined,
//billingFirstName: undefined,
//billingLastName: undefined,
//billingCompany: undefined,
//billingCity: undefined,
//billingState: undefined,
//billingPostalCode: undefined,
//billingCountryCode: undefined,
//billingDayPhone: undefined,
//billingEveningPhone: undefined,
//shippingFirstName: undefined,
//shippingLastName: undefined,
//shippingCompany: undefined,
//shippingCity: undefined,
//shippingState: undefined,
//shippingPostalCode: undefined,
//shippingCountryCode: undefined,
//shippingDayPhone: undefined,
//shippingEveningPhone: undefined,
//pricingTierOid: undefined,
//pricingTierName: undefined
};
const params = {
customerQuery: query,
offset: offset,
limit: limit,
since: undefined,
sort: "email",
expand: expand
};
const apiResponse: CustomersResponse = await customerApi.getCustomersByQuery(params);
if (apiResponse.customers) {
return apiResponse.customers;
}
return [];
}
}
Delete a customer on the UltraCart account.
SDK Function Name: deleteCustomer
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer_profile_oid to delete. | path | integer (int32) | required |
using System;
using com.ultracart.admin.v2.Api;
namespace SdkSample.customer
{
public class DeleteCustomer
{
public static void Execute()
{
try
{
int customerOid = CustomerFunctions.InsertSampleCustomer();
CustomerFunctions.DeleteSampleCustomer(customerOid);
}
catch (Exception ex)
{
Console.Error.WriteLine("An Exception occurred. Please review the following error:");
Console.Error.WriteLine(ex); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.util.ApiException;
public class DeleteCustomer {
public static void execute() {
try {
int customerOid = CustomerFunctions.insertSampleCustomer();
CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ApiException ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex);
System.exit(1);
}
}
}
import {CustomerFunctions} from './customerFunctions.js';
export class DeleteCustomer {
static async execute() {
try {
const customerOid = await CustomerFunctions.insertSampleCustomer();
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
use ultracart\v2\ApiException;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
try {
$customer_oid = insertSampleCustomer();
deleteSampleCustomer($customer_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from customer_functions import insert_sample_customer, delete_sample_customer
def main():
try:
customer_oid = insert_sample_customer()
delete_sample_customer(customer_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require the customer functions we created earlier
require_relative 'customer_functions'
begin
# Insert a sample customer and get their OID
customer_oid = insert_sample_customer
# Delete the sample customer
delete_sample_customer(customer_oid)
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {CustomerFunctions} from './CustomerFunctions';
export class DeleteCustomer {
public static async execute(): Promise<void> {
try {
const customerOid: number = await CustomerFunctions.insertSampleCustomer();
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Retrieves a single customer using the specified customer profile oid.
SDK Function Name: getCustomer
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer oid to retrieve. | path | integer (int32) | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class GetCustomer
{
/**
* Of the two GetCustomer methods, you'll probably always use GetCustomerByEmail instead of this one.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But here is an example of using GetCustomer().
*/
public static void Execute()
{
try
{
string email = CustomerFunctions.CreateRandomEmail();
int customerOid = CustomerFunctions.InsertSampleCustomer(email);
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// the _expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
CustomerResponse apiResponse = customerApi.GetCustomer(customerOid, "billing,shipping");
Customer customer = apiResponse.Customer; // assuming this succeeded
Console.WriteLine(customer);
CustomerFunctions.DeleteSampleCustomer(customerOid);
}
catch (Exception ex)
{
Console.Error.WriteLine("An Exception occurred. Please review the following error:");
Console.Error.WriteLine(ex); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.Customer;
import com.ultracart.admin.v2.models.CustomerResponse;
import common.Constants;
public class GetCustomer {
/**
* Of the two GetCustomer methods, you'll probably always use GetCustomerByEmail instead of this one.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But here is an example of using GetCustomer().
*/
public static void Execute() {
try {
String email = CustomerFunctions.createRandomEmail();
int customerOid = CustomerFunctions.insertSampleCustomer(email);
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// the _expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
CustomerResponse apiResponse = customerApi.getCustomer(customerOid, "billing,shipping");
Customer customer = apiResponse.getCustomer(); // assuming this succeeded
System.out.println(customer);
CustomerFunctions.deleteSampleCustomer(customerOid);
}
catch (Exception ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex); // <-- change_me: handle gracefully
System.exit(1);
}
}
}
import { customerApi } from '../api.js';
import { CustomerFunctions } from './customerFunctions.js';
export class GetCustomer {
/**
* Of the two GetCustomer methods, you'll probably always use GetCustomerByEmail instead of this one.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But here is an example of using GetCustomer().
*/
static async execute() {
try {
const email = CustomerFunctions.createRandomEmail();
const customerOid = await CustomerFunctions.insertSampleCustomer(email);
// the expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
const apiResponse = await new Promise((resolve, reject) => {
customerApi.getCustomer(customerOid,{_expand: 'billing,shipping'}, function(error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const customer = apiResponse.customer; // assuming this succeeded
console.log(customer);
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
/** @noinspection SpellCheckingInspection */
/** @noinspection GrazieInspection */
use ultracart\v2\ApiException;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
// Of the two getCustomer methods, you'll probably always use getCustomerByEmail instead of this one.
// Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
// key in the UltraCart databases. But here is an example of using getCustomer().
try {
$email = createRandomEmail();
$customer_oid = insertSampleCustomer($email);
$customer_api = Samples::getCustomerApi();
// the _expand variable is set to return just the address fields.
// see customer_functions.php for a list of expansions, or consult the source: https://www.ultracart.com/api/
$api_response = $customer_api->getCustomer($customer_oid, "billing,shipping");
$customer = $api_response->getCustomer(); // assuming this succeeded
var_dump($customer);
deleteSampleCustomer($customer_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from samples import api_client
from customer_functions import (
insert_sample_customer,
delete_sample_customer,
create_random_email
)
def main():
try:
# Create a sample customer with a random email
email = create_random_email()
customer_oid = insert_sample_customer(email)
# Create customer API instance
customer_api = CustomerApi(api_client())
# Retrieve customer by OID with expanded billing and shipping details
# Most customer logic revolves around email, but this demonstrates
# retrieval by customer OID
api_response = customer_api.get_customer(customer_oid, expand="billing,shipping")
customer = api_response.customer # Assuming retrieval succeeded
# Print customer details
print(customer)
# Clean up the sample customer
delete_sample_customer(customer_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
require 'ultracart_api'
require_relative '../constants'
require_relative './customer_functions'
# Of the two getCustomer methods, you'll probably always use getCustomerByEmail instead of this one.
# Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
# key in the UltraCart databases. But here is an example of using getCustomer().
begin
# Create a random email and insert a sample customer
email = create_random_email
customer_oid = insert_sample_customer(email)
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# The _expand variable is set to return just the address fields.
# See customer_functions.rb for a list of expansions, or consult the source: https://www.ultracart.com/api/
api_response = customer_api.get_customer(
customer_oid,
opts: {
'_expand' => 'billing,shipping'
}
)
# Assuming this succeeded
customer = api_response.customer
# Output the customer details
p customer
# Delete the sample customer
delete_sample_customer(customer_oid)
rescue UltracartClient::ApiError => e
puts 'An ApiError occurred. Please review the following error:'
p e
exit 1
end
# Add a final carriage return
import {customerApi} from '../api';
import {Customer, CustomerResponse} from 'ultracart_rest_api_v2_typescript';
import {CustomerFunctions} from './CustomerFunctions';
export class GetCustomer {
/**
* Of the two GetCustomer methods, you'll probably always use GetCustomerByEmail instead of this one.
* Most customer logic revolves around the email, not the customer oid. The latter is only meaningful as a primary
* key in the UltraCart databases. But here is an example of using GetCustomer().
*/
public static async execute(): Promise<void> {
try {
const email: string = CustomerFunctions.createRandomEmail();
const customerOid: number = await CustomerFunctions.insertSampleCustomer(email);
// the expand variable is set to return just the address fields.
// see CustomerFunctions for a list of expansions, or consult the source: https://www.ultracart.com/api/
const apiResponse: CustomerResponse = await customerApi.getCustomer({
customerProfileOid: customerOid,
expand: 'billing,shipping'
});
const customer: Customer | undefined = apiResponse.customer; // assuming this succeeded
console.log(customer);
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Update a customer on the UltraCart account.
SDK Function Name: updateCustomer
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer | Customer to update | body | Customer | required |
customer_profile_oid | The customer_profile_oid to update. | path | integer (int32) | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Client;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class UpdateCustomer
{
public static void Execute()
{
try
{
int customerOid = CustomerFunctions.InsertSampleCustomer();
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// just want address fields. see https://www.ultracart.com/api/#resource_customer.html for all expansion values
string expand = "billing,shipping";
Customer customer = customerApi.GetCustomer(customerOid, expand).Customer;
// TODO: do some edits to the customer. Here we will change some billing fields.
customer.Billing[0].Address2 = "Apartment 101";
// notice expand is passed to update as well since it returns back an updated customer object.
// we use the same expansion, so we get back the same fields and can do comparisons.
CustomerResponse apiResponse = customerApi.UpdateCustomer(customerOid, customer, expand);
// verify the update
Console.WriteLine(apiResponse.Customer);
CustomerFunctions.DeleteSampleCustomer(customerOid);
}
catch (ApiException e)
{
Console.WriteLine("An ApiException occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.Customer;
import com.ultracart.admin.v2.models.CustomerResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class UpdateCustomer {
public static void execute() {
try {
int customerOid = CustomerFunctions.insertSampleCustomer();
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// just want address fields. see https://www.ultracart.com/api/#resource_customer.html for all expansion values
String expand = "billing,shipping";
Customer customer = customerApi.getCustomer(customerOid, expand).getCustomer();
// TODO: do some edits to the customer. Here we will change some billing fields.
customer.getBilling().get(0).address2("Apartment 101");
// notice expand is passed to update as well since it returns back an updated customer object.
// we use the same expansion, so we get back the same fields and can do comparisons.
CustomerResponse apiResponse = customerApi.updateCustomer(customerOid, customer, expand);
// verify the update
System.out.println(apiResponse.getCustomer());
CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ApiException e) {
System.err.println("An ApiException occurred. Please review the following error:");
e.printStackTrace();
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {CustomerFunctions} from './customerFunctions.js';
export class UpdateCustomer {
/**
* Executes a customer update workflow
* Inserts a sample customer, updates their billing address,
* and then deletes the sample customer
*/
static async Execute() {
try {
// Insert a sample customer and get their OID
const customerOid = await CustomerFunctions.insertSampleCustomer();
// just want address fields. see https://www.ultracart.com/api/#resource_customer.html for all expansion values
const expand = "billing,shipping";
// Retrieve the customer
const customerResponse = await new Promise((resolve, reject) => {
customerApi.getCustomer(customerOid, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const customer = customerResponse.customer;
if (customer === undefined) {
console.error("getCustomer returned undefined, cannot update.");
process.exit(1);
}
// TODO: do some edits to the customer. Here we will change some billing fields.
if (customer.billing && customer.billing.length > 0) {
customer.billing[0].address2 = "Apartment 101";
}
// notice expand is passed to update as well since it returns back an updated customer object.
// we use the same expansion, so we get back the same fields and can do comparisons.
const apiResponse = await new Promise((resolve, reject) => {
customerApi.updateCustomer(customerOid, customer, {_expand: expand}, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// verify the update
console.log(apiResponse.customer);
// Delete the sample customer
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (e) {
console.error("An unexpected error occurred:", e);
process.exit(1);
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
try {
$customer_oid = insertSampleCustomer();
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// just want address fields. see https://www.ultracart.com/api/#resource_customer.html for all expansion values
$_expand = "billing,shipping";
$customer = $customer_api->getCustomer($customer_oid, $_expand)->getCustomer();
// TODO: do some edits to the customer. Here we will change some billing fields.
$customer->getBilling()[0]->setAddress2('Apartment 101');
// notice expand is passed to update as well since it returns back an updated customer object.
// we use the same expansion, so we get back the same fields and can do comparisons.
$api_response = $customer_api->updateCustomer($customer_oid, $customer, $_expand);
// verify the update
var_dump($api_response->getCustomer());
deleteSampleCustomer($customer_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from ultracart.api_client import ApiException
from samples import api_client
from customer_functions import insert_sample_customer, delete_sample_customer
def update_customer_example():
"""
Demonstrate customer retrieval, update, and deletion:
1. Insert a sample customer
2. Retrieve customer details
3. Update billing address
4. Verify the update
5. Delete the sample customer
"""
try:
# Insert a sample customer
customer_oid = insert_sample_customer()
# Create API client
customer_api = CustomerApi(api_client())
# Specify expansion fields (just want address fields)
# See https://www.ultracart.com/api/#resource_customer.html for all expansion values
expand = "billing,shipping"
# Retrieve customer details
customer = customer_api.get_customer(customer_oid, expand).customer
# TODO: Modify customer details
# Change billing address (assuming first billing entry)
customer.billing[0].address2 = 'Apartment 101'
# Update customer
# Notice expand is passed to update to get back the same fields for comparison
api_response = customer_api.update_customer(customer_oid, customer, expand)
# Verify the update
print(api_response.customer)
# Clean up the sample customer
delete_sample_customer(customer_oid)
except ApiException as e:
print('An ApiException occurred. Please review the following error:')
print(e)
raise
# Run the function if the script is executed directly
if __name__ == '__main__':
update_customer_example()
require 'ultracart_api'
require_relative '../constants'
require_relative './customer_functions'
begin
# Insert a sample customer
customer_oid = insert_sample_customer()
# Initialize customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Just want address fields. See https://www.ultracart.com/api/#resource_customer.html for all expansion values
opts = {
'_expand' => "billing,shipping"
}
# Retrieve customer with specified expansions
customer = customer_api.get_customer(customer_oid, opts).customer
# TODO: do some edits to the customer. Here we will change some billing fields.
customer.billing[0].address2 = 'Apartment 101'
# Notice expand is passed to update as well since it returns back an updated customer object.
# We use the same expansion, so we get back the same fields and can do comparisons.
api_response = customer_api.update_customer(customer_oid, customer, opts)
# Verify the update
p api_response.customer
# Delete the sample customer
delete_sample_customer(customer_oid)
rescue UltracartClient::ApiError => e
puts 'An ApiException occurred. Please review the following error:'
p e # <-- change_me: handle gracefully
exit(1)
end
import {Customer, CustomerResponse} from 'ultracart_rest_api_v2_typescript';
import {customerApi} from '../api';
import {CustomerFunctions} from './CustomerFunctions';
export class UpdateCustomer {
/**
* Executes a customer update workflow
* Inserts a sample customer, updates their billing address,
* and then deletes the sample customer
*/
public static async Execute(): Promise<void> {
try {
// Insert a sample customer and get their OID
const customerOid: number = await CustomerFunctions.insertSampleCustomer();
// just want address fields. see https://www.ultracart.com/api/#resource_customer.html for all expansion values
const expand: string = "billing,shipping";
// Retrieve the customer
const customerResponse = await customerApi.getCustomer({customerProfileOid: customerOid, expand});
const customer: Customer | undefined = customerResponse.customer;
if (customer === undefined) {
console.error("getCustomer returned undefined, cannot update.");
process.exit(1);
}
// TODO: do some edits to the customer. Here we will change some billing fields.
if (customer.billing && customer.billing.length > 0) {
customer.billing[0].address2 = "Apartment 101";
}
// notice expand is passed to update as well since it returns back an updated customer object.
// we use the same expansion, so we get back the same fields and can do comparisons.
const apiResponse: CustomerResponse = await customerApi.updateCustomer({
customerProfileOid: customerOid,
customer: customer,
expand: expand
});
// verify the update
console.log(apiResponse.customer);
// Delete the sample customer
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (e) {
console.error("An unexpected error occurred:", e);
process.exit(1);
}
}
}
Updates the cashback balance for a customer by updating the internal gift certificate used, creating the gift certificate if needed.
SDK Function Name: adjustInternalCertificate
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer profile oid | path | integer (int32) | required |
adjust_internal_certificate_request | adjustInternalCertificateRequest | body | AdjustInternalCertificateRequest | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class AdjustInternalCertificate
{
/**
* Adjusts the cashback balance of a customer. This method's name is adjustInternalCertificate, which
* is a poor choice of naming, but results from an underlying implementation of using an internal gift certificate
* to track cashback balance. Sorry for the confusion.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing adjustment amount -> "adjust_internal_certificate_request.adjustment_amount is required and was missing"
*/
public static void Execute()
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
string email = "test@ultracart.com";
Customer customer = customerApi.GetCustomerByEmail(email).Customer;
int customerOid = customer.CustomerProfileOid;
AdjustInternalCertificateRequest adjustRequest = new AdjustInternalCertificateRequest();
adjustRequest.Description = "Adjusting customer cashback balance because they called and complained about product.";
adjustRequest.ExpirationDays = 365; // expires in 365 days
adjustRequest.VestingDays = 45; // customer has to wait 45 days to use it.
adjustRequest.AdjustmentAmount = 59; // add 59 to their balance.
adjustRequest.OrderId = "DEMO-12345"; // or leave null. this ties the adjustment to a particular order.
adjustRequest.EntryDts = null; // use current time.
AdjustInternalCertificateResponse apiResponse = customerApi.AdjustInternalCertificate(customerOid, adjustRequest);
if (apiResponse.Error != null)
{
Console.Error.WriteLine(apiResponse.Error.DeveloperMessage);
Console.Error.WriteLine(apiResponse.Error.UserMessage);
Environment.Exit(1);
}
Console.WriteLine($"Success: {apiResponse.Success}");
Console.WriteLine($"Adjustment Amount: {apiResponse.AdjustmentAmount}");
Console.WriteLine($"Balance Amount: {apiResponse.BalanceAmount}");
Console.WriteLine(apiResponse);
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.AdjustInternalCertificateRequest;
import com.ultracart.admin.v2.models.AdjustInternalCertificateResponse;
import com.ultracart.admin.v2.models.Customer;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.math.BigDecimal;
public class AdjustInternalCertificate {
/**
* Adjusts the cashback balance of a customer. This method's name is adjustInternalCertificate, which
* is a poor choice of naming, but results from an underlying implementation of using an internal gift certificate
* to track cashback balance. Sorry for the confusion.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing adjustment amount -> "adjust_internal_certificate_request.adjustment_amount is required and was missing"
*/
public static void execute() {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
try {
String email = "test@ultracart.com";
Customer customer = customerApi.getCustomerByEmail(email, null).getCustomer();
int customerOid = customer.getCustomerProfileOid();
AdjustInternalCertificateRequest adjustRequest = new AdjustInternalCertificateRequest();
adjustRequest.setDescription("Adjusting customer cashback balance because they called and complained about product.");
adjustRequest.setExpirationDays(365); // expires in 365 days
adjustRequest.setVestingDays(45); // customer has to wait 45 days to use it.
adjustRequest.setAdjustmentAmount(new BigDecimal("59")); // add 59 to their balance.
adjustRequest.setOrderId("DEMO-12345"); // or leave null. this ties the adjustment to a particular order.
adjustRequest.setEntryDts(null); // use current time.
AdjustInternalCertificateResponse apiResponse = customerApi.adjustInternalCertificate(customerOid, adjustRequest);
if (apiResponse.getError() != null) {
System.err.println(apiResponse.getError().getDeveloperMessage());
System.err.println(apiResponse.getError().getUserMessage());
System.exit(1);
}
System.out.println("Success: " + apiResponse.getSuccess());
System.out.println("Adjustment Amount: " + apiResponse.getAdjustmentAmount());
System.out.println("Balance Amount: " + apiResponse.getBalanceAmount());
System.out.println(apiResponse);
} catch (ApiException e) {
System.err.println("API Exception: " + e.getMessage());
e.printStackTrace();
}
}
}
import {customerApi} from '../api.js';
import {DateTime} from 'luxon';
export class AdjustInternalCertificate {
/**
* Adjusts the cashback balance of a customer. This method's name is adjustInternalCertificate, which
* is a poor choice of naming, but results from an underlying implementation of using an internal gift certificate
* to track cashback balance. Sorry for the confusion.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing adjustment amount -> "adjust_internal_certificate_request.adjustment_amount is required and was missing"
*/
static async execute() {
const email = "test@ultracart.com";
// Retrieve customer by email
const customerResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerByEmail(email, function(error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const customer = customerResponse.customer;
if (!customer || !customer.customer_profile_oid) {
throw new Error("Customer not found or missing customer profile OID");
}
const customerOid = customer.customer_profile_oid;
const adjustRequest = {
description: "Adjusting customer cashback balance because they called and complained about product.",
expiration_days: 365, // expires in 365 days
vesting_days: 45, // customer has to wait 45 days to use it.
adjustment_amount: 59, // add 59 to their balance.
order_id: "DEMO-12345", // or leave undefined. this ties the adjustment to a particular order.
entry_dts: DateTime.now().setZone('America/New_York').toISO() // use current time in ISO format
};
const apiResponse = await new Promise((resolve, reject) => {
customerApi.adjustInternalCertificate(customerOid,adjustRequest, function(error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (apiResponse.error) {
console.error(apiResponse.error.developer_message);
console.error(apiResponse.error.user_message);
throw new Error("Failed to adjust internal certificate");
}
console.log(`Success: ${apiResponse.success}`);
console.log(`Adjustment Amount: ${apiResponse.adjustment_amount}`);
console.log(`Balance Amount: ${apiResponse.balance_amount}`);
console.log(apiResponse);
}
}
<?php
ini_set('display_errors', 1);
/*
Adjusts the cashback balance of a customer. This method's name is adjustInternalCertificate, which
is a poor choice of naming, but results from an underlying implementation of using an internal gift certificate
to track cashback balance. Sorry for the confusion.
This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
Possible Errors:
Missing adjustment amount -> "adjust_internal_certificate_request.adjustment_amount is required and was missing"
*/
use ultracart\v2\api\CustomerApi;
use ultracart\v2\models\AdjustInternalCertificateRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
$email = "test@ultracart.com";
$customer = $customer_api->getCustomerByEmail($email)->getCustomer();
$customer_oid = $customer->getCustomerProfileOid();
$adjustRequest = new AdjustInternalCertificateRequest();
$adjustRequest->setDescription("Adjusting customer cashback balance because they called and complained about product.");
$adjustRequest->setExpirationDays(365); // expires in 365 days
$adjustRequest->setVestingDays(45); // customer has to wait 45 days to use it.
$adjustRequest->setAdjustmentAmount(59); // add 59 to their balance.
$adjustRequest->setOrderId('DEMO-12345'); // or leave null. this ties the adjustment to a particular order.
$adjustRequest->setEntryDts(null); // use current time.
$api_response = $customer_api->adjustInternalCertificate($customer_oid, $adjustRequest);
if ($api_response->getError() != null) {
error_log($api_response->getError()->getDeveloperMessage());
error_log($api_response->getError()->getUserMessage());
exit();
}
echo '<html lang="en"><body><pre>';
echo 'Success: ' . $api_response->getSuccess() . "<br/>";
echo 'Adjustment Amount: ' . $api_response->getAdjustmentAmount() . '<br/>';
echo 'Balance Amount: ' . $api_response->getBalanceAmount() . '<br/>';
var_dump($api_response);
echo '</pre></body></html>';
from ultracart.apis import CustomerApi
from samples import api_client
from ultracart.models import AdjustInternalCertificateRequest
# Create the customer API instance
customer_api = CustomerApi(api_client())
# Set the email and retrieve customer
email = "test@ultracart.com"
customer = customer_api.get_customer_by_email(email).customer
customer_oid = customer.customer_profile_oid
# Create adjustment request
adjust_request = AdjustInternalCertificateRequest(
description="Adjusting customer cashback balance because they called and complained about product.",
expiration_days=365, # expires in 365 days
vesting_days=45, # customer has to wait 45 days to use it
adjustment_amount=59, # add 59 to their balance
order_id='DEMO-12345', # or leave None. This ties the adjustment to a particular order
entry_dts=None # use current time
)
# Adjust internal certificate
api_response = customer_api.adjust_internal_certificate(customer_oid, adjust_request)
# Check for errors
if api_response.error is not None:
print(f"Developer Message: {api_response.error.developer_message}")
print(f"User Message: {api_response.error.user_message}")
exit()
# Print response details
print(f"Success: {api_response.success}")
print(f"Adjustment Amount: {api_response.adjustment_amount}")
print(f"Balance Amount: {api_response.balance_amount}")
# Optional: full response inspection
print(api_response)
#!/usr/bin/env ruby
# Adjusts the cashback balance of a customer. This method's name is adjustInternalCertificate, which
# is a poor choice of naming, but results from an underlying implementation of using an internal gift certificate
# to track cashback balance. Sorry for the confusion.
#
# This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
# If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
#
# Possible Errors:
# Missing adjustment amount -> "adjust_internal_certificate_request.adjustment_amount is required and was missing"
require 'ultracart_api'
require_relative '../constants'
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Set the email of the customer
email = "test@ultracart.com"
# Retrieve the customer by email
customer = customer_api.get_customer_by_email(email).customer
customer_oid = customer.customer_profile_oid
# Create adjust internal certificate request
adjust_request = UltracartClient::AdjustInternalCertificateRequest.new(
description: "Adjusting customer cashback balance because they called and complained about product.",
expiration_days: 365, # expires in 365 days
vesting_days: 45, # customer has to wait 45 days to use it
adjustment_amount: 59, # add 59 to their balance
order_id: 'DEMO-12345', # or leave nil. this ties the adjustment to a particular order
entry_dts: nil # use current time
)
# Adjust internal certificate
begin
api_response = customer_api.adjust_internal_certificate(customer_oid, adjust_request)
# Check for any errors in the response
if api_response.error
puts "Developer Message: #{api_response.error.developer_message}"
puts "User Message: #{api_response.error.user_message}"
exit(1)
end
# Output response details
puts "Success: #{api_response.success}"
puts "Adjustment Amount: #{api_response.adjustment_amount}"
puts "Balance Amount: #{api_response.balance_amount}"
# Inspect the full response
p api_response
rescue StandardError => e
puts "An error occurred: #{e.message}"
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {
Customer,
AdjustInternalCertificateRequest,
AdjustInternalCertificateResponse
} from 'ultracart_rest_api_v2_typescript';
import {DateTime} from 'luxon';
export class AdjustInternalCertificate {
/**
* Adjusts the cashback balance of a customer. This method's name is adjustInternalCertificate, which
* is a poor choice of naming, but results from an underlying implementation of using an internal gift certificate
* to track cashback balance. Sorry for the confusion.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing adjustment amount -> "adjust_internal_certificate_request.adjustment_amount is required and was missing"
*/
public static async execute(): Promise<void> {
const email: string = "test@ultracart.com";
// Retrieve customer by email
const customerResponse = await customerApi.getCustomerByEmail({email});
const customer: Customer | undefined = customerResponse.customer;
if (!customer || !customer.customer_profile_oid) {
throw new Error("Customer not found or missing customer profile OID");
}
const customerOid: number = customer.customer_profile_oid;
const adjustRequest: AdjustInternalCertificateRequest = {
description: "Adjusting customer cashback balance because they called and complained about product.",
expiration_days: 365, // expires in 365 days
vesting_days: 45, // customer has to wait 45 days to use it.
adjustment_amount: 59, // add 59 to their balance.
order_id: "DEMO-12345", // or leave undefined. this ties the adjustment to a particular order.
entry_dts: DateTime.now().setZone('America/New_York').toISO() // use current time in ISO format
};
const apiResponse: AdjustInternalCertificateResponse = await customerApi.adjustInternalCertificate({
customerProfileOid: customerOid,
adjustInternalCertificateRequest: adjustRequest
});
if (apiResponse.error) {
console.error(apiResponse.error.developer_message);
console.error(apiResponse.error.user_message);
throw new Error("Failed to adjust internal certificate");
}
console.log(`Success: ${apiResponse.success}`);
console.log(`Adjustment Amount: ${apiResponse.adjustment_amount}`);
console.log(`Balance Amount: ${apiResponse.balance_amount}`);
console.log(apiResponse);
}
}
Update email list subscriptions for a customer
SDK Function Name: updateCustomerEmailLists
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer profile oid | path | integer (int32) | required |
list_changes | List changes | body | CustomerEmailListChanges | required |
// This is an internal method used by our Email workflow engines. It allows for updating the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so its usage may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
// This is an internal method used by our Email workflow engines. It allows for updating the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so its usage may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
// This is an internal method used by our Email workflow engines. It allows for updating the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so its usage may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
<?php
// This is an internal method used by our Email workflow engines. It allows for updating the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so its usage may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
# This is an internal method used by our Email workflow engines. It allows for updating the email lists a customer
# is currently subscribed to. It's geared towards our UI needs, so its usage may appear cryptic.
# We're not including a sample for it because we don't envision it being valuable to a merchant.
# This is an internal method used by our Email workflow engines. It allows for updating the email lists a customer
# is currently subscribed to. It's geared towards our UI needs, so its usage may appear cryptic.
# We're not including a sample for it because we don't envision it being valuable to a merchant.
// This is an internal method used by our Email workflow engines. It allows for updating the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so its usage may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
Retrieves a magic link to allow a merchant to login as a customer. This method is a PUT call intentionally.
SDK Function Name: getMagicLink
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer_profile_oid of the customer. | path | integer (int32) | required |
storefront_host_name | The storefront to log into. | path | string | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using System.Web;
using com.ultracart.admin.v2.Client;
namespace SdkSample.customer
{
public class GetMagicLink
{
public static void Execute()
{
/*
getMagicLink returns back a url whereby a merchant can log into their website as the customer.
This may be useful to "see what the customer is seeing" and is the only method to do so since
the customer's passwords are encrypted. Note: A merchant may also do this using the UltraCart
backend site within the Customer Management section.
*/
try
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// create a customer
int customerOid = CustomerFunctions.InsertSampleCustomer();
string storefront = "www.website.com"; // required. many merchants have dozens of storefronts. which one?
CustomerMagicLinkResponse apiResponse = customerApi.GetMagicLink(customerOid, storefront);
string url = apiResponse.Url;
Console.WriteLine("<html><body><script>window.location.href = " + HttpUtility.UrlEncode(url) + ";</script></body></html>");
// clean up this sample. - don't do this or the above magic link won't work. But you'll want to clean up this
// sample customer manually using the backend.
// CustomerFunctions.DeleteSampleCustomer(customerOid);
}
catch (ApiException e)
{
Console.WriteLine("An ApiException occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerMagicLinkResponse;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
public class GetMagicLink {
public static void Execute() {
/*
getMagicLink returns back a url whereby a merchant can log into their website as the customer.
This may be useful to "see what the customer is seeing" and is the only method to do so since
the customer's passwords are encrypted. Note: A merchant may also do this using the UltraCart
backend site within the Customer Management section.
*/
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// create a customer
int customerOid = CustomerFunctions.insertSampleCustomer();
String storefront = "www.website.com"; // required. many merchants have dozens of storefronts. which one?
CustomerMagicLinkResponse apiResponse = customerApi.getMagicLink(customerOid, storefront);
String url = apiResponse.getUrl();
System.out.println("<html><body><script>window.location.href = " +
URLEncoder.encode(url, StandardCharsets.UTF_8.toString()) + ";</script></body></html>");
// clean up this sample. - don't do this or the above magic link won't work. But you'll want to clean up this
// sample customer manually using the backend.
// CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (ApiException e) {
System.out.println("An ApiException occurred. Please review the following error:");
System.out.println(e); // <-- change_me: handle gracefully
System.exit(1);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
}
import {customerApi} from '../api.js';
import {CustomerFunctions} from './customerFunctions.js';
export class GetMagicLink {
/**
* getMagicLink returns back a url whereby a merchant can log into their website as the customer.
* This may be useful to "see what the customer is seeing" and is the only method to do so since
* the customer's passwords are encrypted. Note: A merchant may also do this using the UltraCart
* backend site within the Customer Management section.
*/
static async execute() {
try {
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
const storefront = "www.website.com"; // required. many merchants have dozens of storefronts. which one?
const apiResponse = await new Promise((resolve, reject) => {
customerApi.getMagicLink(customerOid, storefront, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const url = apiResponse.url || "error_failed_to_get_magic_link";
// Note: In a web context, you'd typically use window.location or a framework-specific routing method
document.write(`<html><body><script>window.location.href = "${encodeURIComponent(url)}";</script></body></html>`);
// clean up this sample. - don't do this or the above magic link won't work. But you'll want to clean up this
// sample customer manually using the backend.
// await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (e) {
console.error("An ApiException occurred. Please review the following error:");
console.error(e); // handle gracefully
throw e; // or handle as appropriate in your application
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
/*
getMagicLink returns back a url whereby a merchant can log into their website as the customer.
This may be useful to "see what the customer is seeing" and is the only method to do so since
the customer's passwords are encrypted. Note: A merchant may also do this using the UltraCart
backend site within the Customer Management section.
*/
try {
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// create a customer
$customer_oid = insertSampleCustomer();
$storefront = "www.website.com"; // required. many merchants have dozens of storefronts. which one?
$api_response = $customer_api->getMagicLink($customer_oid, $storefront);
$url = $api_response->getUrl();
echo "<html><body><script>window.location.href = " . json_encode($url) . ";</script></body></html>";
// clean up this sample. - don't do this or the above magic link won't work. But you'll want to clean up this
// sample customer manually using the backend.
// deleteSampleCustomer($customer_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
import json
from ultracart.apis import CustomerApi
from samples import api_client
from customer_functions import insert_sample_customer
def main():
try:
# Create customer API instance
customer_api = CustomerApi(api_client())
# Create a sample customer
customer_oid = insert_sample_customer()
# Set storefront (required)
storefront = "www.website.com"
# Get magic link
api_response = customer_api.get_magic_link(customer_oid, storefront)
url = api_response.url
# In a web application (like Flask), you would redirect to the URL
# For this example, we'll just print the URL
print(f"Magic Link URL: {url}")
# Note: In a real web application, you would use a proper redirect
# For example, in Flask:
# return redirect(url)
# Clean up note: Do not delete the customer if you want the magic link to work
# deleteSampleCustomer(customer_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require necessary files
require 'ultracart_api'
require_relative '../constants'
require_relative 'customer_functions'
# getMagicLink returns back a url whereby a merchant can log into their website as the customer.
# This may be useful to "see what the customer is seeing" and is the only method to do so since
# the customer's passwords are encrypted. Note: A merchant may also do this using the UltraCart
# backend site within the Customer Management section.
begin
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Create a customer
customer_oid = insert_sample_customer
storefront = "www.website.com" # required. many merchants have dozens of storefronts. which one?
# Get the magic link
api_response = customer_api.get_magic_link(customer_oid, storefront)
url = api_response.url
# Output HTML to redirect to the magic link
puts <<-HTML
<html>
<body>
<script>
window.location.href = #{url.to_json};
</script>
</body>
</html>
HTML
# Clean up this sample - don't do this or the above magic link won't work.
# You'll want to clean up this sample customer manually using the backend.
# delete_sample_customer(customer_oid)
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {CustomerMagicLinkResponse} from 'ultracart_rest_api_v2_typescript';
import {CustomerFunctions} from './CustomerFunctions';
export class GetMagicLink {
/**
* getMagicLink returns back a url whereby a merchant can log into their website as the customer.
* This may be useful to "see what the customer is seeing" and is the only method to do so since
* the customer's passwords are encrypted. Note: A merchant may also do this using the UltraCart
* backend site within the Customer Management section.
*/
public static async execute(): Promise<void> {
try {
// create a customer
const customerOid: number = await CustomerFunctions.insertSampleCustomer();
const storefront: string = "www.website.com"; // required. many merchants have dozens of storefronts. which one?
const apiResponse: CustomerMagicLinkResponse = await customerApi.getMagicLink({
customerProfileOid: customerOid,
storefrontHostName: storefront
});
const url: string = apiResponse.url || "error_failed_to_get_magic_link";
// Note: In a web context, you'd typically use window.location or a framework-specific routing method
document.write(`<html><body><script>window.location.href = "${encodeURIComponent(url)}";</script></body></html>`);
// clean up this sample. - don't do this or the above magic link won't work. But you'll want to clean up this
// sample customer manually using the backend.
// await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (e) {
console.error("An ApiException occurred. Please review the following error:");
console.error(e); // handle gracefully
throw e; // or handle as appropriate in your application
}
}
}
Merge customer into this customer.
SDK Function Name: mergeCustomer
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer | Customer to merge into this profile. | body | CustomerMergeRequest | required |
customer_profile_oid | The customer_profile_oid to update. | path | integer (int32) | required |
_expand | The object expansion to perform on the result. See documentation for examples | query | string | optional |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Client;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class MergeCustomer
{
public static void Execute()
{
/*
The merge function was requested by UltraCart merchants that sell software and manage activation keys. Frequently,
customers would purchase their software using one email address, and then accidentally re-subscribe using a
different email address (for example, they purchased subsequent years using PayPal which was tied to their spouse's
email). However it happened, the customer now how software licenses spread across multiple emails and therefore
multiple customer profiles.
merge combine the customer profiles, merging order history and software entitlements. Still, it may be used to
combine any two customer profiles for any reason.
Success returns back a status code 204 (No Content)
*/
try
{
// first customer
int firstCustomerOid = CustomerFunctions.InsertSampleCustomer();
string secondEmail = CustomerFunctions.CreateRandomEmail();
int secondCustomerOid = CustomerFunctions.InsertSampleCustomer(secondEmail);
CustomerMergeRequest mergeRequest = new CustomerMergeRequest();
// Supply either the email or the customer oid. Only need one.
mergeRequest.Email = secondEmail;
// mergeRequest.CustomerProfileOid = customerOid;
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
customerApi.MergeCustomer(firstCustomerOid, mergeRequest);
// clean up this sample.
CustomerFunctions.DeleteSampleCustomer(firstCustomerOid);
// Notice: No need to delete the second sample. The merge call deletes it.
}
catch (ApiException e)
{
Console.WriteLine("An ApiException occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerMergeRequest;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
public class MergeCustomer {
public static void Execute() {
/*
The merge function was requested by UltraCart merchants that sell software and manage activation keys. Frequently,
customers would purchase their software using one email address, and then accidentally re-subscribe using a
different email address (for example, they purchased subsequent years using PayPal which was tied to their spouse's
email). However it happened, the customer now how software licenses spread across multiple emails and therefore
multiple customer profiles.
merge combine the customer profiles, merging order history and software entitlements. Still, it may be used to
combine any two customer profiles for any reason.
Success returns back a status code 204 (No Content)
*/
try {
// first customer
int firstCustomerOid = CustomerFunctions.insertSampleCustomer();
String secondEmail = CustomerFunctions.createRandomEmail();
int secondCustomerOid = CustomerFunctions.insertSampleCustomer(secondEmail);
CustomerMergeRequest mergeRequest = new CustomerMergeRequest();
// Supply either the email or the customer oid. Only need one.
mergeRequest.setEmail(secondEmail);
// mergeRequest.setCustomerProfileOid(customerOid);
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
customerApi.mergeCustomer(firstCustomerOid, mergeRequest, null);
// clean up this sample.
CustomerFunctions.deleteSampleCustomer(firstCustomerOid);
// Notice: No need to delete the second sample. The merge call deletes it.
}
catch (ApiException e) {
System.out.println("An ApiException occurred. Please review the following error:");
System.out.println(e); // <-- change_me: handle gracefully
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {CustomerFunctions} from './customerFunctions.js';
export class MergeCustomer {
/**
* The merge function was requested by UltraCart merchants that sell software and manage activation keys. Frequently,
* customers would purchase their software using one email address, and then accidentally re-subscribe using a
* different email address (for example, they purchased subsequent years using PayPal which was tied to their spouse's
* email). However it happened, the customer now how software licenses spread across multiple emails and therefore
* multiple customer profiles.
*
* merge combine the customer profiles, merging order history and software entitlements. Still, it may be used to
* combine any two customer profiles for any reason.
*
* Success returns back a status code 204 (No Content)
*/
static async execute() {
try {
// first customer
const firstCustomerOid = await CustomerFunctions.insertSampleCustomer();
const secondEmail = CustomerFunctions.createRandomEmail();
const secondCustomerOid = await CustomerFunctions.insertSampleCustomer(secondEmail);
const mergeRequest = {
// Supply either the email or the customer oid. Only need one.
email: secondEmail,
// customerProfileOid: customerOid, // Commented out as in original code
};
await new Promise((resolve, reject) => {
customerApi.mergeCustomer(firstCustomerOid, mergeRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// clean up this sample.
await CustomerFunctions.deleteSampleCustomer(firstCustomerOid);
// Notice: No need to delete the second sample. The merge call deletes it.
} catch (e) {
console.error("An ApiException occurred. Please review the following error:");
console.error(e); // <-- change_me: handle gracefully
throw e;
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerMergeRequest;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
/*
The merge function was requested by UltraCart merchants that sell software and manage activation keys. Frequently,
customers would purchase their software using one email address, and then accidentally re-subscribe using a
different email address (for example, they purchased subsequent years using PayPal which was tied to their spouse's
email). However it happened, the customer now how software licenses spread across multiple emails and therefore
multiple customer profiles.
merge combine the customer profiles, merging order history and software entitlements. Still, it may be used to
combine any two customer profiles for any reason.
Success returns back a status code 204 (No Content)
*/
try {
// first customer
$first_customer_oid = insertSampleCustomer();
$second_email = createRandomEmail();
$second_customer_oid = insertSampleCustomer($second_email);
$mergeRequest = new CustomerMergeRequest();
// Supply either the email or the customer oid. Only need one.
$mergeRequest->setEmail($second_email);
// $mergeRequest->setCustomerProfileOid($customer_oid);
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
$customer_api->mergeCustomer($first_customer_oid, $mergeRequest);
// clean up this sample.
deleteSampleCustomer($first_customer_oid);
// Notice: No need to delete the second sample. The merge call deletes it.
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from ultracart.models import CustomerMergeRequest
from samples import api_client
from customer_functions import (
insert_sample_customer,
delete_sample_customer,
create_random_email
)
def main():
try:
# Create first customer
first_customer_oid = insert_sample_customer()
# Create second customer with a different email
second_email = create_random_email()
second_customer_oid = insert_sample_customer(second_email)
# Create merge request
merge_request = CustomerMergeRequest(
email=second_email
# Alternatively, you could use:
# customer_profile_oid=second_customer_oid
)
# Create customer API instance
customer_api = CustomerApi(api_client())
# Perform customer merge
customer_api.merge_customer(first_customer_oid, merge_request)
# Clean up first customer (second customer is automatically deleted by merge)
delete_sample_customer(first_customer_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require necessary files
require 'ultracart_api'
require_relative '../constants'
require_relative 'customer_functions'
# The merge function was requested by UltraCart merchants that sell software and manage activation keys.
# Frequently, customers would purchase their software using one email address, and then accidentally
# re-subscribe using a different email address (for example, they purchased subsequent years using
# PayPal which was tied to their spouse's email).
#
# Merge combines the customer profiles, merging order history and software entitlements.
# It may be used to combine any two customer profiles for any reason.
#
# Success returns back a status code 204 (No Content)
begin
# First customer
first_customer_oid = insert_sample_customer
# Second customer with a different email
second_email = create_random_email
second_customer_oid = insert_sample_customer(second_email)
# Create merge request
merge_request = UltracartClient::CustomerMergeRequest.new(
# Supply either the email or the customer oid. Only need one.
email: second_email
# Alternatively: customer_profile_oid: customer_oid
)
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Merge customers
customer_api.merge_customer(first_customer_oid, merge_request)
# Clean up this sample
delete_sample_customer(first_customer_oid)
# Notice: No need to delete the second sample. The merge call deletes it.
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {CustomerMergeRequest} from 'ultracart_rest_api_v2_typescript';
import {CustomerFunctions} from './CustomerFunctions';
export class MergeCustomer {
/**
* The merge function was requested by UltraCart merchants that sell software and manage activation keys. Frequently,
* customers would purchase their software using one email address, and then accidentally re-subscribe using a
* different email address (for example, they purchased subsequent years using PayPal which was tied to their spouse's
* email). However it happened, the customer now how software licenses spread across multiple emails and therefore
* multiple customer profiles.
*
* merge combine the customer profiles, merging order history and software entitlements. Still, it may be used to
* combine any two customer profiles for any reason.
*
* Success returns back a status code 204 (No Content)
*/
public static async execute(): Promise<void> {
try {
// first customer
const firstCustomerOid: number = await CustomerFunctions.insertSampleCustomer();
const secondEmail: string = CustomerFunctions.createRandomEmail();
const secondCustomerOid: number = await CustomerFunctions.insertSampleCustomer(secondEmail);
const mergeRequest: CustomerMergeRequest = {
// Supply either the email or the customer oid. Only need one.
email: secondEmail,
// customerProfileOid: customerOid, // Commented out as in original code
};
await customerApi.mergeCustomer({customerProfileOid: firstCustomerOid, customer: mergeRequest});
// clean up this sample.
await CustomerFunctions.deleteSampleCustomer(firstCustomerOid);
// Notice: No need to delete the second sample. The merge call deletes it.
} catch (e) {
console.error("An ApiException occurred. Please review the following error:");
console.error(e); // <-- change_me: handle gracefully
throw e;
}
}
}
Retrieve the customer store credit accumulated through loyalty programs
SDK Function Name: getCustomerStoreCredit
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer oid to retrieve. | path | integer (int32) | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class GetCustomerStoreCredit
{
/*
getCustomerStoreCredit returns back the store credit for a customer, which includes:
total - lifetime credit
available - currently available store credit
vesting - amount of store credit vesting
expiring - amount of store credit expiring within 30 days
pastLedgers - transaction history
futureLedgers - future transactions including expiring entries
*/
public static void Execute()
{
try
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// create a customer
int customerOid = CustomerFunctions.InsertSampleCustomer();
// add some store credit.
CustomerStoreCreditAddRequest addRequest = new CustomerStoreCreditAddRequest();
addRequest.Description = "First credit add";
addRequest.VestingDays = 10;
addRequest.ExpirationDays = 20; // that's not a lot of time!
addRequest.Amount = 20;
customerApi.AddCustomerStoreCredit(customerOid, addRequest);
// add more store credit.
addRequest = new CustomerStoreCreditAddRequest();
addRequest.Description = "Second credit add";
addRequest.VestingDays = 0; // immediately available.
addRequest.ExpirationDays = 90;
addRequest.Amount = 40;
customerApi.AddCustomerStoreCredit(customerOid, addRequest);
CustomerStoreCreditResponse apiResponse = customerApi.GetCustomerStoreCredit(customerOid);
CustomerStoreCredit storeCredit = apiResponse.CustomerStoreCredit;
Console.WriteLine(storeCredit); // <-- There's a lot of information inside this object.
// clean up this sample.
CustomerFunctions.DeleteSampleCustomer(customerOid);
}
catch (Exception e)
{
Console.WriteLine("An Exception occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerStoreCredit;
import com.ultracart.admin.v2.models.CustomerStoreCreditAddRequest;
import com.ultracart.admin.v2.models.CustomerStoreCreditResponse;
import common.Constants;
import java.math.BigDecimal;
public class GetCustomerStoreCredit {
/*
getCustomerStoreCredit returns back the store credit for a customer, which includes:
total - lifetime credit
available - currently available store credit
vesting - amount of store credit vesting
expiring - amount of store credit expiring within 30 days
pastLedgers - transaction history
futureLedgers - future transactions including expiring entries
*/
public static void Execute() {
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// create a customer
int customerOid = CustomerFunctions.insertSampleCustomer();
// add some store credit.
CustomerStoreCreditAddRequest addRequest = new CustomerStoreCreditAddRequest();
addRequest.setDescription("First credit add");
addRequest.setVestingDays(10);
addRequest.setExpirationDays(20); // that's not a lot of time!
addRequest.setAmount(BigDecimal.valueOf(20));
customerApi.addCustomerStoreCredit(customerOid, addRequest);
// add more store credit.
addRequest = new CustomerStoreCreditAddRequest();
addRequest.setDescription("Second credit add");
addRequest.setVestingDays(0); // immediately available.
addRequest.setExpirationDays(90);
addRequest.setAmount(BigDecimal.valueOf(40));
customerApi.addCustomerStoreCredit(customerOid, addRequest);
CustomerStoreCreditResponse apiResponse = customerApi.getCustomerStoreCredit(customerOid);
CustomerStoreCredit storeCredit = apiResponse.getCustomerStoreCredit();
System.out.println(storeCredit); // <-- There's a lot of information inside this object.
// clean up this sample.
CustomerFunctions.deleteSampleCustomer(customerOid);
}
catch (Exception e) {
System.out.println("An Exception occurred. Please review the following error:");
System.out.println(e); // <-- change_me: handle gracefully
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {CustomerFunctions} from './customerFunctions.js';
export class GetCustomerStoreCredit {
/*
getCustomerStoreCredit returns back the store credit for a customer, which includes:
total - lifetime credit
available - currently available store credit
vesting - amount of store credit vesting
expiring - amount of store credit expiring within 30 days
pastLedgers - transaction history
futureLedgers - future transactions including expiring entries
*/
static async execute() {
try {
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// add some store credit.
const firstAddRequest = {
description: "First credit add",
vesting_days: 10,
expiration_days: 20, // that's not a lot of time!
amount: 20
};
await new Promise((resolve, reject) => {
customerApi.addCustomerStoreCredit(customerOid, firstAddRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// add more store credit.
const secondAddRequest = {
description: "Second credit add",
vesting_days: 0, // immediately available.
expiration_days: 90,
amount: 40
};
await new Promise((resolve, reject) => {
customerApi.addCustomerStoreCredit(customerOid, secondAddRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const apiResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerStoreCredit(customerOid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const storeCredit = apiResponse.customer_store_credit;
console.log(storeCredit); // <-- There's a lot of information inside this object.
// clean up this sample.
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (e) {
console.log("An Exception occurred. Please review the following error:");
console.log(e); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerStoreCreditAddRequest;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
/*
getCustomerStoreCredit returns back the store credit for a customer, which includes:
total - lifetime credit
available - currently available store credit
vesting - amount of store credit vesting
expiring - amount of store credit expiring within 30 days
pastLedgers - transaction history
futureLedgers - future transactions including expiring entries
*/
try {
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// create a customer
$customer_oid = insertSampleCustomer();
// add some store credit.
$addRequest = new CustomerStoreCreditAddRequest();
$addRequest->setDescription('First credit add');
$addRequest->setVestingDays(10);
$addRequest->setExpirationDays(20); // that's not a lot of time!
$addRequest->setAmount(20);
$customer_api->addCustomerStoreCredit($customer_oid, $addRequest);
// add more store credit.
$addRequest = new CustomerStoreCreditAddRequest();
$addRequest->setDescription('Second credit add');
$addRequest->setVestingDays(0); // immediately available.
$addRequest->setExpirationDays(90);
$addRequest->setAmount(40);
$customer_api->addCustomerStoreCredit($customer_oid, $addRequest);
$api_response = $customer_api->getCustomerStoreCredit($customer_oid);
$storeCredit = $api_response->getCustomerStoreCredit();
var_dump($storeCredit); // <-- There's a lot of information inside this object.
// clean up this sample.
deleteSampleCustomer($customer_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from ultracart.models import CustomerStoreCreditAddRequest
from ultracart.api_client import ApiException
from samples import api_client
from customer_functions import insert_sample_customer, delete_sample_customer
def add_customer_store_credit():
try:
# Create API instance
customer_api = CustomerApi(api_client())
# Create a customer
customer_oid = insert_sample_customer()
# First store credit addition
add_request_1 = CustomerStoreCreditAddRequest(
description='First credit add',
vesting_days=10,
expiration_days=20, # that's not a lot of time!
amount=20
)
customer_api.add_customer_store_credit(customer_oid, add_request_1)
# Second store credit addition
add_request_2 = CustomerStoreCreditAddRequest(
description='Second credit add',
vesting_days=0, # immediately available
expiration_days=90,
amount=40
)
customer_api.add_customer_store_credit(customer_oid, add_request_2)
# Retrieve store credit information
api_response = customer_api.get_customer_store_credit(customer_oid)
store_credit = api_response.customer_store_credit
# Print store credit details
print(store_credit) # Using print instead of var_dump
# Clean up the sample
delete_sample_customer(customer_oid)
except ApiException as e:
print('An ApiException occurred. Please review the following error:')
print(e)
raise
# Run the function if the script is executed directly
if __name__ == '__main__':
add_customer_store_credit()
#!/usr/bin/env ruby
require 'ultracart_api'
require_relative '../constants'
require_relative './customer_functions'
=begin
getCustomerStoreCredit returns back the store credit for a customer, which includes:
total - lifetime credit
available - currently available store credit
vesting - amount of store credit vesting
expiring - amount of store credit expiring within 30 days
pastLedgers - transaction history
futureLedgers - future transactions including expiring entries
=end
begin
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Create a customer
customer_oid = insert_sample_customer
# Add some store credit
add_request = UltracartClient::CustomerStoreCreditAddRequest.new(
description: 'First credit add',
vesting_days: 10,
expiration_days: 20, # that's not a lot of time!
amount: 20
)
customer_api.add_customer_store_credit(customer_oid, add_request)
# Add more store credit
add_request = UltracartClient::CustomerStoreCreditAddRequest.new(
description: 'Second credit add',
vesting_days: 0, # immediately available
expiration_days: 90,
amount: 40
)
customer_api.add_customer_store_credit(customer_oid, add_request)
# Retrieve store credit
api_response = customer_api.get_customer_store_credit(customer_oid)
store_credit = api_response.customer_store_credit
# Output store credit details
p store_credit # There's a lot of information inside this object
# Clean up this sample
delete_sample_customer(customer_oid)
rescue UltracartClient::ApiError => e
puts 'An ApiError occurred. Please review the following error:'
p e
exit 1
end
import { customerApi } from '../api';
import { CustomerStoreCreditAddRequest, CustomerStoreCreditResponse, CustomerStoreCredit } from 'ultracart_rest_api_v2_typescript';
import { CustomerFunctions } from './CustomerFunctions';
export class GetCustomerStoreCredit {
/*
getCustomerStoreCredit returns back the store credit for a customer, which includes:
total - lifetime credit
available - currently available store credit
vesting - amount of store credit vesting
expiring - amount of store credit expiring within 30 days
pastLedgers - transaction history
futureLedgers - future transactions including expiring entries
*/
public static async execute(): Promise<void> {
try {
// create a customer
const customerOid: number = await CustomerFunctions.insertSampleCustomer();
// add some store credit.
const firstAddRequest: CustomerStoreCreditAddRequest = {
description: "First credit add",
vesting_days: 10,
expiration_days: 20, // that's not a lot of time!
amount: 20
};
await customerApi.addCustomerStoreCredit({
customerProfileOid: customerOid,
storeCreditRequest: firstAddRequest
});
// add more store credit.
const secondAddRequest: CustomerStoreCreditAddRequest = {
description: "Second credit add",
vesting_days: 0, // immediately available.
expiration_days: 90,
amount: 40
};
await customerApi.addCustomerStoreCredit({
customerProfileOid: customerOid,
storeCreditRequest: secondAddRequest
});
const apiResponse: CustomerStoreCreditResponse = await customerApi.getCustomerStoreCredit({
customerProfileOid: customerOid
});
const storeCredit: CustomerStoreCredit|undefined = apiResponse.customer_store_credit;
console.log(storeCredit); // <-- There's a lot of information inside this object.
// clean up this sample.
await CustomerFunctions.deleteSampleCustomer(customerOid);
} catch (e) {
console.log("An Exception occurred. Please review the following error:");
console.log(e); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Adds store credit to a customer
SDK Function Name: addCustomerStoreCredit
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer oid to credit. | path | integer (int32) | required |
store_credit_request | Store credit to add | body | CustomerStoreCreditAddRequest | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
namespace SdkSample.customer
{
public class AddCustomerStoreCredit
{
/**
* Adds store credit to a customer's account.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing store credit -> "store_credit_request.amount is missing and is required."
* Zero or negative store credit -> "store_credit_request.amount must be a positive amount."
*/
public static void Execute()
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
string email = "test@ultracart.com";
Customer customer = customerApi.GetCustomerByEmail(email).Customer;
int customerOid = customer.CustomerProfileOid;
CustomerStoreCreditAddRequest storeCreditRequest = new CustomerStoreCreditAddRequest();
storeCreditRequest.Amount = 20.00m;
storeCreditRequest.Description = "Customer is super cool and I wanted to give them store credit.";
storeCreditRequest.ExpirationDays = 365; // or leave null for no expiration
storeCreditRequest.VestingDays = 45; // customer has to wait 45 days to use it.
BaseResponse apiResponse = customerApi.AddCustomerStoreCredit(customerOid, storeCreditRequest);
if (apiResponse.Error != null)
{
Console.Error.WriteLine(apiResponse.Error.DeveloperMessage);
Console.Error.WriteLine(apiResponse.Error.UserMessage);
Environment.Exit(1);
}
Console.WriteLine(apiResponse.Success);
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.BaseResponse;
import com.ultracart.admin.v2.models.Customer;
import com.ultracart.admin.v2.models.CustomerStoreCreditAddRequest;
import com.ultracart.admin.v2.util.ApiException;
import common.Constants;
import java.math.BigDecimal;
public class AddCustomerStoreCredit {
/**
* Adds store credit to a customer's account.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing store credit -> "store_credit_request.amount is missing and is required."
* Zero or negative store credit -> "store_credit_request.amount must be a positive amount."
*/
public static void execute() {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
try {
String email = "test@ultracart.com";
Customer customer = customerApi.getCustomerByEmail(email, null).getCustomer();
int customerOid = customer.getCustomerProfileOid();
CustomerStoreCreditAddRequest storeCreditRequest = new CustomerStoreCreditAddRequest();
storeCreditRequest.setAmount(BigDecimal.valueOf(20.00));
storeCreditRequest.setDescription("Customer is super cool and I wanted to give them store credit.");
storeCreditRequest.setExpirationDays(365); // or leave null for no expiration
storeCreditRequest.setVestingDays(45); // customer has to wait 45 days to use it.
BaseResponse apiResponse = customerApi.addCustomerStoreCredit(customerOid, storeCreditRequest);
if (apiResponse.getError() != null) {
System.err.println(apiResponse.getError().getDeveloperMessage());
System.err.println(apiResponse.getError().getUserMessage());
System.exit(1);
}
System.out.println(apiResponse.getSuccess());
} catch (ApiException e) {
System.err.println("API Exception: " + e.getMessage());
e.printStackTrace();
}
}
}
import {customerApi} from '../api.js';
export class AddCustomerStoreCredit {
/**
* Adds store credit to a customer's account.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing store credit -> "store_credit_request.amount is missing and is required."
* Zero or negative store credit -> "store_credit_request.amount must be a positive amount."
*/
static async execute() {
const email = "test@ultracart.com";
// Retrieve customer by email
const customerResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerByEmail(email, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const customer = customerResponse.customer;
if (!customer || !customer.customer_profile_oid) {
throw new Error("Customer not found or missing customer profile OID");
}
const customerOid = customer.customer_profile_oid;
const storeCreditRequest = {
amount: 20.00,
description: "Customer is super cool and I wanted to give them store credit.",
expiration_days: 365, // or leave undefined for no expiration
vesting_days: 45 // customer has to wait 45 days to use it.
};
const apiResponse = await new Promise((resolve, reject) => {
customerApi.addCustomerStoreCredit(customerOid, storeCreditRequest, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (apiResponse.error) {
console.error(apiResponse.error.developer_message);
console.error(apiResponse.error.user_message);
throw new Error("Failed to add store credit");
}
console.log(apiResponse.success);
}
}
<?php
ini_set('display_errors', 1);
/*
Adds store credit to a customer's account.
This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
Possible Errors:
Missing store credit -> "store_credit_request.amount is missing and is required."
Zero or negative store credit -> "store_credit_request.amount must be a positive amount."
*/
use ultracart\v2\api\CustomerApi;
use ultracart\v2\models\CustomerStoreCreditAddRequest;
require_once '../vendor/autoload.php';
require_once '../constants.php';
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
$email = "test@ultracart.com";
$customer = $customer_api->getCustomerByEmail($email)->getCustomer();
$customer_oid = $customer->getCustomerProfileOid();
$storeCreditRequest = new CustomerStoreCreditAddRequest();
$storeCreditRequest->setAmount(20.00);
$storeCreditRequest->setDescription("Customer is super cool and I wanted to give them store credit.");
$storeCreditRequest->setExpirationDays(365); // or leave null for no expiration
$storeCreditRequest->setVestingDays(45); // customer has to wait 45 days to use it.
$api_response = $customer_api->addCustomerStoreCredit($customer_oid, $storeCreditRequest);
if ($api_response->getError() != null) {
error_log($api_response->getError()->getDeveloperMessage());
error_log($api_response->getError()->getUserMessage());
exit();
}
echo '<html lang="en"><body><pre>';
var_dump($api_response->getSuccess());
echo '</pre></body></html>';
from ultracart.apis import CustomerApi
from samples import api_client
from ultracart.models import CustomerStoreCreditAddRequest
# Create the customer API instance
customer_api = CustomerApi(api_client())
# Set the email and retrieve customer
email = "test@ultracart.com"
customer = customer_api.get_customer_by_email(email).customer
customer_oid = customer.customer_profile_oid
# Create store credit request
store_credit_request = CustomerStoreCreditAddRequest(
amount=20.00,
description="Customer is super cool and I wanted to give them store credit.",
expiration_days=365, # or leave None for no expiration
vesting_days=45 # customer has to wait 45 days to use it
)
# Add store credit
api_response = customer_api.add_customer_store_credit(customer_oid, store_credit_request)
# Check for errors
if api_response.error is not None:
print(f"Developer Message: {api_response.error.developer_message}")
print(f"User Message: {api_response.error.user_message}")
exit()
# Print the success response
print(api_response.success)
#!/usr/bin/env ruby
# Adds store credit to a customer's account.
#
# This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
# If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
#
# Possible Errors:
# Missing store credit -> "store_credit_request.amount is missing and is required."
# Zero or negative store credit -> "store_credit_request.amount must be a positive amount."
require 'ultracart_api'
require_relative '../constants'
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Set the email of the customer
email = "test@ultracart.com"
# Retrieve the customer by email
customer = customer_api.get_customer_by_email(email).customer
customer_oid = customer.customer_profile_oid
# Create store credit add request
store_credit_request = UltracartClient::CustomerStoreCreditAddRequest.new(
amount: 20.00,
description: "Customer is super cool and I wanted to give them store credit.",
expiration_days: 365, # or leave nil for no expiration
vesting_days: 45 # customer has to wait 45 days to use it
)
# Add store credit to the customer's account
begin
api_response = customer_api.add_customer_store_credit(customer_oid, store_credit_request)
# Check for any errors in the response
if api_response.error
puts "Developer Message: #{api_response.error.developer_message}"
puts "User Message: #{api_response.error.user_message}"
exit(1)
end
# Output the success response
p api_response.success
rescue StandardError => e
puts "An error occurred: #{e.message}"
exit(1)
end
import {customerApi} from '../api';
import {
CustomerApi,
Customer,
CustomerStoreCreditAddRequest,
BaseResponse
} from 'ultracart_rest_api_v2_typescript';
export class AddCustomerStoreCredit {
/**
* Adds store credit to a customer's account.
*
* This method requires a customer profile oid. This is a unique number used by UltraCart to identify a customer.
* If you do not know a customer's oid, call getCustomerByEmail() to retrieve the customer and their oid.
*
* Possible Errors:
* Missing store credit -> "store_credit_request.amount is missing and is required."
* Zero or negative store credit -> "store_credit_request.amount must be a positive amount."
*/
public static async execute(): Promise<void> {
const email: string = "test@ultracart.com";
// Retrieve customer by email
const customerResponse = await customerApi.getCustomerByEmail({email});
const customer: Customer | undefined = customerResponse.customer;
if (!customer || !customer.customer_profile_oid) {
throw new Error("Customer not found or missing customer profile OID");
}
const customerOid: number = customer.customer_profile_oid;
const storeCreditRequest: CustomerStoreCreditAddRequest = {
amount: 20.00,
description: "Customer is super cool and I wanted to give them store credit.",
expiration_days: 365, // or leave undefined for no expiration
vesting_days: 45 // customer has to wait 45 days to use it.
};
const apiResponse: BaseResponse = await customerApi.addCustomerStoreCredit({
customerProfileOid: customerOid,
storeCreditRequest
});
if (apiResponse.error) {
console.error(apiResponse.error.developer_message);
console.error(apiResponse.error.user_message);
throw new Error("Failed to add store credit");
}
console.log(apiResponse.success);
}
}
Retrieve wishlist items for customer.
SDK Function Name: getCustomerWishList
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer oid for this wishlist. | path | integer (int32) | required |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using SdkSample.item;
namespace SdkSample.customer
{
public class GetCustomerWishList
{
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
DeleteWishListItem
GetCustomerWishList
GetCustomerWishListItem
InsertWishListItem
UpdateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void Execute()
{
try
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// create a few items first.
int firstItemOid = ItemFunctions.InsertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.InsertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.InsertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = firstItemOid;
addWishItem.Comments = "I really want this for my birthday";
addWishItem.Priority = 3; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = secondItemOid;
addWishItem.Comments = "Christmas Idea!";
addWishItem.Priority = 5; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.GetCustomerWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid).WishlistItem;
// retrieve all wishlist items
List<CustomerWishListItem> allWishListItems = customerApi.GetCustomerWishList(customerOid).WishlistItems;
// update an item.
secondCreatedWishItem.Priority = 4;
CustomerWishListItem updatedSecondWishItem = customerApi.UpdateWishListItem(customerOid, secondCreatedWishItem.CustomerWishlistItemOid, secondCreatedWishItem);
// delete a wish list item
customerApi.DeleteWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid);
// Clean up
CustomerFunctions.DeleteSampleCustomer(customerOid);
ItemFunctions.DeleteSampleItemByOid(firstItemOid);
ItemFunctions.DeleteSampleItemByOid(secondItemOid);
}
catch (Exception e)
{
Console.WriteLine("An Exception occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerWishListItem;
import com.ultracart.admin.v2.models.CustomerWishListItemsResponse;
import com.ultracart.admin.v2.util.ApiException;
import item.ItemFunctions;
import common.Constants;
public class GetCustomerWishList {
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface. The example below uses all of them.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void execute() {
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// create a few items first.
int firstItemOid = ItemFunctions.insertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.insertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(firstItemOid);
addWishItem.setComments("I really want this for my birthday");
addWishItem.setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(secondItemOid);
addWishItem.setComments("Christmas Idea!");
addWishItem.setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid()).getWishlistItem();
// retrieve all wishlist items
CustomerWishListItemsResponse allWishListItems = customerApi.getCustomerWishList(customerOid);
// update an item.
secondCreatedWishItem.setPriority(4);
CustomerWishListItem updatedSecondWishItem = customerApi.updateWishListItem(customerOid, secondCreatedWishItem.getCustomerWishlistItemOid(), secondCreatedWishItem);
// delete a wish list item
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid());
// Clean up
CustomerFunctions.deleteSampleCustomer(customerOid);
ItemFunctions.deleteSampleItemByOid(firstItemOid);
ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ApiException ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex);
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {ItemFunctions} from '../item/itemFunctions.js';
import {CustomerFunctions} from './customerFunctions.js';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class GetCustomerWishList {
static async execute() {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, firstWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const secondWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, secondWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems = await new Promise((resolve, reject) => {
customerApi.getCustomerWishList(customerOid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// update an item.
const updatedSecondWishItem = await new Promise((resolve, reject) => {
customerApi.updateWishListItem(customerOid, secondCreatedWishItem.customer_wishlist_item_oid, secondCreatedWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// delete a wish list item
await new Promise((resolve, reject) => {
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerWishListItem;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
require_once '../item/item_functions.php'; // <-- needed to create sample items to wish for
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
deleteWishListItem
getCustomerWishList
getCustomerWishListItem
insertWishListItem
updateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.getItemByMerchantItemId() to retrieve the item, then get $item->getMerchantItemOid()
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
try {
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// create a few items first.
$first_item_oid = insertSampleItemAndGetOid();
$second_item_oid = insertSampleItemAndGetOid();
// create a customer
$customer_oid = insertSampleCustomer();
// TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
// add some wish list items.
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($first_item_oid);
$addWishItem->setComments("I really want this for my birthday");
$addWishItem->setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$firstCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($second_item_oid);
$addWishItem->setComments("Christmas Idea!");
$addWishItem->setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$secondCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
// retrieve one wishlist item again
$firstCreatedWishItemCopy = $customer_api->getCustomerWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid())->getWishlistItem();
// retrieve all wishlist items
$allWishListItems = $customer_api->getCustomerWishList($customer_oid)->getWishlistItems();
// update an item.
$secondCreatedWishItem->setPriority(4);
$updatedSecondWishItem = $customer_api->updateWishListItem($customer_oid, $secondCreatedWishItem->getCustomerWishlistItemOid(), $secondCreatedWishItem);
// delete a wish list item
$customer_api->deleteWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid());
// Clean up
deleteSampleCustomer($customer_oid);
deleteSampleItemByOid($first_item_oid);
deleteSampleItemByOid($second_item_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from samples import api_client
from ultracart.models import CustomerWishListItem
from customer_functions import insert_sample_customer, delete_sample_customer
from item.item_functions import insert_sample_item_and_get_oid, delete_sample_item_by_oid
def main():
try:
# Create customer API instance
customer_api = CustomerApi(api_client())
# Create sample items
first_item_oid = insert_sample_item_and_get_oid()
second_item_oid = insert_sample_item_and_get_oid()
# Create a sample customer
customer_oid = insert_sample_customer()
# Add first wish list item
first_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=first_item_oid,
comments="I really want this for my birthday",
priority=3 # Low priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
# Add second wish list item
second_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=second_item_oid,
comments="Christmas Idea!",
priority=5 # High priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require necessary files
require 'ultracart_api'
require_relative '../constants'
require_relative 'customer_functions'
require_relative '../item/item_functions'
# The wishlist methods allow management of a customer's wishlist.
# This includes:
# - deleteWishListItem
# - getCustomerWishList
# - getCustomerWishListItem
# - insertWishListItem
# - updateWishListItem
# These methods provide a standard CRUD interface.
#
# You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
# call ItemApi.getItemByMerchantItemId() to retrieve the item, then get item.merchant_item_oid
#
# Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
begin
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Create a few items first
first_item_oid = insert_sample_item_and_get_oid
second_item_oid = insert_sample_item_and_get_oid
# Create a customer
customer_oid = insert_sample_customer
# TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
# Add some wish list items
first_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: first_item_oid,
comments: "I really want this for my birthday",
priority: 3 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
second_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: second_item_oid,
comments: "Christmas Idea!",
priority: 5 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item again
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {ItemFunctions} from '../item/ItemFunctions';
import {CustomerFunctions} from './CustomerFunctions';
import {
CustomerWishListItem,
CustomerWishListItemsResponse,
CustomerWishListItemResponse
} from 'ultracart_rest_api_v2_typescript';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class GetCustomerWishList {
public static async execute(): Promise<void> {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: firstWishItem
});
const secondWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: secondWishItem
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse: CustomerWishListItemResponse =
await customerApi.getCustomerWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems: CustomerWishListItemsResponse =
await customerApi.getCustomerWishList({customerProfileOid: customerOid});
// update an item.
const updatedSecondWishItem = await customerApi.updateWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: secondCreatedWishItem.customer_wishlist_item_oid as number,
wishlistItem: secondCreatedWishItem
});
// delete a wish list item
await customerApi.deleteWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Insert a customer wishlist item
SDK Function Name: insertWishListItem
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
wishlist_item | Wishlist item to insert | body | CustomerWishListItem | required |
customer_profile_oid | The customer oid for this wishlist. | path | integer (int32) | required |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Client;
using com.ultracart.admin.v2.Model;
using SdkSample.item;
namespace SdkSample.customer
{
public class InsertWishListItem
{
public static void Execute()
{
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
DeleteWishListItem
GetCustomerWishList
GetCustomerWishListItem
InsertWishListItem
UpdateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
try
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// create a few items first.
int firstItemOid = ItemFunctions.InsertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.InsertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.InsertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = firstItemOid;
addWishItem.Comments = "I really want this for my birthday";
addWishItem.Priority = 3; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = secondItemOid;
addWishItem.Comments = "Christmas Idea!";
addWishItem.Priority = 5; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.GetCustomerWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid).WishlistItem;
// retrieve all wishlist items
List<CustomerWishListItem> allWishListItems = customerApi.GetCustomerWishList(customerOid).WishlistItems;
// update an item.
secondCreatedWishItem.Priority = 4;
CustomerWishListItem updatedSecondWishItem = customerApi.UpdateWishListItem(customerOid, secondCreatedWishItem.CustomerWishlistItemOid, secondCreatedWishItem);
// delete a wish list item
customerApi.DeleteWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid);
// Clean up
CustomerFunctions.DeleteSampleCustomer(customerOid);
ItemFunctions.DeleteSampleItemByOid(firstItemOid);
ItemFunctions.DeleteSampleItemByOid(secondItemOid);
}
catch (ApiException e)
{
Console.WriteLine("An ApiException occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerWishListItem;
import com.ultracart.admin.v2.models.CustomerWishListItemsResponse;
import com.ultracart.admin.v2.util.ApiException;
import item.ItemFunctions;
import common.Constants;
public class InsertWishListItem {
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface. The example below uses all of them.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void execute() {
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// create a few items first.
int firstItemOid = ItemFunctions.insertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.insertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(firstItemOid);
addWishItem.setComments("I really want this for my birthday");
addWishItem.setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(secondItemOid);
addWishItem.setComments("Christmas Idea!");
addWishItem.setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid()).getWishlistItem();
// retrieve all wishlist items
CustomerWishListItemsResponse allWishListItems = customerApi.getCustomerWishList(customerOid);
// update an item.
secondCreatedWishItem.setPriority(4);
CustomerWishListItem updatedSecondWishItem = customerApi.updateWishListItem(customerOid, secondCreatedWishItem.getCustomerWishlistItemOid(), secondCreatedWishItem);
// delete a wish list item
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid());
// Clean up
CustomerFunctions.deleteSampleCustomer(customerOid);
ItemFunctions.deleteSampleItemByOid(firstItemOid);
ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ApiException ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex);
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {ItemFunctions} from '../item/itemFunctions.js';
import {CustomerFunctions} from './customerFunctions.js';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class InsertWishListItem {
static async execute() {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, firstWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const secondWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, secondWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems = await new Promise((resolve, reject) => {
customerApi.getCustomerWishList(customerOid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// update an item.
const updatedSecondWishItem = await new Promise((resolve, reject) => {
customerApi.updateWishListItem(customerOid, secondCreatedWishItem.customer_wishlist_item_oid, secondCreatedWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// delete a wish list item
await new Promise((resolve, reject) => {
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerWishListItem;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
require_once '../item/item_functions.php'; // <-- needed to create sample items to wish for
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
deleteWishListItem
getCustomerWishList
getCustomerWishListItem
insertWishListItem
updateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.getItemByMerchantItemId() to retrieve the item, then get $item->getMerchantItemOid()
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
try {
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// create a few items first.
$first_item_oid = insertSampleItemAndGetOid();
$second_item_oid = insertSampleItemAndGetOid();
// create a customer
$customer_oid = insertSampleCustomer();
// TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
// add some wish list items.
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($first_item_oid);
$addWishItem->setComments("I really want this for my birthday");
$addWishItem->setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$firstCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($second_item_oid);
$addWishItem->setComments("Christmas Idea!");
$addWishItem->setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$secondCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
// retrieve one wishlist item again
$firstCreatedWishItemCopy = $customer_api->getCustomerWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid())->getWishlistItem();
// retrieve all wishlist items
$allWishListItems = $customer_api->getCustomerWishList($customer_oid)->getWishlistItems();
// update an item.
$secondCreatedWishItem->setPriority(4);
$updatedSecondWishItem = $customer_api->updateWishListItem($customer_oid, $secondCreatedWishItem->getCustomerWishlistItemOid(), $secondCreatedWishItem);
// delete a wish list item
$customer_api->deleteWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid());
// Clean up
deleteSampleCustomer($customer_oid);
deleteSampleItemByOid($first_item_oid);
deleteSampleItemByOid($second_item_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from samples import api_client
from ultracart.models import CustomerWishListItem
from customer_functions import insert_sample_customer, delete_sample_customer
from item.item_functions import insert_sample_item_and_get_oid, delete_sample_item_by_oid
def main():
try:
# Create customer API instance
customer_api = CustomerApi(api_client())
# Create sample items
first_item_oid = insert_sample_item_and_get_oid()
second_item_oid = insert_sample_item_and_get_oid()
# Create a sample customer
customer_oid = insert_sample_customer()
# Add first wish list item
first_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=first_item_oid,
comments="I really want this for my birthday",
priority=3 # Low priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
# Add second wish list item
second_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=second_item_oid,
comments="Christmas Idea!",
priority=5 # High priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require necessary files
require 'ultracart_api'
require_relative '../constants'
require_relative 'customer_functions'
require_relative '../item/item_functions'
# The wishlist methods allow management of a customer's wishlist.
# This includes:
# - deleteWishListItem
# - getCustomerWishList
# - getCustomerWishListItem
# - insertWishListItem
# - updateWishListItem
# These methods provide a standard CRUD interface.
#
# You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
# call ItemApi.getItemByMerchantItemId() to retrieve the item, then get item.merchant_item_oid
#
# Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
begin
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Create a few items first
first_item_oid = insert_sample_item_and_get_oid
second_item_oid = insert_sample_item_and_get_oid
# Create a customer
customer_oid = insert_sample_customer
# TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
# Add some wish list items
first_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: first_item_oid,
comments: "I really want this for my birthday",
priority: 3 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
second_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: second_item_oid,
comments: "Christmas Idea!",
priority: 5 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item again
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {ItemFunctions} from '../item/ItemFunctions';
import {CustomerFunctions} from './CustomerFunctions';
import {
CustomerWishListItem,
CustomerWishListItemsResponse,
CustomerWishListItemResponse
} from 'ultracart_rest_api_v2_typescript';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class InsertWishListItem {
public static async execute(): Promise<void> {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: firstWishItem
});
const secondWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: secondWishItem
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse: CustomerWishListItemResponse =
await customerApi.getCustomerWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems: CustomerWishListItemsResponse =
await customerApi.getCustomerWishList({customerProfileOid: customerOid});
// update an item.
const updatedSecondWishItem = await customerApi.updateWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: secondCreatedWishItem.customer_wishlist_item_oid as number,
wishlistItem: secondCreatedWishItem
});
// delete a wish list item
await customerApi.deleteWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Delete a customer wishlist item
SDK Function Name: deleteWishListItem
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer oid for this wishlist. | path | integer (int32) | required |
customer_wishlist_item_oid | The wishlist oid for this wishlist item to delete. | path | integer (int32) | required |
using System;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using SdkSample.item;
namespace SdkSample.customer
{
public class DeleteWishListItem
{
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface. The example below uses all of them.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void Execute()
{
try
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// create a few items first.
int firstItemOid = ItemFunctions.InsertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.InsertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.InsertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = firstItemOid;
addWishItem.Comments = "I really want this for my birthday";
addWishItem.Priority = 3; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = secondItemOid;
addWishItem.Comments = "Christmas Idea!";
addWishItem.Priority = 5; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.GetCustomerWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid).WishlistItem;
// retrieve all wishlist items
CustomerWishListItemsResponse allWishListItems = customerApi.GetCustomerWishList(customerOid);
// update an item.
secondCreatedWishItem.Priority = 4;
CustomerWishListItem updatedSecondWishItem = customerApi.UpdateWishListItem(customerOid, secondCreatedWishItem.CustomerWishlistItemOid, secondCreatedWishItem);
// delete a wish list item
customerApi.DeleteWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid);
// Clean up
CustomerFunctions.DeleteSampleCustomer(customerOid);
ItemFunctions.DeleteSampleItemByOid(firstItemOid);
ItemFunctions.DeleteSampleItemByOid(secondItemOid);
}
catch (Exception ex)
{
Console.Error.WriteLine("An Exception occurred. Please review the following error:");
Console.Error.WriteLine(ex); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerWishListItem;
import com.ultracart.admin.v2.models.CustomerWishListItemsResponse;
import com.ultracart.admin.v2.util.ApiException;
import item.ItemFunctions;
import common.Constants;
public class DeleteWishListItem {
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface. The example below uses all of them.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void execute() {
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// create a few items first.
int firstItemOid = ItemFunctions.insertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.insertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(firstItemOid);
addWishItem.setComments("I really want this for my birthday");
addWishItem.setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(secondItemOid);
addWishItem.setComments("Christmas Idea!");
addWishItem.setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid()).getWishlistItem();
// retrieve all wishlist items
CustomerWishListItemsResponse allWishListItems = customerApi.getCustomerWishList(customerOid);
// update an item.
secondCreatedWishItem.setPriority(4);
CustomerWishListItem updatedSecondWishItem = customerApi.updateWishListItem(customerOid, secondCreatedWishItem.getCustomerWishlistItemOid(), secondCreatedWishItem);
// delete a wish list item
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid());
// Clean up
CustomerFunctions.deleteSampleCustomer(customerOid);
ItemFunctions.deleteSampleItemByOid(firstItemOid);
ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ApiException ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex);
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {ItemFunctions} from '../item/itemFunctions.js';
import {CustomerFunctions} from './customerFunctions.js';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class DeleteWishListItem {
static async execute() {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, firstWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const secondWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, secondWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems = await new Promise((resolve, reject) => {
customerApi.getCustomerWishList(customerOid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// update an item.
const updatedSecondWishItem = await new Promise((resolve, reject) => {
customerApi.updateWishListItem(customerOid, secondCreatedWishItem.customer_wishlist_item_oid, secondCreatedWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// delete a wish list item
await new Promise((resolve, reject) => {
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerWishListItem;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
require_once '../item/item_functions.php'; // <-- needed to create sample items to wish for
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
deleteWishListItem
getCustomerWishList
getCustomerWishListItem
insertWishListItem
updateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.getItemByMerchantItemId() to retrieve the item, then get $item->getMerchantItemOid()
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
try {
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// create a few items first.
$first_item_oid = insertSampleItemAndGetOid();
$second_item_oid = insertSampleItemAndGetOid();
// create a customer
$customer_oid = insertSampleCustomer();
// TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
// add some wish list items.
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($first_item_oid);
$addWishItem->setComments("I really want this for my birthday");
$addWishItem->setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$firstCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($second_item_oid);
$addWishItem->setComments("Christmas Idea!");
$addWishItem->setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$secondCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
// retrieve one wishlist item again
$firstCreatedWishItemCopy = $customer_api->getCustomerWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid())->getWishlistItem();
// retrieve all wishlist items
$allWishListItems = $customer_api->getCustomerWishList($customer_oid)->getWishlistItems();
// update an item.
$secondCreatedWishItem->setPriority(4);
$updatedSecondWishItem = $customer_api->updateWishListItem($customer_oid, $secondCreatedWishItem->getCustomerWishlistItemOid(), $secondCreatedWishItem);
// delete a wish list item
$customer_api->deleteWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid());
// Clean up
deleteSampleCustomer($customer_oid);
deleteSampleItemByOid($first_item_oid);
deleteSampleItemByOid($second_item_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from samples import api_client
from ultracart.models import CustomerWishListItem
from customer_functions import insert_sample_customer, delete_sample_customer
from item.item_functions import insert_sample_item_and_get_oid, delete_sample_item_by_oid
def main():
try:
# Create customer API instance
customer_api = CustomerApi(api_client())
# Create sample items
first_item_oid = insert_sample_item_and_get_oid()
second_item_oid = insert_sample_item_and_get_oid()
# Create a sample customer
customer_oid = insert_sample_customer()
# Add first wish list item
first_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=first_item_oid,
comments="I really want this for my birthday",
priority=3 # Low priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
# Add second wish list item
second_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=second_item_oid,
comments="Christmas Idea!",
priority=5 # High priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require necessary files
require 'ultracart_api'
require_relative '../constants'
require_relative 'customer_functions'
require_relative '../item/item_functions'
# The wishlist methods allow management of a customer's wishlist.
# This includes:
# - deleteWishListItem
# - getCustomerWishList
# - getCustomerWishListItem
# - insertWishListItem
# - updateWishListItem
# These methods provide a standard CRUD interface.
#
# You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
# call ItemApi.getItemByMerchantItemId() to retrieve the item, then get item.merchant_item_oid
#
# Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
begin
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Create a few items first
first_item_oid = insert_sample_item_and_get_oid
second_item_oid = insert_sample_item_and_get_oid
# Create a customer
customer_oid = insert_sample_customer
# TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
# Add some wish list items
first_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: first_item_oid,
comments: "I really want this for my birthday",
priority: 3 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
second_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: second_item_oid,
comments: "Christmas Idea!",
priority: 5 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item again
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {ItemFunctions} from '../item/ItemFunctions';
import {CustomerFunctions} from './CustomerFunctions';
import {
CustomerWishListItem,
CustomerWishListItemsResponse,
CustomerWishListItemResponse
} from 'ultracart_rest_api_v2_typescript';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class DeleteWishListItem {
public static async execute(): Promise<void> {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: firstWishItem
});
const secondWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: secondWishItem
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse: CustomerWishListItemResponse =
await customerApi.getCustomerWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems: CustomerWishListItemsResponse =
await customerApi.getCustomerWishList({customerProfileOid: customerOid});
// update an item.
const updatedSecondWishItem = await customerApi.updateWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: secondCreatedWishItem.customer_wishlist_item_oid as number,
wishlistItem: secondCreatedWishItem
});
// delete a wish list item
await customerApi.deleteWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Retrieve wishlist item for customer.
SDK Function Name: getCustomerWishListItem
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
customer_profile_oid | The customer oid for this wishlist. | path | integer (int32) | required |
customer_wishlist_item_oid | The wishlist oid for this wishlist item. | path | integer (int32) | required |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Model;
using SdkSample.item;
namespace SdkSample.customer
{
public class GetCustomerWishListItem
{
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
DeleteWishListItem
GetCustomerWishList
GetCustomerWishListItem
InsertWishListItem
UpdateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void Execute()
{
try
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// create a few items first.
int firstItemOid = ItemFunctions.InsertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.InsertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.InsertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = firstItemOid;
addWishItem.Comments = "I really want this for my birthday";
addWishItem.Priority = 3; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = secondItemOid;
addWishItem.Comments = "Christmas Idea!";
addWishItem.Priority = 5; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.GetCustomerWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid).WishlistItem;
// retrieve all wishlist items
List<CustomerWishListItem> allWishListItems = customerApi.GetCustomerWishList(customerOid).WishlistItems;
// update an item.
secondCreatedWishItem.Priority = 4;
CustomerWishListItem updatedSecondWishItem = customerApi.UpdateWishListItem(customerOid, secondCreatedWishItem.CustomerWishlistItemOid, secondCreatedWishItem);
// delete a wish list item
customerApi.DeleteWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid);
// Clean up
CustomerFunctions.DeleteSampleCustomer(customerOid);
ItemFunctions.DeleteSampleItemByOid(firstItemOid);
ItemFunctions.DeleteSampleItemByOid(secondItemOid);
}
catch (Exception e)
{
Console.WriteLine("An Exception occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerWishListItem;
import com.ultracart.admin.v2.models.CustomerWishListItemsResponse;
import com.ultracart.admin.v2.util.ApiException;
import item.ItemFunctions;
import common.Constants;
public class GetCustomerWishListItem {
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface. The example below uses all of them.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void execute() {
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// create a few items first.
int firstItemOid = ItemFunctions.insertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.insertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(firstItemOid);
addWishItem.setComments("I really want this for my birthday");
addWishItem.setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(secondItemOid);
addWishItem.setComments("Christmas Idea!");
addWishItem.setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid()).getWishlistItem();
// retrieve all wishlist items
CustomerWishListItemsResponse allWishListItems = customerApi.getCustomerWishList(customerOid);
// update an item.
secondCreatedWishItem.setPriority(4);
CustomerWishListItem updatedSecondWishItem = customerApi.updateWishListItem(customerOid, secondCreatedWishItem.getCustomerWishlistItemOid(), secondCreatedWishItem);
// delete a wish list item
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid());
// Clean up
CustomerFunctions.deleteSampleCustomer(customerOid);
ItemFunctions.deleteSampleItemByOid(firstItemOid);
ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ApiException ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex);
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {ItemFunctions} from '../item/itemFunctions.js';
import {CustomerFunctions} from './customerFunctions.js';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class GetCustomerWishListItem {
static async execute() {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, firstWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const secondWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, secondWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems = await new Promise((resolve, reject) => {
customerApi.getCustomerWishList(customerOid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// update an item.
const updatedSecondWishItem = await new Promise((resolve, reject) => {
customerApi.updateWishListItem(customerOid, secondCreatedWishItem.customer_wishlist_item_oid, secondCreatedWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// delete a wish list item
await new Promise((resolve, reject) => {
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerWishListItem;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
require_once '../item/item_functions.php'; // <-- needed to create sample items to wish for
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
deleteWishListItem
getCustomerWishList
getCustomerWishListItem
insertWishListItem
updateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.getItemByMerchantItemId() to retrieve the item, then get $item->getMerchantItemOid()
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
try {
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// create a few items first.
$first_item_oid = insertSampleItemAndGetOid();
$second_item_oid = insertSampleItemAndGetOid();
// create a customer
$customer_oid = insertSampleCustomer();
// TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
// add some wish list items.
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($first_item_oid);
$addWishItem->setComments("I really want this for my birthday");
$addWishItem->setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$firstCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($second_item_oid);
$addWishItem->setComments("Christmas Idea!");
$addWishItem->setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$secondCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
// retrieve one wishlist item again
$firstCreatedWishItemCopy = $customer_api->getCustomerWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid())->getWishlistItem();
// retrieve all wishlist items
$allWishListItems = $customer_api->getCustomerWishList($customer_oid)->getWishlistItems();
// update an item.
$secondCreatedWishItem->setPriority(4);
$updatedSecondWishItem = $customer_api->updateWishListItem($customer_oid, $secondCreatedWishItem->getCustomerWishlistItemOid(), $secondCreatedWishItem);
// delete a wish list item
$customer_api->deleteWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid());
// Clean up
deleteSampleCustomer($customer_oid);
deleteSampleItemByOid($first_item_oid);
deleteSampleItemByOid($second_item_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from samples import api_client
from ultracart.models import CustomerWishListItem
from customer_functions import insert_sample_customer, delete_sample_customer
from item.item_functions import insert_sample_item_and_get_oid, delete_sample_item_by_oid
def main():
try:
# Create customer API instance
customer_api = CustomerApi(api_client())
# Create sample items
first_item_oid = insert_sample_item_and_get_oid()
second_item_oid = insert_sample_item_and_get_oid()
# Create a sample customer
customer_oid = insert_sample_customer()
# Add first wish list item
first_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=first_item_oid,
comments="I really want this for my birthday",
priority=3 # Low priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
# Add second wish list item
second_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=second_item_oid,
comments="Christmas Idea!",
priority=5 # High priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require necessary files
require 'ultracart_api'
require_relative '../constants'
require_relative 'customer_functions'
require_relative '../item/item_functions'
# The wishlist methods allow management of a customer's wishlist.
# This includes:
# - deleteWishListItem
# - getCustomerWishList
# - getCustomerWishListItem
# - insertWishListItem
# - updateWishListItem
# These methods provide a standard CRUD interface.
#
# You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
# call ItemApi.getItemByMerchantItemId() to retrieve the item, then get item.merchant_item_oid
#
# Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
begin
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Create a few items first
first_item_oid = insert_sample_item_and_get_oid
second_item_oid = insert_sample_item_and_get_oid
# Create a customer
customer_oid = insert_sample_customer
# TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
# Add some wish list items
first_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: first_item_oid,
comments: "I really want this for my birthday",
priority: 3 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
second_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: second_item_oid,
comments: "Christmas Idea!",
priority: 5 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item again
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {ItemFunctions} from '../item/ItemFunctions';
import {CustomerFunctions} from './CustomerFunctions';
import {
CustomerWishListItem,
CustomerWishListItemsResponse,
CustomerWishListItemResponse
} from 'ultracart_rest_api_v2_typescript';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class GetCustomerWishListItem {
public static async execute(): Promise<void> {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: firstWishItem
});
const secondWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: secondWishItem
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse: CustomerWishListItemResponse =
await customerApi.getCustomerWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems: CustomerWishListItemsResponse =
await customerApi.getCustomerWishList({customerProfileOid: customerOid});
// update an item.
const updatedSecondWishItem = await customerApi.updateWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: secondCreatedWishItem.customer_wishlist_item_oid as number,
wishlistItem: secondCreatedWishItem
});
// delete a wish list item
await customerApi.deleteWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Update a customer wishlist item
SDK Function Name: updateWishListItem
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
wishlist_item | Wishlist item to update | body | CustomerWishListItem | required |
customer_profile_oid | The customer oid for this wishlist. | path | integer (int32) | required |
customer_wishlist_item_oid | The wishlist oid for this wishlist item. | path | integer (int32) | required |
using System;
using System.Collections.Generic;
using com.ultracart.admin.v2.Api;
using com.ultracart.admin.v2.Client;
using com.ultracart.admin.v2.Model;
using SdkSample.item;
namespace SdkSample.customer
{
public class UpdateWishListItem
{
public static void Execute()
{
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
DeleteWishListItem
GetCustomerWishList
GetCustomerWishListItem
InsertWishListItem
UpdateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
try
{
CustomerApi customerApi = new CustomerApi(Constants.ApiKey);
// create a few items first.
int firstItemOid = ItemFunctions.InsertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.InsertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.InsertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = firstItemOid;
addWishItem.Comments = "I really want this for my birthday";
addWishItem.Priority = 3; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.CustomerProfileOid = customerOid;
addWishItem.MerchantItemOid = secondItemOid;
addWishItem.Comments = "Christmas Idea!";
addWishItem.Priority = 5; // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.InsertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.GetCustomerWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid).WishlistItem;
// retrieve all wishlist items
List<CustomerWishListItem> allWishListItems = customerApi.GetCustomerWishList(customerOid).WishlistItems;
// update an item.
secondCreatedWishItem.Priority = 4;
CustomerWishListItem updatedSecondWishItem = customerApi.UpdateWishListItem(customerOid, secondCreatedWishItem.CustomerWishlistItemOid, secondCreatedWishItem);
// delete a wish list item
customerApi.DeleteWishListItem(customerOid, firstCreatedWishItem.CustomerWishlistItemOid);
// Clean up
CustomerFunctions.DeleteSampleCustomer(customerOid);
ItemFunctions.DeleteSampleItemByOid(firstItemOid);
ItemFunctions.DeleteSampleItemByOid(secondItemOid);
}
catch (ApiException e)
{
Console.WriteLine("An ApiException occurred. Please review the following error:");
Console.WriteLine(e); // <-- change_me: handle gracefully
Environment.Exit(1);
}
}
}
}
package customer;
import com.ultracart.admin.v2.CustomerApi;
import com.ultracart.admin.v2.models.CustomerWishListItem;
import com.ultracart.admin.v2.models.CustomerWishListItemsResponse;
import com.ultracart.admin.v2.util.ApiException;
import item.ItemFunctions;
import common.Constants;
public class UpdateWishListItem {
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface. The example below uses all of them.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
public static void execute() {
try {
CustomerApi customerApi = new CustomerApi(Constants.API_KEY);
// create a few items first.
int firstItemOid = ItemFunctions.insertSampleItemAndGetOid();
int secondItemOid = ItemFunctions.insertSampleItemAndGetOid();
// create a customer
int customerOid = CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
CustomerWishListItem addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(firstItemOid);
addWishItem.setComments("I really want this for my birthday");
addWishItem.setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem firstCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
addWishItem = new CustomerWishListItem();
addWishItem.setCustomerProfileOid(customerOid);
addWishItem.setMerchantItemOid(secondItemOid);
addWishItem.setComments("Christmas Idea!");
addWishItem.setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
CustomerWishListItem secondCreatedWishItem = customerApi.insertWishListItem(customerOid, addWishItem);
// retrieve one wishlist item again
CustomerWishListItem firstCreatedWishItemCopy = customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid()).getWishlistItem();
// retrieve all wishlist items
CustomerWishListItemsResponse allWishListItems = customerApi.getCustomerWishList(customerOid);
// update an item.
secondCreatedWishItem.setPriority(4);
CustomerWishListItem updatedSecondWishItem = customerApi.updateWishListItem(customerOid, secondCreatedWishItem.getCustomerWishlistItemOid(), secondCreatedWishItem);
// delete a wish list item
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.getCustomerWishlistItemOid());
// Clean up
CustomerFunctions.deleteSampleCustomer(customerOid);
ItemFunctions.deleteSampleItemByOid(firstItemOid);
ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ApiException ex) {
System.err.println("An Exception occurred. Please review the following error:");
System.err.println(ex);
System.exit(1);
}
}
}
import {customerApi} from '../api.js';
import {ItemFunctions} from '../item/itemFunctions.js';
import {CustomerFunctions} from './customerFunctions.js';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class UpdateWishListItem {
static async execute() {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, firstWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const secondWishItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await new Promise((resolve, reject) => {
customerApi.insertWishListItem(customerOid, secondWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse = await new Promise((resolve, reject) => {
customerApi.getCustomerWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems = await new Promise((resolve, reject) => {
customerApi.getCustomerWishList(customerOid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// update an item.
const updatedSecondWishItem = await new Promise((resolve, reject) => {
customerApi.updateWishListItem(customerOid, secondCreatedWishItem.customer_wishlist_item_oid, secondCreatedWishItem, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// delete a wish list item
await new Promise((resolve, reject) => {
customerApi.deleteWishListItem(customerOid, firstCreatedWishItem.customer_wishlist_item_oid, function (error, data, response) {
if (error) {
reject(error);
} else {
resolve(data, response);
}
});
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
<?php
use ultracart\v2\api\CustomerApi;
use ultracart\v2\ApiException;
use ultracart\v2\models\CustomerWishListItem;
require_once '../vendor/autoload.php';
require_once '../samples.php';
require_once './customer_functions.php'; // <-- see this file for details
require_once '../item/item_functions.php'; // <-- needed to create sample items to wish for
/*
The wishlist methods allow management of a customer's wishlist.
This includes:
deleteWishListItem
getCustomerWishList
getCustomerWishListItem
insertWishListItem
updateWishListItem
These methods provide a standard CRUD interface. The example below uses all of them.
You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
call ItemApi.getItemByMerchantItemId() to retrieve the item, then get $item->getMerchantItemOid()
Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
try {
$customer_api = CustomerApi::usingApiKey(Constants::API_KEY);
// create a few items first.
$first_item_oid = insertSampleItemAndGetOid();
$second_item_oid = insertSampleItemAndGetOid();
// create a customer
$customer_oid = insertSampleCustomer();
// TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
// add some wish list items.
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($first_item_oid);
$addWishItem->setComments("I really want this for my birthday");
$addWishItem->setPriority(3); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$firstCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
$addWishItem = new CustomerWishListItem();
$addWishItem->setCustomerProfileOid($customer_oid);
$addWishItem->setMerchantItemOid($second_item_oid);
$addWishItem->setComments("Christmas Idea!");
$addWishItem->setPriority(5); // Priority of wishlist item, 3 being low priority and 5 is high priority.
$secondCreatedWishItem = $customer_api->insertWishListItem($customer_oid, $addWishItem);
// retrieve one wishlist item again
$firstCreatedWishItemCopy = $customer_api->getCustomerWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid())->getWishlistItem();
// retrieve all wishlist items
$allWishListItems = $customer_api->getCustomerWishList($customer_oid)->getWishlistItems();
// update an item.
$secondCreatedWishItem->setPriority(4);
$updatedSecondWishItem = $customer_api->updateWishListItem($customer_oid, $secondCreatedWishItem->getCustomerWishlistItemOid(), $secondCreatedWishItem);
// delete a wish list item
$customer_api->deleteWishListItem($customer_oid, $firstCreatedWishItem->getCustomerWishlistItemOid());
// Clean up
deleteSampleCustomer($customer_oid);
deleteSampleItemByOid($first_item_oid);
deleteSampleItemByOid($second_item_oid);
} catch (ApiException $e) {
echo 'An ApiException occurred. Please review the following error:';
var_dump($e); // <-- change_me: handle gracefully
die(1);
}
from ultracart.apis import CustomerApi
from samples import api_client
from ultracart.models import CustomerWishListItem
from customer_functions import insert_sample_customer, delete_sample_customer
from item.item_functions import insert_sample_item_and_get_oid, delete_sample_item_by_oid
def main():
try:
# Create customer API instance
customer_api = CustomerApi(api_client())
# Create sample items
first_item_oid = insert_sample_item_and_get_oid()
second_item_oid = insert_sample_item_and_get_oid()
# Create a sample customer
customer_oid = insert_sample_customer()
# Add first wish list item
first_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=first_item_oid,
comments="I really want this for my birthday",
priority=3 # Low priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
# Add second wish list item
second_wish_item = CustomerWishListItem(
customer_profile_oid=customer_oid,
merchant_item_oid=second_item_oid,
comments="Christmas Idea!",
priority=5 # High priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
except Exception as e:
print('An exception occurred. Please review the following error:')
print(e)
import sys
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env ruby
# Require necessary files
require 'ultracart_api'
require_relative '../constants'
require_relative 'customer_functions'
require_relative '../item/item_functions'
# The wishlist methods allow management of a customer's wishlist.
# This includes:
# - deleteWishListItem
# - getCustomerWishList
# - getCustomerWishListItem
# - insertWishListItem
# - updateWishListItem
# These methods provide a standard CRUD interface.
#
# You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
# call ItemApi.getItemByMerchantItemId() to retrieve the item, then get item.merchant_item_oid
#
# Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
begin
# Initialize the customer API
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY)
# Create a few items first
first_item_oid = insert_sample_item_and_get_oid
second_item_oid = insert_sample_item_and_get_oid
# Create a customer
customer_oid = insert_sample_customer
# TODO: If you don't know the customer oid, use getCustomerByEmail() to retrieve the customer.
# Add some wish list items
first_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: first_item_oid,
comments: "I really want this for my birthday",
priority: 3 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
first_created_wish_item = customer_api.insert_wish_list_item(customer_oid, first_wish_item)
second_wish_item = UltracartClient::CustomerWishListItem.new(
customer_profile_oid: customer_oid,
merchant_item_oid: second_item_oid,
comments: "Christmas Idea!",
priority: 5 # Priority of wishlist item, 3 being low priority and 5 is high priority
)
second_created_wish_item = customer_api.insert_wish_list_item(customer_oid, second_wish_item)
# Retrieve one wishlist item again
first_created_wish_item_copy = customer_api.get_customer_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
).wishlist_item
# Retrieve all wishlist items
all_wish_list_items = customer_api.get_customer_wish_list(customer_oid).wishlist_items
# Update an item
second_created_wish_item.priority = 4
updated_second_wish_item = customer_api.update_wish_list_item(
customer_oid,
second_created_wish_item.customer_wishlist_item_oid,
second_created_wish_item
)
# Delete a wish list item
customer_api.delete_wish_list_item(
customer_oid,
first_created_wish_item.customer_wishlist_item_oid
)
# Clean up
delete_sample_customer(customer_oid)
delete_sample_item_by_oid(first_item_oid)
delete_sample_item_by_oid(second_item_oid)
rescue StandardError => e
# Handle any exceptions that occur during the process
puts 'An exception occurred. Please review the following error:'
p e
exit(1)
end
# Ensure a carriage return at the end of the file
import {customerApi} from '../api';
import {ItemFunctions} from '../item/ItemFunctions';
import {CustomerFunctions} from './CustomerFunctions';
import {
CustomerWishListItem,
CustomerWishListItemsResponse,
CustomerWishListItemResponse
} from 'ultracart_rest_api_v2_typescript';
/**
* The wishlist methods allow management of a customer's wishlist.
* This includes:
* DeleteWishListItem
* GetCustomerWishList
* GetCustomerWishListItem
* InsertWishListItem
* UpdateWishListItem
* These methods provide a standard CRUD interface.
*
* You'll need merchant_item_oids to insert wishlist items. If you don't know the oids,
* call ItemApi.GetItemByMerchantItemId() to retrieve the item, then get item.MerchantItemOid
*
* Note: Priority of wishlist item, 3 being low priority and 5 is high priority.
*/
export class UpdateWishListItem {
public static async execute(): Promise<void> {
try {
// create a few items first.
const firstItemOid = await ItemFunctions.insertSampleItemAndGetOid();
const secondItemOid = await ItemFunctions.insertSampleItemAndGetOid();
// create a customer
const customerOid = await CustomerFunctions.insertSampleCustomer();
// TODO: If you don't know the customer oid, use GetCustomerByEmail() to retrieve the customer.
// add some wish list items.
const firstWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: firstItemOid,
comments: "I really want this for my birthday",
priority: 3 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const firstCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: firstWishItem
});
const secondWishItem: CustomerWishListItem = {
customer_profile_oid: customerOid,
merchant_item_oid: secondItemOid,
comments: "Christmas Idea!",
priority: 5 // Priority of wishlist item, 3 being low priority and 5 is high priority.
};
const secondCreatedWishItem = await customerApi.insertWishListItem({
customerProfileOid: customerOid,
wishlistItem: secondWishItem
});
if (firstCreatedWishItem === undefined || firstCreatedWishItem.customer_profile_oid === undefined) {
console.error("first wish list item is undefined. update failed.");
return;
}
if (secondCreatedWishItem === undefined || secondCreatedWishItem.customer_profile_oid === undefined) {
console.error("second wish list item is undefined. update failed.");
return;
}
// retrieve one wishlist item again
const firstCreatedWishItemCopyResponse: CustomerWishListItemResponse =
await customerApi.getCustomerWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
const firstCreatedWishItemCopy = firstCreatedWishItemCopyResponse.wishlist_item;
// retrieve all wishlist items
const allWishListItems: CustomerWishListItemsResponse =
await customerApi.getCustomerWishList({customerProfileOid: customerOid});
// update an item.
const updatedSecondWishItem = await customerApi.updateWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: secondCreatedWishItem.customer_wishlist_item_oid as number,
wishlistItem: secondCreatedWishItem
});
// delete a wish list item
await customerApi.deleteWishListItem({
customerProfileOid: customerOid,
customerWishlistItemOid: firstCreatedWishItem.customer_wishlist_item_oid as number
});
// Clean up
await CustomerFunctions.deleteSampleCustomer(customerOid);
await ItemFunctions.deleteSampleItemByOid(firstItemOid);
await ItemFunctions.deleteSampleItemByOid(secondItemOid);
} catch (ex) {
console.error("An Exception occurred. Please review the following error:");
console.error(ex); // <-- change_me: handle gracefully
process.exit(1);
}
}
}
Retrieve values needed for a customer profile editor.
SDK Function Name: getCustomerEditorValues
// This is an internal method used by our Customer management screen. It returns back all the static data needed
// for our dropdown lists, such as lists of state and countries. You can call it if you like, but the data won't be
// of much use.
// This is an internal method used by our Customer management screen. It returns back all the static data needed
// for our dropdown lists, such as lists of state and countries. You can call it if you like, but the data won't be
// of much use.
// This is an internal method used by our Customer management screen. It returns back all the static data needed
// for our dropdown lists, such as lists of state and countries. You can call it if you like, but the data won't be
// of much use.
<?php
// This is an internal method used by our Customer management screen. It returns back all the static data needed
// for our dropdown lists, such as lists of state and countries. You can call it if you like, but the data won't be
// of much use.
# This is an internal method used by our Customer management screen. It returns back all the static data needed
# for our dropdown lists, such as lists of state and countries. You can call it if you like, but the data won't be
# of much use.
# This is an internal method used by our Customer management screen. It returns back all the static data needed
# for our dropdown lists, such as lists of state and countries. You can call it if you like, but the data won't be
# of much use.
// This is an internal method used by our Customer management screen. It returns back all the static data needed
// for our dropdown lists, such as lists of state and countries. You can call it if you like, but the data won't be
// of much use.
Retrieve all email lists across all storefronts
SDK Function Name: getCustomerEmailLists
// This is an internal method used by our Email workflow engines. It returns back all the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so the data returned may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
// This is an internal method used by our Email workflow engines. It returns back all the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so the data returned may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
// This is an internal method used by our Email workflow engines. It returns back all the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so the data returned may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
<?php
// This is an internal method used by our Email workflow engines. It returns back all the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so the data returned may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
# This is an internal method used by our Email workflow engines. It returns back all the email lists a customer
# is currently subscribed to. It's geared towards our UI needs, so the data returned may appear cryptic.
# We're not including a sample for it because we don't envision it being valuable to a merchant.
# This is an internal method used by our Email workflow engines. It returns back all the email lists a customer
# is currently subscribed to. It's geared towards our UI needs, so the data returned may appear cryptic.
# We're not including a sample for it because we don't envision it being valuable to a merchant.
// This is an internal method used by our Email workflow engines. It returns back all the email lists a customer
// is currently subscribed to. It's geared towards our UI needs, so the data returned may appear cryptic.
// We're not including a sample for it because we don't envision it being valuable to a merchant.
SDK Function Name: searchCustomerProfileValues
Parameter | Description | Location | Data Type | Required |
---|---|---|---|---|
lookup_request | LookupRequest | body | LookupRequest | required |
// This is an internal method used by our Customer management screen. It only searches customer tags and is geared
// towards our UI needs, so it's inflexible. We're not including a sample for it because we don't envision it
// being valuable to a merchant.
// getCustomersByQuery is the merchant's search method. It is completely full-featured and easy to use.
// This is an internal method used by our Customer management screen. It only searches customer tags and is geared
// towards our UI needs, so it's inflexible. We're not including a sample for it because we don't envision it
// being valuable to a merchant.
// getCustomersByQuery is the merchant's search method. It is completely full-featured and easy to use.
// This is an internal method used by our Customer management screen. It only searches customer tags and is geared
// towards our UI needs, so it's inflexible. We're not including a sample for it because we don't envision it
// being valuable to a merchant.
// getCustomersByQuery is the merchant's search method. It is completely full-featured and easy to use.
<?php
// This is an internal method used by our Customer management screen. It only searches customer tags and is geared
// towards our UI needs, so it's inflexible. We're not including a sample for it because we don't envision it
// being valuable to a merchant.
// getCustomersByQuery is the merchant's search method. It is completely full-featured and easy to use.
# This is an internal method used by our Customer management screen. It only searches customer tags and is geared
# towards our UI needs, so it's inflexible. We're not including a sample for it because we don't envision it
# being valuable to a merchant.
# getCustomersByQuery is the merchant's search method. It is completely full-featured and easy to use.
# This is an internal method used by our Customer management screen. It only searches customer tags and is geared
# towards our UI needs, so it's inflexible. We're not including a sample for it because we don't envision it
# being valuable to a merchant.
# getCustomersByQuery is the merchant's search method. It is completely full-featured and easy to use.
// This is an internal method used by our Customer management screen. It only searches customer tags and is geared
// towards our UI needs, so it's inflexible. We're not including a sample for it because we don't envision it
// being valuable to a merchant.
// getCustomersByQuery is the merchant's search method. It is completely full-featured and easy to use.
The following webhook events are generated for this resource.
Event | Description | Response | Expansion |
---|---|---|---|
customer_create | Trigger when a customer is created | Customer | Yes |
customer_delete | Trigger when a customer is deleted | Customer | Yes |
customer_update | Trigger when a customer is updated | Customer | Yes |
Name | Data Type | Description |
---|---|---|
action | string | |
channel | string | |
metric | string | |
storefront_oid | integer (int32) | |
subject | string | |
ts | integer (int64) | |
type | string | |
uuid | string |
Name | Data Type | Description |
---|---|---|
adjustment_amount | number | The adjustment amount |
description | string | Description of this adjustment, 50 characters max |
entry_dts | string (dateTime) | Optional timestamp for the adjustment, defaults to current time |
expiration_days | integer (int32) | Optional expiration days from the entry_dts when these adjustment becomes worthless |
order_id | string | Optional order id if this adjustment is related to a particular order |
vesting_days | integer (int32) | Optional days required for this adjustment to vest |
Name | Data Type | Description |
---|---|---|
adjustment_amount | number | The adjustment amount |
balance_amount | number | The balance amount after the adjustment was made |
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
arbitrary_item_id | string | Arbitrary item id that should be rebilled instead of the normal schedule |
arbitrary_percentage_discount | number | An arbitrary percentage discount to provide on future rebills |
arbitrary_quantity | number | Arbitrary quantity to rebill |
arbitrary_schedule_days | integer (int32) | The number of days to rebill if the frequency is set to an arbitrary number of days |
arbitrary_unit_cost | number | Arbitrary unit cost that rebills of this item should occur at |
arbitrary_unit_cost_remaining_orders | integer (int32) | The number of rebills to give the arbitrary unit cost on before reverting to normal pricing. |
auto_order_item_oid | integer (int32) | Primary key of AutoOrderItem |
calculated_next_shipment_dts | (read only) string (dateTime) | Calculated Date/time that this item is scheduled to rebill. Will be null if no more shipments are going to occur on this item |
first_order_dts | (read only) string (dateTime) | Date/time of the first order of this item. Null if item added to auto order and has not been rebilled yet. |
frequency | string | Frequency of the rebill if not a fixed schedule
Allowed Values
|
future_schedules | array of AutoOrderItemFutureSchedule | The future rebill schedule for this item up to the next ten rebills |
last_order_dts | string (dateTime) | Date/time of the last order of this item |
life_time_value | number | The life time value of this item including the original purchase |
next_item_id | (read only) string | Calculated next item id |
next_preshipment_notice_dts | string (dateTime) | The date/time of when the next pre-shipment notice should be sent |
next_shipment_dts | string (dateTime) | Date/time that this item is scheduled to rebill |
no_order_after_dts | string (dateTime) | Date/time after which no additional rebills of this item should occur |
number_of_rebills | integer (int32) | The number of times this item has rebilled |
options | array of AutoOrderItemOption | Options associated with this item |
original_item_id | string | The original item id purchased. This item controls scheduling. If you wish to modify a schedule, for example, from monthly to yearly, change this item from your monthly item to your yearly item, and then change the next_shipment_dts to your desired date. |
original_quantity | number | The original quantity purchased |
paused | boolean | True if paused. This field is an object instead of a primitive for backwards compatibility. |
paypal_payer_id | string | The PayPal Payer ID tied to this item |
paypal_recurring_payment_profile_id | string | The PayPal Profile ID tied to this item |
preshipment_notice_sent | boolean | True if the preshipment notice associated with the next rebill has been sent |
rebill_value | number | The value of the rebills of this item |
remaining_repeat_count | integer (int32) | The number of rebills remaining before this item is complete |
simple_schedule | AutoOrderItemSimpleSchedule | If the item is configured as an automatic rebill and only has a simple single step schedule then details are provided within this object |
Name | Data Type | Description |
---|---|---|
item_id | string | Item ID that should rebill |
rebill_count | integer (int32) | The number of times this rebill represents |
shipment_dts | string (dateTime) | Date/time that this item is scheduled to rebill |
unit_cost | number | The unit cost of the item rebilling |
Name | Data Type | Description |
---|---|---|
label | string(50) | Label |
value | string(1024) | Value |
Name | Data Type | Description |
---|---|---|
frequency | (read only) string | Frequency of the rebill if not a fixed schedule
Allowed Values
|
item_id | (read only) string | Item ID that should rebill |
repeat_count | integer (int32) | The number of times this simple schedule is configured for |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
device | BrowserDevice | |
os | BrowserOS | |
user_agent | BrowserUserAgent |
Name | Data Type | Description |
---|---|---|
family | string |
Name | Data Type | Description |
---|---|---|
family | string | |
major | string | |
minor | string | |
patch | string | |
patch_minor | string |
Name | Data Type | Description |
---|---|---|
family | string | |
major | string | |
minor | string | |
patch | string |
Name | Data Type | Description |
---|---|---|
channel_partner_oid | integer (int32) | Channel partner object id |
code | string | Code associated with the channel partner |
communication_method | string | Communication method of the channel partner |
dont_hold_shipment | boolean | True if shipments should immediately process for this channel partner. |
inactive | boolean | True if the channel partner is inactive |
merchant_id | string | Merchant ID of the channel partner |
name | string | Name of the channel partner |
skip_customer_emails | boolean | True if emails to the customer are skipped for this channel partner. |
Name | Data Type | Description |
---|---|---|
iso_2_code | string(2) | iso_2_code |
name | string(50) | name |
Name | Data Type | Description |
---|---|---|
currency_code | string | Currency code of the localized value |
exchange_rate | number | Exchange rate used to localize |
localized | number | Value localized to the customer |
localized_formatted | string | Value localized and formatted for the customer |
value | number | Value in base currency |
Name | Data Type | Description |
---|---|---|
activity | CustomerActivity | activity by this customer |
affiliate_oid | integer (int32) | Affiliate oid |
allow_3rd_party_billing | boolean | Allow 3rd party billing |
allow_cod | boolean | Allow COD |
allow_drop_shipping | boolean | Allow Drop Shipping |
allow_purchase_order | boolean | Allow purchase orders by this customer |
allow_quote_request | boolean | Allow quote request |
allow_selection_of_address_type | boolean | Allow selection of residential or business address type |
attachments | array of CustomerAttachment | Attachments |
auto_approve_cod | boolean | Auto approve COD |
auto_approve_purchase_order | boolean | Auto approve purchase orders by this customer |
automatic_merchant_notes | string | Automatic merchant notes are added to every order placed |
billing | array of CustomerBilling | Billing addresses for this customer |
business_notes | string(2000) | Business notes (internally visible only) |
cards | array of CustomerCard | Credit Cards for this customer |
cc_emails | array of CustomerEmail | Additional emails to CC notification |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
dhl_account_number | string(20) | DHL account number |
dhl_duty_account_number | string(20) | DHL duty account number |
do_not_send_mail | boolean | Do not send mail (null will not update) |
edi | CustomerEDI | EDI settings |
string | Email address of this customer profile | |
exempt_shipping_handling_charge | boolean | Exempt shipping handling charge |
fedex_account_number | string(20) | FedEx account number |
free_shipping | boolean | This customer always receives free shipping |
free_shipping_minimum | number | If free_shipping is true, this is the minimum subtotal required for free shipping |
last_modified_by | (read only) string(100) | Last modified by |
last_modified_dts | (read only) string (dateTime) | Last modified date |
loyalty | CustomerLoyalty | Loyalty |
maximum_item_count | integer (int32) | Maximum item count |
merchant_id | (read only) string | Merchant ID |
minimum_item_count | integer (int32) | Minimum item count |
minimum_subtotal | number | Minimum subtotal |
no_coupons | boolean | No coupons |
no_free_shipping | boolean | No free shipping regardless of coupons or item level settings |
no_realtime_charge | boolean | No realtime charge |
orders | array of Order | Orders associated with this customer profile |
orders_summary | CustomerOrdersSummary | Summary of orders placed by this customer profile |
password | string(30) | Password (may only be set, never read) |
pricing_tiers | array of CustomerPricingTier | Pricing tiers for this customer |
privacy | CustomerPrivacy | Privacy settings of the customer profile |
properties | array of CustomerProperty | Properties for this customer |
qb_class | string | QuickBooks class to import this customer as |
qb_code | string | QuickBooks name to import this customer as |
qb_tax_exemption_reason_code | integer (int32) | QuickBooks tax exemption reason code |
quotes | array of Order | Quotes associated with this customer profile |
quotes_summary | CustomerQuotesSummary | Summary of the quotes submitted by this customer profile |
referral_source | string(50) | Referral Source |
reviewer | CustomerReviewer | Item reviewer information |
sales_rep_code | string(10) | Sales rep code |
send_signup_notification | boolean | Send signup notification, if true during customer creation, will send a notification. |
shipping | array of CustomerShipping | Shipping addresses for this customer |
signup_dts | (read only) string | Signup date |
software_entitlements | array of CustomerSoftwareEntitlement | Software entitlements owned by this customer |
suppress_buysafe | boolean | Suppress buySAFE (deprecated) |
tags | array of CustomerTag | Tags for this customer |
tax_codes | CustomerTaxCodes | Tax codes used by tax integrations |
tax_exempt | boolean | True if the customer is tax exempt |
tax_id | string(15) | Tax ID |
terms | string | Terms for this customer |
track_separately | boolean | True if the customer should be tracked separately in QuickBooks |
unapproved | boolean | Unapproved |
ups_account_number | string(20) | UPS account number |
website_url | string(100) | Website url |
Name | Data Type | Description |
---|---|---|
activities | array of Activity | |
global_unsubscribed | boolean | |
global_unsubscribed_dts | string | |
memberships | array of ListSegmentMembership | |
metrics | array of Metric | |
properties_list | array of Property | |
spam_complaint | boolean | |
spam_complaint_dts | string |
Name | Data Type | Description |
---|---|---|
affiliate_oid | (read only) integer (int32) | Affiliate object identifier |
(read only) string | ||
first_name | (read only) string | First name |
last_name | (read only) string | Last name |
Name | Data Type | Description |
---|---|---|
customer_profile_attachment_oid | (read only) integer (int32) | Attachment identifier |
description | string | Description |
file_name | (read only) string | File name |
mime_type | (read only) string | Mime type |
upload_dts | (read only) string (dateTime) | Upload date/time |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
customer_billing_oid | (read only) integer (int32) | Customer profile billing object identifier |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
day_phone | string(25) | Day phone |
default_billing | boolean | Default billing |
evening_phone | string(25) | Evening phone |
first_name | string(30) | First name |
last_name | string(30) | Last name |
last_used_dts | string (dateTime) | Last used date |
postal_code | string(20) | Postal code |
state_region | string(32) | State for United States otherwise region or province for other countries |
tax_county | string(32) | Tax County |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
card_expiration_month | integer (int32) | Card expiration month (1-12) |
card_expiration_year | integer (int32) | Card expiration year (four digit year) |
card_number | string | Card number (masked to the last 4) |
card_number_token | string | Hosted field token for the card number |
card_type | string | Card type |
customer_profile_credit_card_id | integer (int32) | ID of the stored credit card to use |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
last_used_dts | string (dateTime) | Last used date |
Name | Data Type | Description |
---|---|---|
channel_partner_oid | integer (int32) | EDI channel partner this customer profile is associated with |
distribution_center_number | string | The EDI distribution center number associated with this customer profile. |
store_number | string | The EDI store number associated with this customer profile. |
Name | Data Type | Description |
---|---|---|
affiliates | (read only) array of CustomerAffiliate | affiliates |
card_exp_months | (read only) array of string | card_exp_months |
card_exp_years | (read only) array of string | card_exp_years |
card_types | (read only) array of string | card_types |
countries | (read only) array of Country | countries |
edi_channel_partners | (read only) array of ChannelPartner | EDI channel partners |
loyalty_ledger_descriptions | (read only) array of string | loyalty_ledger_descriptions |
loyalty_program_type | (read only) string | loyalty_program_type |
qb_classes | (read only) array of string | qb_classes |
sales_rep_codes | (read only) array of string | sales_rep_codes |
state_optional_countries | (read only) array of Country | state_optional_countries |
terms | (read only) array of string | terms |
Name | Data Type | Description |
---|---|---|
customer_profile_email_oid | integer (int32) | ID of the email |
string(100) | ||
label | string(100) | Label |
receipt_notification | boolean | CC this email on receipt notifications |
refund_notification | boolean | CC this email on refund notifications |
shipment_notification | boolean | CC this email on shipment notifications |
Name | Data Type | Description |
---|---|---|
add_to_lists | array of string | Add this customer to these email lists |
remove_from_lists | array of string | Remove this customer from these email lists |
Name | Data Type | Description |
---|---|---|
current_points | (read only) integer (int32) | Current points |
internal_gift_certificate | GiftCertificate | The internal gift certificate that is used to manage cashback points under the hood |
internal_gift_certificate_balance | (read only) string | Loyalty Cashback / Store credit balance (internal gift certificate balance) |
internal_gift_certificate_oid | (read only) integer (int32) | Internal gift certificate oid used to tracking loyalty cashback / store credit. |
ledger_entries | (read only) array of CustomerLoyaltyLedger | Ledger entries |
pending_points | (read only) integer (int32) | Pending Points |
redemptions | (read only) array of CustomerLoyaltyRedemption | Redemptions |
Name | Data Type | Description |
---|---|---|
created_by | (read only) string | Created By |
created_dts | (read only) string (dateTime) | Created date |
description | (read only) string | Description |
(read only) string | ||
item_id | (read only) string | Item Id |
item_index | (read only) integer (int32) | Item Index |
ledger_dts | (read only) string (dateTime) | Ledger date |
loyalty_campaign_oid | (read only) integer (int32) | Loyalty campaign oid |
loyalty_ledger_oid | (read only) integer (int32) | Loyalty ledger oid |
loyalty_points | (read only) integer (int32) | Loyalty points |
modified_by | (read only) string | Modified By |
modified_dts | (read only) string (dateTime) | Modified date |
order_id | (read only) string | Order Id |
quantity | (read only) integer (int32) | Quantity |
vesting_dts | (read only) string (dateTime) | Vesting date |
Name | Data Type | Description |
---|---|---|
coupon_code | (read only) string | Coupon code |
coupon_code_oid | (read only) integer (int32) | Coupon code OID |
coupon_used | (read only) boolean | Coupon used |
description_for_customer | (read only) string | Description for customer |
expiration_dts | (read only) string (dateTime) | Expiration date |
gift_certificate_code | (read only) string | Gift certificate code |
gift_certificate_oid | (read only) integer (int32) | Gift certificate oid |
loyalty_ledger_oid | (read only) integer (int32) | Loyalty ledger OID |
loyalty_points | (read only) integer (int32) | Loyalty points |
loyalty_redemption_oid | (read only) integer (int32) | Loyalty redemption OID |
order_id | (read only) string | Order id |
redemption_dts | (read only) string (dateTime) | Redemption date |
remaining_balance | (read only) number | Remaining balance |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
url | string | URL |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
customer_profile_oid | integer (int32) | Customer profile oid to merge |
string | Email of the customer profile to merge |
Name | Data Type | Description |
---|---|---|
first_order_dts | (read only) string (dateTime) | First order date |
last_order_dts | (read only) string (dateTime) | Last order date |
order_count | integer (int32) | Total number of orders |
total | number | Total amount associated with the orders |
Name | Data Type | Description |
---|---|---|
name | string(50) | Name |
pricing_tier_oid | integer (int32) | Pricing Tier Oid |
Name | Data Type | Description |
---|---|---|
last_update_dts | (read only) string (dateTime) | Last update date |
marketing | (read only) boolean | The customer has opted in to marketing |
preference | (read only) boolean | The customer has opted in to preference tracking |
statistics | (read only) boolean | The customer has opted in to statistics collection |
Name | Data Type | Description |
---|---|---|
customer_profile_property_oid | integer (int32) | Customer profile property oid |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(1500) | Value |
Name | Data Type | Description |
---|---|---|
all_tags | array of string | All tags the customer must have |
any_tags | array of string | Any of these tags the customer must have |
billing_city | string(32) | Billing city |
billing_company | string(50) | Billing company |
billing_country_code | string(2) | Billing country code |
billing_day_phone | string(25) | Billing day phone |
billing_evening_phone | string(25) | Billing evening phone |
billing_first_name | string(30) | Billing first name |
billing_last_name | string(30) | Billing last name |
billing_postal_code | string(20) | Billing postal code |
billing_state | string(32) | Billing state |
string | Email address of this customer profile | |
emails | array of string | Emails allows for searching on multiple email addresses and work with our without the single email variable. You may specify a single email address here or use the email property. |
last_modified_dts_end | string (dateTime) | Last modified date end |
last_modified_dts_start | string (dateTime) | Last modified date start |
pricing_tier_name | string(50) | Pricing tier name |
pricing_tier_oid | integer (int32) | Pricing tier oid |
qb_class | string | QuickBooks class to import this customer as |
quickbooks_code | string | QuickBooks name to import this customer as |
shipping_city | string(32) | Billing city |
shipping_company | string(50) | Billing company |
shipping_country_code | string(2) | Billing country code |
shipping_day_phone | string(25) | Billing day phone |
shipping_evening_phone | string(25) | Billing evening phone |
shipping_first_name | string(30) | Billing first name |
shipping_last_name | string(30) | Billing last name |
shipping_postal_code | string(20) | Billing postal code |
shipping_state | string(32) | Billing state |
signup_dts_end | string (dateTime) | Signup date end |
signup_dts_start | string (dateTime) | Signup date start |
Name | Data Type | Description |
---|---|---|
first_quote_dts | (read only) string (dateTime) | First quote date |
last_quote_dts | (read only) string (dateTime) | Last quote date |
quote_count | integer (int32) | Total number of quote |
total | number | Total amount associated with the quotes |
Name | Data Type | Description |
---|---|---|
customer | Customer | Customer |
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
auto_approve | boolean | True if reviewes from this customer profile should automatically be approved |
average_overall_rating | (read only) number | Average overall rating of items reviewed |
expert | boolean | True if the customer is an expert |
first_review | (read only) string (dateTime) | First review |
last_review | (read only) string (dateTime) | Last review |
location | string | Location of the reviewer |
nickname | string | Nickname of the reviewer |
number_helpful_review_votes | (read only) integer (int32) | Number of helpful review votes |
rank | (read only) integer (int32) | Rank of this reviewer |
reviews_contributed | (read only) integer (int32) | Number of reviews contributed |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
customer_shipping_oid | (read only) integer (int32) | Customer profile shipping object identifier |
day_phone | string(25) | Day phone |
default_shipping | boolean | Default shipping |
evening_phone | string(25) | Evening phone |
first_name | string(30) | First name |
last_name | string(30) | Last name |
last_used_dts | string (dateTime) | Last used date |
postal_code | string(20) | Postal code |
state_region | string(32) | State for United States otherwise region or province for other countries |
tax_county | string(32) | Tax County |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
activation_code | string(50) | Activation Code Associated with the software |
activation_dts | string (dateTime) | Date/time when the activation code was created |
customer_software_entitlement_oid | (read only) integer (int32) | Customer profile software entitlement object identifier |
expiration_dts | string (dateTime) | Date/time when the activation code will expire |
purchased_via_item_description | (read only) string(512) | Item description used to purchase this software. |
purchased_via_item_id | (read only) string(20) | Item ID used to purchase this software. |
purchased_via_order_id | (read only) string(30) | Order ID used to purchase this software. |
software_sku | string(30) | SKU of the software |
Name | Data Type | Description |
---|---|---|
customers | array of Customer | |
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
available | number | Available store credit which is defined as unused and vested |
expiring | number | Amount of store credit expiring within 30 days |
future_ledgers | array of CustomerStoreCreditLedgerEntry | Array of future ledger entries including expiring entries |
past_ledgers | array of CustomerStoreCreditLedgerEntry | Array of past ledger entries including accrual, usage, and expiring entries |
total | number | Total lifetime store credit for this customer. |
vesting | number | Amount of store credit vesting |
Name | Data Type | Description |
---|---|---|
amount | number | Amount of store credit |
description | string | Description or reason for the store credit |
expiration_days | integer (int32) | Optional days for store credit to expire or zero for no expiration |
vesting_days | integer (int32) | Optional days for store credit to vesting or zero for immediately available |
Name | Data Type | Description |
---|---|---|
action | string | Identifies the state of this ledger entry whether the entry is Vesting or Expiring |
amount | number | The amount of the activity. |
description | string(50) | Description of what this ledger entry is used. |
entry_dts | string | Date time of this ledger activity. |
gift_certificate_ledger_oid | integer (int32) | Gift certificate ledger oid is a primary key for this object, used internally. |
gift_certificate_oid | integer (int32) | Gift certificate oid. |
reference_order_id | string | The order id if this gift certificate was used as part of the payment. |
Name | Data Type | Description |
---|---|---|
customer_store_credit | CustomerStoreCredit | Customer store credit |
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
tag_value | string(250) | Tag Value |
Name | Data Type | Description |
---|---|---|
avalara_customer_code | string | Avalara customer code |
avalara_entity_use_code | string | Avalara entity use code |
sovos_customer_code | string | Sovos customer code |
taxjar_customer_id | string | TaxJar customer id |
taxjar_exemption_type | string | TaxJar exemption type |
Name | Data Type | Description |
---|---|---|
add_dts | string (dateTime) | Add date |
comments | string(1024) | Comments |
customer_profile_oid | (read only) integer (int32) | Customer profile object identifier |
customer_wishlist_item_oid | (read only) integer (int32) | Customer wishlist item object identifier |
merchant_item_oid | integer (int32) | Merchant item object identifier |
position | integer (int32) | Position in wishlist |
priority | integer (int32) | Priority of wishlist item, 3 being low priority and 5 is high priority. |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
wishlist_item | CustomerWishListItem |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
wishlist_items | array of CustomerWishListItem |
Name | Data Type | Description |
---|---|---|
data | array of Customer | |
draw | integer (int32) | |
recordsFiltered | integer (int32) | |
recordsTotal | integer (int32) |
Name | Data Type | Description |
---|---|---|
uom | string | Unit of measure
Allowed Values
|
value | number | The distance measured in UOM |
Name | Data Type | Description |
---|---|---|
allow_csv_download | boolean | True if the current user has the rights to download this list. |
created_dts | (read only) string (dateTime) | Created date |
deleted | boolean | True if this campaign was deleted |
email_list_uuid | (read only) string | Email list UUID |
esp_list_segment_folder_uuid | string | List/Segment folder UUID |
member_count | integer (int32) | Count of members in this list |
merchant_id | (read only) string | Merchant ID |
name | string(250) | Name of email list |
public_description | string | Description of list shown to customer. |
public_list | boolean | True if this list is public |
storefront_oid | (read only) integer (int32) | Storefront oid |
used_by | array of EmailListSegmentUsedBy | Details on the flows or campaigns that use this list. |
Name | Data Type | Description |
---|---|---|
email_campaign_uuid | (read only) string | Email campaign UUID |
email_flow_uuid | (read only) string | Email flow UUID |
name | string | Name of the list or segment. |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
lists | array of EmailList | |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
string | ||
password | string | password |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
token | string | token |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
token | string | token |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
developer_message | string | A technical message meant to be read by a developer |
error_code | string | HTTP status code |
more_info | string | Additional information often a link to additional documentation |
object_id | string | Object id that the error is associated with |
user_message | string | An end-user friendly message suitable for display to the customer |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
activated | boolean | True if this gift certificate is activated and ready to apply to purchases. |
code | (read only) string | The code used by the customer to purchase against this gift certificate. |
customer_profile_oid | (read only) integer (int32) | This is the customer profile oid associated with this internally managed gift certificate. |
deleted | boolean | True if this gift certificate was deleted. |
string(100) | Email of the customer associated with this gift certificate. | |
expiration_dts | string (dateTime) | Expiration date time. |
gift_certificate_oid | (read only) integer (int32) | Gift certificate oid. |
internal | (read only) boolean | This is an internally managed gift certificate associated with the loyalty cash rewards program. |
ledger_entries | (read only) array of GiftCertificateLedgerEntry | A list of all ledger activity for this gift certificate. |
merchant_id | string | Merchant Id |
merchant_note | string | A list of all ledger activity for this gift certificate. |
original_balance | (read only) number | Original balance of the gift certificate. |
reference_order_id | (read only) string | The order used to purchase this gift certificate. This value is ONLY set during checkout when a certificate is purchased, not when it is used. Any usage is recorded in the ledger |
remaining_balance | (read only) number | The remaining balance on the gift certificate. This is never set directly, but calculated from the ledger. To change the remaining balance, add a ledger entry. |
Name | Data Type | Description |
---|---|---|
amount | number | The amount of the activity. |
description | string(50) | Description of what this ledger entry is used. |
entry_dts | string (dateTime) | Date time of this ledger activity. |
gift_certificate_ledger_oid | integer (int32) | Gift certificate ledger oid is a primary key for this object, used internally. |
gift_certificate_oid | integer (int32) | Gift certificate oid. |
reference_order_id | string | The order id if this gift certificate was used as part of the payment. |
Name | Data Type | Description |
---|---|---|
description | (read only) string | Optional description of the lookup value |
key | (read only) string | The key or id of this lookup value |
value | (read only) string | The value of this lookup value |
Name | Data Type | Description |
---|---|---|
name | string | |
type | string | |
uuid | string |
Name | Data Type | Description |
---|---|---|
category | string | |
matches | string | |
max_hits | integer (int32) | |
storefront_host_name | string | |
storefront_oid | integer (int32) | |
subcategory | string |
Name | Data Type | Description |
---|---|---|
error | Error | Error object if unsuccessful |
metadata | ResponseMetadata | Meta-data about the response such as payload or paging information |
success | boolean | Indicates if API call was successful |
values | array of KeyValue | |
warning | Warning | Warning object if a non-fatal issue or side-effect occurs |
Name | Data Type | Description |
---|---|---|
all_time | number | |
all_time_formatted | string | |
last_30 | number | |
last_30_formatted | string | |
name | string | |
prior_30 | number | |
prior_30_formatted | string | |
type | string |
Name | Data Type | Description |
---|---|---|
affiliates | (read only) array of OrderAffiliate | Affiliates if any were associated with the order. The first one in the array sent the order and each subsequent affiliate is the recruiter that earns a downline commission. |
auto_order | (read only) OrderAutoOrder | Auto Order. If this is the original order then expansion can be done. If it is a rebill then the record is a small pointer to the auto order and original order records. |
billing | OrderBilling | Billing |
buysafe | OrderBuysafe | buySAFE bond |
channel_partner | (read only) OrderChannelPartner | Channel Partner if one is associated with the order |
checkout | OrderCheckout | Checkout |
coupons | array of OrderCoupon | Coupons |
creation_dts | (read only) string (dateTime) | Date/time that the order was created |
currency_code | string(3) | Currency code that the customer used if different than the merchant's base currency code
Allowed Values
|
current_stage | string | Current stage that the order is in.
Allowed Values
|
current_stage_histories | (read only) array of OrderCurrentStageHistory | History of the changes to the current_stage field |
customer_profile | (read only) Customer | Customer profile if one is associated with the order |
digital_order | OrderDigitalOrder | Digital order details |
edi | OrderEdi | EDI related information (only for orders received via EDI channel partner) |
exchange_rate | number | Exchange rate at the time the order was placed if currency code is different than the base currency |
fraud_score | (read only) OrderFraudScore | Fraud score if checked on the order |
gift | OrderGift | Gift giving information |
gift_certificate | (read only) OrderGiftCertificate | Gift certificate used on the order |
internal | OrderInternal | Internal |
items | array of OrderItem | Items |
language_iso_code | (read only) string(3) | Three letter ISO-639 language code used by the customer during the checkout if different than the default language |
linked_shipment | (read only) OrderLinkedShipment | Linked shipment information (CCBill orders only) |
marketing | OrderMarketing | Marketing |
merchant_id | (read only) string | UltraCart merchant ID owning this order |
order_id | (read only) string | Order ID |
payment | OrderPayment | Payment |
point_of_sale | (read only) OrderPointOfSale | If the order was a point of sale order, this this object contains the details of where the transaction took place. |
properties | array of OrderProperty | Properties, available only through update, not through insert due to the nature of how properties are handled internally |
quote | (read only) OrderQuote | Quote |
refund_dts | (read only) string (dateTime) | If the order was refunded, the date/time that the last refund occurred |
refund_reason | string | Refund reason code. This can only be written during a refund operation otherwise this field is read only. |
reject_dts | (read only) string (dateTime) | If the order was rejected, the date/time that the rejection occurred |
reject_reason | string | Reject reason code. This can only be written during a reject operation otherwise this field is read only. |
salesforce | (read only) OrderSalesforce | Salesforce.com identifiers |
shipping | OrderShipping | Shipping |
summary | OrderSummary | Summary |
Tags | array of OrderTag | tags, available only through update, not through insert due to the nature of how tags are handled internally |
taxes | OrderTaxes | Taxes |
utms | (read only) array of OrderUtm | UTM clicks. The zero index is the most recent (last) UTM click |
Name | Data Type | Description |
---|---|---|
affiliate_oid | integer (int32) | Affiliate ID |
ledger_entries | array of OrderAffiliateLedger | Ledger entries associated with all the commissions earned on this order |
sub_id | string | Sub identifier provided by the affiliate on the click that generated this order |
Name | Data Type | Description |
---|---|---|
assigned_by_user | string | UltraCart user name that assigned this commission if manually assigned |
item_id | string | Item ID that this ledger record is associated with |
tier_number | integer (int32) | Tier number of this affiliate in the commission calculation |
transaction_amount | number | Amount of the transaction |
transaction_amount_paid | number | The amount that has been paid so far on the transaction |
transaction_dts | string (dateTime) | The date/time that the affiliate ledger was generated for the transaction |
transaction_memo | string | Details of the transaction suitable for display to the affiliate |
transaction_percentage | number | The percentage earned on the transaction |
transaction_state | string | The state of the transaction
Allowed Values
|
Name | Data Type | Description |
---|---|---|
auto_order_code | (read only) string | Unique code assigned to this auto order |
auto_order_oid | (read only) integer (int32) | Auto order object identifier |
cancel_after_next_x_orders | integer (int32) | Cancel this auto order after X additional rebills |
cancel_downgrade | (read only) boolean | True if the auto order was canceled because the customer purchased a downgrade item |
cancel_reason | string | The reason this auto order was canceled by either merchant or customer |
cancel_upgrade | (read only) boolean | True if the auto order was canceled because the customer purchased an upgrade item |
canceled_by_user | string | The user that canceled the auto order |
canceled_dts | string (dateTime) | The date/time that the auto order was canceled |
completed | (read only) boolean | True if the auto order ran successfully to completion |
credit_card_attempt | integer (int32) | The number of credit card attempts that have taken place |
disabled_dts | (read only) string (dateTime) | The date/time the auto order was disabled due to failed rebills |
enabled | boolean | True if this auto order is enabled |
failure_reason | (read only) string | The reason this auto order failed during the last rebill attempt |
items | array of AutoOrderItem | The items that are setup to rebill |
next_attempt | string (dateTime) | The next time that the auto order will be attempted for processing |
original_order_id | (read only) string | The original order id that this auto order is associated with. |
override_affiliate_id | integer (int32) | Override the affiliate id given credit for rebills of this auto order |
rebill_orders | (read only) array of Order | Rebill orders that have taken place on this auto order |
rotating_transaction_gateway_code | string | The RTG code associated with this order for future rebills |
status | (read only) string | The status of the auto order
Allowed Values
|
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
cc_emails | array of string | CC emails. Multiple allowed, but total length of all emails can not exceed 100 characters. |
cell_phone | string(25) | Cell phone |
cell_phone_e164 | (read only) string(25) | Cell phone (E164 format) |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
day_phone | string(25) | Day time phone |
day_phone_e164 | (read only) string(25) | Day time phone (E164 format) |
string(100) | ||
evening_phone | string(25) | Evening phone |
evening_phone_e164 | (read only) string(25) | Evening phone (E164 format) |
first_name | string(30) | First name |
last_name | string(30) | Last name |
postal_code | string(20) | Postal code |
state_region | string(32) | State for United States otherwise region or province for other countries |
title | string(50) | Title |
Name | Data Type | Description |
---|---|---|
buysafe_bond_available | (read only) boolean | True if a buySAFE bond was available for purchase on this order |
buysafe_bond_cost | (read only) Currency | Cost of the buySAFE bond |
buysafe_bond_free | (read only) boolean | True if the buySAFE bond was free for this order |
buysafe_bond_refunded | (read only) Currency | Amount of the buySAFE bond that was refunded |
buysafe_bond_wanted | boolean | True if the buySAFE bond was wanted by the customer |
buysafe_shopping_cart_id | (read only) string | Shopping cart ID associated with the buySAFE bond |
Name | Data Type | Description |
---|---|---|
auto_approve_purchase_order | boolean | If true, any purchase order submitted is automatically approved |
channel_partner_code | string | The code of the channel partner |
channel_partner_data | string | Additional data provided by the channel partner, read-only |
channel_partner_oid | integer (int32) | Channel partner object identifier, read-only and available on existing channel orders only. |
channel_partner_order_id | string(50) | The order ID assigned by the channel partner for this order. |
ignore_invalid_shipping_method | boolean | Set to true to ignore invalid shipping method being specified. Only applicable on inserting orders. |
no_realtime_payment_processing | boolean | Indicates this order should be placed in Account Receivable for later payment processing |
skip_payment_processing | boolean | Indicates this order was already paid for via a channel purchase and no payment collection should be attempted |
store_completed | boolean | Instructs UltraCart to skip shipping department and mark this order as fully complete. This flag defaults to true. Set this flag to false to shipped product for this order. |
store_if_payment_declines | boolean | If true, any failed payment will place the order in Accounts Receivable rather than rejecting it. |
treat_warnings_as_errors | boolean | Any warnings are raised as errors and halt the import of the order |
Name | Data Type | Description |
---|---|---|
browser | (read only) Browser | Parsed user agent string into components |
comments | string | Comments from the customer. Rarely used on the single page checkout. |
custom_field1 | string(50) | Custom field 1 |
custom_field10 | string(200) | Custom field 10 |
custom_field2 | string(50) | Custom field 2 |
custom_field3 | string(50) | Custom field 3 |
custom_field4 | string(50) | Custom field 4 |
custom_field5 | string(75) | Custom field 5 |
custom_field6 | string(50) | Custom field 6 |
custom_field7 | string(50) | Custom field 7 |
custom_field8 | string(200) | Custom field 8 |
custom_field9 | string(200) | Custom field 9 |
customer_ip_address | (read only) string | IP address of the customer when placing the order |
screen_branding_theme_code | string(10) | Screen branding theme code associated with the order (legacy checkout) |
screen_size | (read only) string | Screen size small, medium or large |
storefront_host_name | string | StoreFront host name associated with the order |
upsell_path_code | (read only) string | Upsell path code assigned during the checkout that the customer went through |
Name | Data Type | Description |
---|---|---|
accounting_code | (read only) string | QuickBooks accounting code for this coupon |
automatically_applied | (read only) boolean | Whether or not the coupon was automatically applied to the order |
base_coupon_code | string(20) | Coupon code configured by the merchant. Will differ if the customer used a one time coupon code generated off this base coupon |
coupon_code | string(20) | Coupon code entered by the customer |
hdie_from_customer | (read only) boolean | True if this coupon is hide from the customer |
Name | Data Type | Description |
---|---|---|
after_stage | string | New stage that the order is in.
Allowed Values
|
before_stage | string | Previous stage that the order was in.
Allowed Values
|
transition_dts | (read only) string (dateTime) | Date/time that the stage transitioned |
Name | Data Type | Description |
---|---|---|
file_size | (read only) integer (int64) | File size |
last_download | (read only) string (dateTime) | Last download |
last_download_ip_address | (read only) string | IP address that performed the last download |
original_filename | (read only) string | Original file name |
product_code | (read only) string | Item id associated with this item |
product_description | (read only) string | Item description associated with this item |
remaining_downloads | integer (int32) | Remaining number of downloads |
url | (read only) string | URL that the customer can click to download the specific digital item |
Name | Data Type | Description |
---|---|---|
creation_dts | (read only) string (dateTime) | Date/time that the digital order was created |
expiration_dts | string (dateTime) | Expiration date/time of the digital order |
items | array of OrderDigitalItem | Digital items associated with the digital order |
url | (read only) string | URL where the customer can go to and download their digital order content |
url_id | (read only) string | URL ID is a unique code that is part of the URLs |
Name | Data Type | Description |
---|---|---|
bill_to_edi_code | string | Billing address identification code from the EDI order. Typically DUNS or DUNS+4 |
edi_department | string | Department number associated with this EDI order |
edi_internal_vendor_number | string(50) | Internal vendor number associated with this EDI order |
ship_to_edi_code | string | Shipping address identification code from the EDI order. Typically DUNS or DUNS+4 |
Name | Data Type | Description |
---|---|---|
anonymous_proxy | boolean | True if the IP address is a known anonymous proxy server |
bin_match | string | Whether the BIN (first six digits) matched the country
Allowed Values
|
carder_email | boolean | True if the email address belongs to a known credit card fraudster |
country_code | string | Country code |
country_match | boolean | Country code matches BIN country |
customer_phone_in_billing_location | string | Whether the customer's phone number is located in the area of the billing address |
distance_km | integer (int32) | Distance in kilometers between the IP address and the BIN |
free_email | boolean | True if the email address is for a free service like gmail.com |
high_risk_country | boolean | True if the customer is in a high risk country known for internet fraud |
ip_city | string | City associated with the IP address |
ip_isp | string | ISP that owns the IP address |
ip_latitude | string | Approximate latitude associated with the IP address |
ip_longitude | string | Approximate longitude associated with the IP address |
ip_org | string | Organization that owns the IP address |
ip_region | string | State/region associated with the IP address |
proxy_score | number | Likelihood of the IP address being a proxy server |
score | number | Overall score. This is the score that is compared to see if the order is rejected or held for review by the fraud filter rules. |
ship_forwarder | boolean | True if the address is a known ship forwarding company |
spam_score | number | Likelihood of the email address being associated with a spammer |
transparent_proxy | boolean | True if the IP address that placed the order is a transparent proxy server |
Name | Data Type | Description |
---|---|---|
gift | boolean | True if the order is a gift |
gift_charge | Currency | Charge associated with making this order a gift |
gift_charge_accounting_code | (read only) string | QuickBooks code for the gift charge |
gift_charge_refunded | Currency | Amount refunded of the gift charge (read only except refund operation) |
gift_email | string(100) | Email address of the gift recipient |
gift_message | string(10000) | Message to the gift recipient |
gift_wrap_accounting_code | (read only) string | QuickBooks code for the gift wrap charge |
gift_wrap_cost | Currency | Cost of the gift wrap the customer selected |
gift_wrap_refunded | Currency | Amount refunded of the gift wrap (read only except refund operation) |
gift_wrap_title | string(30) | Title of the gift wrap that the customer wants used |
Name | Data Type | Description |
---|---|---|
gift_certificate_amount | (read only) Currency | Gift certificate amount applied to the order |
gift_certificate_code | (read only) string | Gift certificate code used on the order |
gift_certificate_oid | (read only) integer (int32) | Gift certificate object identifier |
Name | Data Type | Description |
---|---|---|
exported_to_accounting | boolean | True if the order has been exported to QuickBooks. If QuickBooks is not configured, then this will already be true |
merchant_notes | string | Merchant notes. Full notes in non-transactional mode. Just used to write a new merchant note when transaction merchant notes enabled. |
placed_by_user | (read only) string | If placed via the BEOE, this is the user that placed the order |
refund_by_user | (read only) string | User that issued the refund |
sales_rep_code | string(10) | Sales rep code associated with the order |
transactional_merchant_notes | (read only) array of OrderTransactionalMerchantNote | Transactional merchant notes |
Name | Data Type | Description |
---|---|---|
accounting_code | (read only) string | QuickBooks code |
activation_codes | array of string | Activation codes assigned to this item |
actual_cogs | Currency | Actual COGS of the item used by the cost analysis report |
arbitrary_unit_cost | Currency | Arbitrary unit cost, used only during inserts for overriding the unit cost of an item |
auto_order_last_rebill_dts | string (dateTime) | Date/time of the last rebill, used only during order insert to help project future rebills |
auto_order_schedule | string | Auto order schedule, used only during inserts supplying the recurring schedule |
barcode | (read only) string | Barcode |
barcode_gtin12 | (read only) string(12) | Barcode - GTIN 12 |
barcode_gtin14 | (read only) string(14) | Barcode - GTIN 14 |
barcode_upc11 | (read only) string(11) | Barcode - UPC 11 |
barcode_upc12 | (read only) string(12) | Barcode - UPC 12 |
channel_partner_item_id | string(30) | Channel partner item id if this order came through a channel partner and the channel partner item id was mapped to an internal item id |
cogs | (read only) number | Cost of goods sold |
component_unit_value | (read only) number | Value of the kit component item |
cost | Currency | Cost |
country_code_of_origin | (read only) string(2) | Country of origin (ISO-3166 two letter code) |
customs_description | (read only) string | Customs description |
description | string(2000) | Description |
discount | (read only) Currency | Discount |
discount_quantity | (read only) number | Discount quantity |
discount_shipping_weight | (read only) Weight | Discount shipping weight |
distribution_center_code | string | Distribution center code responsible for shipping this item |
edi | OrderItemEdi | EDI related item information |
exclude_coupon | boolean | True if this item is excluded from coupons |
free_shipping | boolean | True if the item receives free shipping |
hazmat | boolean | Hazardous materials indicator |
height | Distance | Height |
item_index | integer (int32) | Index of the item on the order (one based index) |
item_reference_oid | (read only) integer (int32) | Item reference object identifier used to linked to auto order item record |
kit | boolean | True if this item is a kit |
kit_component | boolean | True if this item is a kit component |
length | Distance | Length |
manufacturer_sku | (read only) string | Manufacturer SKU |
max_days_time_in_transit | integer (int32) | Maximum days that the item can be in transit before spoilage (perishable products) |
merchant_item_id | string(20) | Item ID |
mix_and_match_group_name | string | Mix and match group name |
mix_and_match_group_oid | integer (int32) | Mix and match group object identifier |
no_shipping_discount | boolean | True if this item is excluded from shipping discounts |
options | array of OrderItemOption | Options |
packed_by_user | (read only) string | Packed by user |
parent_item_index | integer (int32) | If this item is a kit component, this is the item index of the parent item (kit) |
parent_merchant_item_id | string(20) | If this item is a kit component, this is the item id of the parent item (kit) |
perishable_class | string(50) | Perishable class of the item |
pricing_tier_name | string | Pricing tier that granted the particular price for this item if the customer profile had pricing tiers assigned |
properties | array of OrderItemProperty | Properties |
quantity | number | Quantity |
quantity_refunded | number | Quantity refunded on this item (read only except refund operation) |
quickbooks_class | string(31) | QuickBooks class |
refund_reason | string | Refund reason code. This can only be written during a refund operation otherwise this field is read only. |
return_reason | string | Return reason code. This can only be written during a refund operation otherwise this field is read only. |
ship_separately | boolean | True if this item ships in a separate box |
shipped_by_user | (read only) string | Shipped by user |
shipped_dts | string (dateTime) | Date/time that this item was marked shipped |
shipping_status | string | Shipping status for this item. This is the replacement for the old order level shipping status. |
special_product_type | string | Special product type (USPS Media Mail)
Allowed Values
|
tags | array of OrderItemTag | Tags |
tax_free | boolean | True if the item is tax free |
tax_product_type | string | Type of product for tax purposes (self or UltraCart Managed taxes)
Allowed Values
|
taxable_cost | Currency | The taxable cost of the item. Typically the same as the cost |
total_cost_with_discount | (read only) Currency | Total cost with discount |
total_refunded | Currency | Total refunded on this item (read only except refund operation) |
transmitted_to_distribution_center_dts | string (dateTime) | Date/time that this item was transmitted to the distribution center |
unit_cost_with_discount | (read only) Currency | Unit cost with discount |
upsell | boolean | True if this item was added to the order as part of an upsell |
weight | Weight | Weight |
width | Distance | Width |
Name | Data Type | Description |
---|---|---|
identifications | (read only) array of OrderItemEdiIdentification | Identification information receives on the EDI purchase order |
lots | (read only) array of OrderItemEdiLot | Lot information |
Name | Data Type | Description |
---|---|---|
identification | string | Identification value |
quantity | integer (int32) | Quantity associated with this identifier |
Name | Data Type | Description |
---|---|---|
lot_expiration | string (dateTime) | Log expiration |
lot_number | string | Lot number |
lot_quantity | integer (int32) | Lot quantity |
Name | Data Type | Description |
---|---|---|
additional_dimension_application | string | How the additional dimensions are applied to the item.
Allowed Values
|
cost_change | Currency | The amount that this option changes the cost |
file_attachment | (read only) OrderItemOptionFileAttachment | File attachment if option_type is file and attachment has not expired. |
height | Distance | If additional_dimension_application != none Height |
hidden | boolean | True if this option is hidden from display on the order |
label | string(50) | Label |
length | Distance | If additional_dimension_application != none Length |
one_time_fee | boolean | True if the cost associated with this option is a one time fee or multiplied by the quantity of the item |
value | string(1024) | Value |
weight_change | Weight | The amount that this option changes the weight |
width | Distance | If additional_dimension_application != none Width |
Name | Data Type | Description |
---|---|---|
expiration_dts | string (dateTime) | Expiration date/time |
file_name | string | File name |
mime_type | string | Mime type |
size | integer (int32) | Size |
Name | Data Type | Description |
---|---|---|
display | boolean | True if this property is displayed to the customer |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(3800) | Value |
Name | Data Type | Description |
---|---|---|
tag_value | string(100) | Tag Value |
Name | Data Type | Description |
---|---|---|
has_linked_shipment | boolean | True if this order has child linked shipments |
linked_shipment | boolean | True if this order is linked to another parent order |
linked_shipment_channel_partner_order_ids | array of string | If has_linked_shipment=true The child linked shipment channel partner order ids |
linked_shipment_order_ids | array of string | If has_linked_shipment=true The child linked shipment order ids |
linked_shipment_to_order_id | string | If linked_shipment=true The parent order id that this one is linked to |
Name | Data Type | Description |
---|---|---|
advertising_source | string(50) | Advertising source |
cell_phone_opt_in | boolean | True if the customer has opted into SMS marketing |
mailing_list | boolean | True if the customer has opted into mailing list subscription |
referral_code | string(30) | Referral code |
Name | Data Type | Description |
---|---|---|
check | OrderPaymentCheck | If payment_method=Check Check payment information |
credit_card | OrderPaymentCreditCard | If payment_method=Credit Card Credit card payment information |
echeck | OrderPaymentECheck | If payment_method=eCheck E-Check payment information |
health_benefit_card | OrderPaymentHealthBenefitCard | Health benefit card |
hold_for_fraud_review | (read only) boolean | True if order has been held for fraud review |
insurance | OrderPaymentInsurance | If payment_method=Insurance Insurance information |
payment_dts | string (dateTime) | Date/time that the payment was successfully processed, for new orders, this field is only considered if channel_partner.skip_payment_processing is true |
payment_method | string | Payment method
Allowed Values
|
payment_method_accounting_code | (read only) string | Payment method QuickBooks code |
payment_method_deposit_to_account | (read only) string | Payment method QuickBooks deposit account |
payment_status | (read only) string | Payment status
Allowed Values
|
paypal | (read only) OrderPaymentPayPal | PayPal details if the payment was vaulted. |
purchase_order | OrderPaymentPurchaseOrder | If payment_method=Purchase Order Purchase order information |
rotating_transaction_gateway_code | (read only) string | Rotating transaction gateway code used to process this order |
surcharge | (read only) Currency | Surcharge amount calculated from surcharge_transaction_fee and surcharge_transaction_percentage |
surcharge_accounting_code | (read only) string | Surcharge accounting code |
surcharge_transaction_fee | number | Surcharge transaction fee |
surcharge_transaction_percentage | number | Surcharge transaction percentage |
test_order | (read only) boolean | True if this is a test order |
transactions | (read only) array of OrderPaymentTransaction | Transactions associated with processing this payment |
Name | Data Type | Description |
---|---|---|
check_number | string | Check number |
Name | Data Type | Description |
---|---|---|
card_auth_ticket | (read only) string | Card authorization ticket |
card_authorization_amount | (read only) number | Card authorization amount |
card_authorization_dts | (read only) string (dateTime) | Card authorization date/time |
card_authorization_reference_number | (read only) string | Card authorization reference number |
card_expiration_month | integer (int32) | Card expiration month (1-12) |
card_expiration_year | integer (int32) | Card expiration year (Four digit year) |
card_number | (read only) string | Card number (masked to last 4) |
card_number_token | string | Card number token from hosted fields used to update the card number |
card_number_truncated | (read only) boolean | True if the card has been truncated |
card_type | string | Card type
Allowed Values
|
card_verification_number_token | string | Card verification number token from hosted fields, only for import/insert of new orders, completely ignored for updates, and always null/empty for queries |
dual_vaulted | (read only) OrderPaymentCreditCardDualVaulted | Details on the dual vaulted card that is also stored at the payment processor for future reuse |
Name | Data Type | Description |
---|---|---|
gateway_name | string | |
properties | array of OrderPaymentCreditCardDualVaultedProperty | |
rotating_transaction_gateway_code | string |
Name | Data Type | Description |
---|---|---|
name | string | |
value | string |
Name | Data Type | Description |
---|---|---|
bank_aba_code | string(9) | Bank routing code |
bank_account_name | string(50) | Bank account name |
bank_account_number | string(50) | Bank account number (masked to last 4) |
bank_account_type | string | Bank account type
Allowed Values
|
bank_name | string(50) | Bank name |
bank_owner_type | string | Bank owner type
Allowed Values
|
customer_tax_id | string(9) | Customer tax id (masked to last 4) |
drivers_license_dob | string(10) | Driver license date of birth |
drivers_license_number | string(50) | Driver license number (masked to last 4) |
drivers_license_state | string(2) | Driver license state |
Name | Data Type | Description |
---|---|---|
health_benefit_card_expiration_month | integer (int32) | Health benefit card expiration month (1-12) |
health_benefit_card_expiration_year | integer (int32) | Health benefit card expiration year (Four digit year) |
health_benefit_card_number | (read only) string | Health benefit card number (masked to last 4) |
health_benefit_card_number_token | string | Health benefit card number token from hosted fields used to update the health benefit card number |
health_benefit_card_number_truncated | (read only) boolean | True if the health benefit card has been truncated |
health_benefit_card_verification_number_token | string | Health benefit card verification number token from hosted fields, only for import/insert of new orders, completely ignored for updates, and always null/empty for queries |
Name | Data Type | Description |
---|---|---|
application_id | string | application id |
claim_id | string | claim id |
insurance_type | string | insurance type |
refund_claim_id | string | refund claim id |
Name | Data Type | Description |
---|---|---|
customer_id | (read only) string | PayPal Customer ID |
vault_id | (read only) string | PayPal Vault ID |
Name | Data Type | Description |
---|---|---|
purchase_order_number | string | Purchase order number |
Name | Data Type | Description |
---|---|---|
details | array of OrderPaymentTransactionDetail | Details |
successful | boolean | True if the transaction was successful |
transaction_gateway | string | Transaction gateway |
transaction_id | integer (int32) | Transaction ID |
transaction_timestamp | string (dateTime) | Transaction date/time |
Name | Data Type | Description |
---|---|---|
name | string | Name |
type | string | Type |
value | string | Value |
Name | Data Type | Description |
---|---|---|
location | (read only) PointOfSaleLocation | The location that the point of sale transaction took place at. |
reader | (read only) PointOfSaleReader | The card reader that the point of sale transaction took place at if a credit card was used. |
register | (read only) PointOfSaleRegister | The register that the point of sale transaction took place at. |
Name | Data Type | Description |
---|---|---|
created_by | string(20) | Created by user |
created_dts | string (dateTime) | The date/time that the property was created by the user |
display | boolean | True if this property is displayed to the customer |
expiration_dts | string (dateTime) | The date/time that the property expires and is deleted |
name | string(100) | Name |
value | string(1500) | Value |
Name | Data Type | Description |
---|---|---|
quote_expiration_dts | string (dateTime) | Expiration of quote at date/time |
quoted_by | string | Quoted by user |
quoted_dts | string (dateTime) | Quoted on date/time |
Name | Data Type | Description |
---|---|---|
salesforce_opportunity_id | string | Salesforce.com opportunity id |
Name | Data Type | Description |
---|---|---|
address1 | string(50) | Address line 1 |
address2 | string(50) | Address line 2 |
city | string(32) | City |
company | string(50) | Company |
country_code | string(2) | ISO-3166 two letter country code |
day_phone | string(25) | Day time phone |
day_phone_e164 | (read only) string(25) | Day time phone (E164 format) |
delivery_date | string (dateTime) | Date the customer is requesting delivery on. Typically used for perishable product delivery. |
evening_phone | string(25) | Evening phone |
evening_phone_e164 | (read only) string(25) | Evening phone (E164 format) |
first_name | string(30) | First name |
last_name | string(30) | Last name |
least_cost_route | boolean | If true, instructs UltraCart to apply the cheapest shipping method to this order. Used only for channel partner order inserts. |
least_cost_route_shipping_methods | array of string | List of shipping methods to consider if least_code_route is true. Used only for channel parter order inserts. |
lift_gate | boolean | Lift gate requested (LTL shipping methods only) |
pickup_dts | (read only) string (dateTime) | Date/time the order should be picked up locally. |
postal_code | string(20) | Postal code |
rma | string(30) | RMA number |
ship_on_date | string (dateTime) | Date the customer is requesting that the order ship on. Typically used for perishable product delivery. |
ship_to_residential | boolean | True if the shipping address is residential. Effects the methods that are available to the customer as well as the price of the shipping method. |
shipping_3rd_party_account_number | string(20) | Shipping 3rd party account number |
shipping_date | (read only) string (dateTime) | Date/time the order shipped on. This date is set once the first shipment is sent to the customer. |
shipping_department_status | string(30) | Shipping department status |
shipping_method | string | Shipping method |
shipping_method_accounting_code | (read only) string | Shipping method accounting code |
special_instructions | string | Special instructions from the customer regarding shipping |
state_region | string(32) | State |
title | string(50) | Title |
tracking_number_details | (read only) array of OrderTrackingNumberDetails | Tracking number details |
tracking_numbers | array of string | Tracking numbers |
weight | (read only) Weight | Total weight of the items on the order |
Name | Data Type | Description |
---|---|---|
actual_fulfillment | (read only) Currency | Actual amount of the fulfillment cost |
actual_other_cost | (read only) Currency | Actual other cost |
actual_payment_processing | (read only) Currency | Actual amount of the payment processing cost |
actual_profit | (read only) Currency | Actual profit |
actual_profit_analyzed | (read only) boolean | Actual profit has been analyzed |
actual_profit_review | (read only) boolean | Actual profit needs review |
actual_shipping | (read only) Currency | Actual amount of the shipping cost |
arbitrary_shipping_handling_total | Currency | Arbitrary shipping handling total, this is meaningless for updating an order. For inserting a new order, this will override any internal shipping and handling totals and should only be used for orders completed outside the system. This will probably only ever be needed when submitting arbitrary taxes AND shipping is taxed. |
health_benefit_card_amount | (read only) Currency | Health benefit card amount used |
health_benefit_card_refunded | (read only) Currency | Health benefit card refunded |
internal_gift_certificate_amount | (read only) Currency | Internal gift certificate amount used (store credit) |
internal_gift_certificate_refunded | (read only) Currency | Internal gift certificate refunded (store credit) |
other_refunded | (read only) Currency | Other refunded |
shipping_handling_refunded | Currency | Shipping/handling refunded (read only except refund operation) |
shipping_handling_total | Currency | Shipping/handling total |
shipping_handling_total_discount | (read only) Currency | Shipping/handling total discount |
subtotal | (read only) Currency | Subtotal |
subtotal_discount | (read only) Currency | Subtotal discount |
subtotal_discount_refunded | Currency | Subtotal discount refunded (read only except refund operation) |
subtotal_refunded | (read only) Currency | Subtotal refunded |
tax | Currency | Tax, may be updated to reflect any changes made to the tax fields, but cannot be used when inserting an order. For inserting, use the arbitrary fields instead. |
tax_refunded | Currency | Tax refunded (read only except refund operation) |
taxable_subtotal | (read only) Currency | Taxable subtotal |
taxable_subtotal_discount | (read only) Currency | Taxable subtotal discount |
total | (read only) Currency | Total |
total_refunded | (read only) Currency | Total refunded |
Name | Data Type | Description |
---|---|---|
tag_value | string(100) | Tag Value |
Name | Data Type | Description |
---|---|---|
arbitrary_tax | number | Arbitrary Tax, this is meaningless for updating an order. For inserting a new order, this will override any internal tax calculations and should only be used for orders completed outside the system. |
arbitrary_tax_rate | number | Arbitrary tax rate, this is meaningless for updating an order. For inserting a new order, this will override any internal tax calculations and should only be used for orders completed outside the system. |
arbitrary_taxable_subtotal | number | Arbitrary taxable subtotal, this is meaningless for updating an order. For inserting a new order, this will override any internal tax calculations and should only be used for orders completed outside the system. |
tax_city_accounting_code | (read only) string | QuickBooks tax city code |
tax_country_accounting_code | (read only) string | QuickBooks tax country code |
tax_county | string(32) | County used for tax calculation purposes (only in the United States) |
tax_county_accounting_code | (read only) string | QuickBooks tax county code |
tax_gift_charge | (read only) boolean | True if gift charge is taxed |
tax_postal_code_accounting_code | (read only) string | QuickBooks tax postal code code |
tax_rate | number | Tax rate, this is meaningless for updating an order. For inserting a new order, if you need to override internal tax calculations, use the arbitrary fields. |
tax_rate_city | (read only) number | Tax rate at the city level |
tax_rate_country | (read only) number | Tax rate at the country level |
tax_rate_county | (read only) number | Tax rate at the county level |
tax_rate_postal_code | (read only) number | Tax rate at the postal code level |
tax_rate_state | (read only) number | Tax rate at the state level |
tax_shipping | (read only) boolean | True if shipping is taxed |
tax_state_accounting_code | (read only) string | QuickBooks tax state code |
Name | Data Type | Description |
---|---|---|
city | string | |
event_dts | (read only) string (dateTime) | ISO 8601 timestamp that the event occurred |
event_local_date | string | |
event_local_time | string | |
event_timezone_id | (read only) string | Timezone the event occurred in. Use this in conjunction with event_dts to format a local date/time. |
state | string | |
subtag | string | |
subtag_message | string | |
tag | string | |
tag_description | string | |
tag_icon | string | |
zip | string |
Name | Data Type | Description |
---|---|---|
actual_delivery_date | string | |
actual_delivery_date_formatted | string | |
details | array of OrderTrackingNumberDetail | |
easypost_tracker_id | string | |
expected_delivery_date | string | |
expected_delivery_date_formatted | string | |
map_url | string | |
order_placed_date | string | |
order_placed_date_formatted | string | |
payment_processed_date | string | |
payment_processed_date_formatted | string | |
shipped_date | string | |
shipped_date_formatted | string | |
shipping_method | string | |
status | string | |
status_description | string | |
tracking_number | string | |
tracking_url | string |
Name | Data Type | Description |
---|---|---|
ip_address | string | IP Address |
note | string | note |
note_dts | (read only) string (dateTime) | Timestamp when the note was added |
user | string | User that wrote the merchant note |
Name | Data Type | Description |
---|---|---|
attribution_first_click_subtotal | number | |
attribution_first_click_total | number | |
attribution_last_click_subtotal | number | |
attribution_last_click_total | number | |
attribution_linear_subtotal | number | |
attribution_linear_total | number | |
attribution_position_based_subtotal | number | |
attribution_position_based_total | number | |
click_dts | (read only) string (dateTime) | Date/time that the click happened |
facebook_ad_id | string | |
fbclid | string | |
gbraid | string | |
glcid | string | |
itm_campaign | string | |
itm_content | string | |
itm_id | string | |
itm_medium | string | |
itm_source | string | |
itm_term | string | |
msclkid | string | |
short_code | string | |
short_code_backup | boolean | |
ttclid | string | |
uc_message_id | string | |
utm_campaign | string | |
utm_content | string | |
utm_id | string | |
utm_medium | string | |
utm_source | string | |
utm_term | string | |
vmcid | string | |
wbraid | string |
Name | Data Type | Description |
---|---|---|
adddress2 | string | Address line 2 |
address1 | string | Address line 1 |
city | string | City |
country | string | Country |
distribution_center_code | string | The distribution center code where inventory is reduced from for this sale. |
external_id | string(100) | External Id useful for syncing with a remote filesystem, this may be an MD5 hash or whatever suits your needs. |
merchant_id | string | Merchant ID that owns this location |
pos_location_oid | integer (int32) | Object identifier of the point of sale location. |
postal_code | string | Postal code |
state_province | string | State/province |
Name | Data Type | Description |
---|---|---|
device_type | string | The device type of the reader. |
label | string | The label of the reader. |
merchant_id | string | The merchant id that owns this point of sale reader. |
payment_provider | string | The payment provider for the card reader.
Allowed Values
|
pos_reader_id | integer (int32) | Object identifier of the point of sale reader. |
pos_register_oid | integer (int32) | Object identifier of the point of sale register this reader is assigned to. |
serial_number | string | The serial number of the reader. |
stripe_account_id | string | If the payment provider is Stripe, this is the Stripe account id |
stripe_reader_id | string | If the payment provide is Stripe, this is the Stripe terminal reader id |
Name | Data Type | Description |
---|---|---|
merchant_id | string | The merchant id that owns this point of sale register. |
name | string | Name of the register. |
pos_location_oid | integer (int32) | Object identifier of the point of sale location where this register is located. |
pos_register_oid | integer (int32) | Object identifier of the point of sale register. |
Name | Data Type | Description |
---|---|---|
name | string | |
value | string |
Name | Data Type | Description |
---|---|---|
payload_name | string | Payload name |
result_set | ResultSet | Result set |
Name | Data Type | Description |
---|---|---|
count | integer (int32) | Number of results in this set |
limit | integer (int32) | Maximum number of results that can be returned in a set |
more | boolean | True if there are more results to query |
next_offset | integer (int32) | The next offset that you should query to retrieve more results |
offset | integer (int32) | Offset of this result set (zero based) |
total_records | integer (int32) | The total number of records in the result set. May be null if the number is not known and the client should continue iterating as long as more is true. |
Name | Data Type | Description |
---|---|---|
more_info | string | Additional information often a link to additional documentation |
warning_message | string | A technical message meant to be read by a developer |
Name | Data Type | Description |
---|---|---|
uom | string | Unit of measure
Allowed Values
|
value | number | Weight |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |
Name | Data Type | Description |
---|---|---|
UC-REST-ERROR | string | Contains human readable error message |
Name | Data Type |
---|---|
body | ErrorResponse |