Company Administration Service
The Company Administration Service allows easy integration for creating, modifying, and retrieving of Companies, Locations and Groups, and their related Settings. Requests are made through POST
, PUT
, PATCH
, GET
or DELETE
requests.
Authentication for the CompanyAdministrationService
will be done with a Base64 encoded username:password, passed in through the BASIC HTTP Authorization Header.
Any endpoints under /companies
are accessible to get or modify even if the company is INACTIVE.
Any endpoints under /locations
or /groups
can only be retrieved, modified or created for an ACTIVE company.
General Service Notes
POST
|
Create a new entity. |
PUT
|
Update and overwrite an existing entity. |
PATCH
|
Update portions of an existing entity. In general, fields will be updated if supplied and contain a non-null value. If supplied value is empty "" , the field will be cleared. If supplied value is null , the field will not be changed.
|
GET
|
Retrieve a single entity or a list of entities. |
DELETE
|
Delete an existing entity. |
RESPONSE
|
In general, fields will only be returned if their value is not null or empty. |
Using this service, you can manage information about your company, such as a description for the company, your billing information and who gets emailed for invoices.
Company
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/companies
PUT
an updated Company
which will overwrite existing values
GET
a Company
. This endpoint will also create a new Setting
record if one does not exist
PATCH
an updated Company
which will overwrite existing values if not null
Request Examples
Response Example
Company Object:
{
"billToCompany": {
"companyId": "2222",
"companyName": "I Will Pick Up the Tab"
},
"billing": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"autoBilling": true,
"billingCard": {
"cardToken": "thisIsAToken1234",
"expirationMonth": 12,
"expirationYear": 24
},
"billingCheck": {
"bankAccountNumber": "123456789",
"bankRoutingNumber": "987654321"
},
"invoiceBreakdownLevel": "LOCATION",
"paymentMethod": "CARD",
"username": "user@test.com"
},
"billingEmails": {
"primaryList": [
"test@test.com",
"test3@test.com"
],
"secondaryList": [
"anotherTest@test.com"
]
},
"companyId": 1234,
"serviceList": [
{
"accountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"serviceAllowId": 2355,
"serviceName": "CARD",
"status": "INACTIVE",
"vendor": "USAEPAY"
},
{
"accountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"serviceAllowId": 1111,
"serviceName": "CHECK",
"status": "ACTIVE",
"vendor": "PAYLIANCE",
"vendorSettings": {
"clientId": "TESTCLIENT",
"isNachaVerifyEnabled": true
}
},
{
"accountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"serviceAllowId": 1234,
"serviceName": "CARD",
"status": "DEMO",
"vendor": "PDC4U"
}
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Click to view Full Company Object
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
companyId
Numeric
|
The id of the Company .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
billing
Object
|
The Billing data for this Company .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
|
The Settings for this Company .
NOTE: The following fields cannot be modified and are ignored if passed in: name, cardAccountDirectiveList,
achAccountDirectiveList.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
billingEmails
Object
|
The billingEmails for this Company . These emails will receive an invoice each month and
also notification when the payment on the invoice has failed or been completed successfully.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
serviceList
List
|
The services for this Company . This will include the data for each service that has been
configured for this company.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
billToCompany
ObjectN/A
Readonly
|
Which company this company is being billed to. If this is not null , then no billing will
be returned for this company .
|
--Company Retrieval
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/companies
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/companies
Sample Response:
{
"billToCompany": {
"companyId": "2222",
"companyName": "I Will Pick Up the Tab"
},
"billing": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"autoBilling": true,
"billingCard": {
"cardToken": "thisIsAToken1234",
"expirationMonth": 12,
"expirationYear": 24
},
"billingCheck": {
"bankAccountNumber": "123456789",
"bankRoutingNumber": "987654321"
},
"invoiceBreakdownLevel": "LOCATION",
"paymentMethod": "CARD",
"username": "user@test.com"
},
"billingEmails": {
"primaryList": [
"test@test.com",
"test3@test.com"
],
"secondaryList": [
"anotherTest@test.com"
]
},
"companyId": 1234,
"serviceList": [
{
"accountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"serviceAllowId": 2355,
"serviceName": "CARD",
"status": "INACTIVE",
"vendor": "USAEPAY"
},
{
"accountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"serviceAllowId": 1111,
"serviceName": "CHECK",
"status": "ACTIVE",
"vendor": "PAYLIANCE",
"vendorSettings": {
"clientId": "TESTCLIENT",
"isNachaVerifyEnabled": true
}
},
{
"accountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"serviceAllowId": 1234,
"serviceName": "CARD",
"status": "DEMO",
"vendor": "PDC4U"
}
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Retrieve details about your company. https://companyadministrationdemo.pdc4u.com/api/v1_0/companies
--Modify your Company
PATCH :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies
Sample Response:
{
"billing": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"autoBilling": true,
"billingCard": {
"cardToken": "thisIsAToken1234",
"expirationMonth": 12,
"expirationYear": 24
},
"billingCheck": {
"bankAccountNumber": "123456789",
"bankRoutingNumber": "987654321"
},
"invoiceBreakdownLevel": "LOCATION",
"paymentMethod": "CARD",
"username": "user@test.com"
},
"billingEmails": {
"primaryList": [
"test@test.com",
"test3@test.com"
],
"secondaryList": [
"anotherTest@test.com"
]
},
"companyId": 1234,
"serviceList": [
{
"accountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"serviceAllowId": 2355,
"serviceName": "CARD",
"status": "INACTIVE",
"vendor": "USAEPAY"
},
{
"accountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"serviceAllowId": 1111,
"serviceName": "CHECK",
"status": "ACTIVE",
"vendor": "PAYLIANCE",
"vendorSettings": {
"clientId": "TESTCLIENT",
"isNachaVerifyEnabled": true
}
},
{
"accountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"serviceAllowId": 1234,
"serviceName": "CARD",
"status": "DEMO",
"vendor": "PDC4U"
}
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
PATCH
requests will modify only the specified parts of your company. Below are the fields and options that can be modified. Required fields cannot be set to null. The vendorSettings
objects are required in full.
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
billing
Object
|
You can update your company's billing information.
Click to view the
|
Attribute | Description | ||||||||||||||||
autoBilling
Boolean5
Required
|
Boolean to specify if Auto Billing is enabled. | ||||||||||||||||
paymentMethod
Alpha5
Conditional
|
The Billing Payment Method. Valid Values: CARD , CHECK .Required if autoBilling is true .
|
||||||||||||||||
billingCard
Object
Conditional
|
The BillingCard data.
Required for CARD paymentMethod .
|
||||||||||||||||
billingCheck
Object
Conditional
|
The BillingCheck data.
Required for CHECK paymentMethod .
|
||||||||||||||||
address
Object
|
Billing address of the company. This is specifically for the billing method.
|
||||||||||||||||
username
Alphanumeric60
Required
|
The name of the User performing the request. NOTE: This field is not returned in the response. |
||||||||||||||||
invoiceBreakdownLevel
Alpha8
|
To what level the company invoice will be broken down at the end of the billing cycle.
For example, if set to LOCATION , the invoice will show billing broken down by how much each location processed.
An empty value will default to COMPANY .
Valid Values: COMPANY , GROUP , LOCATION . |
Settings
for this Company
.
NOTE: The following fields cannot be modified and are ignored if passed in: name, cardAccountDirectiveList, achAccountDirectiveList.
Click to see the Settings
object
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name
Alphanumeric100
Conditional
|
The name of the group or location for which these settings apply. Required for Group and Location .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
description
Alphanumeric150
|
A description of the company, group or location for which these settings apply. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
address
Object
|
Address for this location/group/company
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
receiptText
Alphanumeric5000
|
Text that will show on a receipt for transactions processed by this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scheduleText
Alphanumeric5000
|
Text that will show on a schedule for this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cardFeeAmount
Numeric7
|
Fee for a card transaction processed by this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
achFeeAmount
Numeric7
|
Fee for an ach transaction processed by this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hierarchyDisplaySetting
Enum
|
This defines whether the company, group or location name and address will display on schedules and transaction receipts. Valid Values: COMPANY , GROUP , LOCATION .There must be a group configured for the level to be GROUP .
There must be an active location configured for the level to be LOCATION .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cardAccountDirectiveList
ListN/A
|
List of Card AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
achAccountDirectiveList
ListN/A
|
List of ACH AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cashAccountDirectiveList
ListN/A
|
List of Cash AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customBranding
Object
Optional
|
Allows for customized branding options.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dateCreated
Date
Readonly
|
Date created.
Format: URL Encoded ISO-8601
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dateModified
Date
Readonly
|
Date modified.
Format: URL Encoded ISO-8601
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hierarchyDisplay
ObjectN/A
Readonly
|
Display information for the company, group, or location. This is based on the hierarchyDisplaySetting .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inheritedFromGroup
ListN/A
Readonly
|
List of Setting field names where the setting was inherited from its Group See the Effective Settings and Effective Settings Preview endpoint definition. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inheritedFromCompany
ListN/A
Readonly
|
List of Setting field names where the setting was inherited from the Company See the Effective Settings and Effective Settings Preview endpoint definition. |
services
for this Company
. This will include the data for each service that has been
configured for this company. The settings for these services for this company can be edited with a PATCH
.
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
serviceAllowId
Numeric10
Required
|
The id for this service . This id is required to update this service.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
serviceName
Alpha10
Readonly
|
The type of service. Potential values:
CASH , CHECK , CARD , IVR , RECURRING ,
GENERAL ,TOKENIZER ,SIGNATURE . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
status
Boolean9
|
The status of the service. Valid Values: - ACTIVE : The service is ready and available for production use.- DEMO : The service is can be used, but transactions will be sent through a sandbox system and will not be billed.- INACTIVE : The service cannot be used.- CONFIGURE : The service must be configured before use. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendor
Alpha12
ReadOnly
|
The name of the vendor for the service. Valid Values: - PDC4U : For services TOKENIZER, SIGNATURE, GENERAL, CASH, RECURRING.- TSS : For service CHECK.- USAePay : For service CARD.- Payrazr : For services CARD, CHECK.- Newtek : For service CARD.- PayNSeconds : For service CARD.- Voxeo : For service IVR.- Payliance : For service CHECK. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
accountDirectiveList
List
ReadOnly
|
A list of account directives for the service. These can be edited individually on the Company Account Directive endpoint.
ONLY ON CARD , CHECK and CASH services.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
signatureCompanyLogo
AlphaNumeric
|
A Base64 representation of the company logo that is shown in the Signature service.ONLY on the SIGNATURE service.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
signatureCompanyName
AlphaNumeric45
|
A custom name that is displayed on Flow requests. ONLY on SIGNATURE service.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
signatureMiniMiranda
AlphaNumeric1024
|
A mini miranda to be displayed on Flow requests. ONLY on SIGNATURE service.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
signatureFromEmailAddress
AlphaNumeric75
|
An email address that will be displayed as the From email address on Flow email requests. ONLY on SIGNATURE service.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
batchClosingHour
Numeric2
|
The closing hour for the ACH batch. Format: 24hr. ONLY on CHECK services.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
allowCredit
Boolean5
|
Whether ACH credits are allowed with this service/vendor. ONLY on CHECK services.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
exceptionReportIsEnabled
Boolean5
|
Whether ACH exception reports will be sent daily to the specified email. ONLY on CHECK services.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
exceptionReportLink
Alpha8
|
If the exception report is enabled, which PDC4U system will the exception reports link to. ONLY on CHECK services.Valid values: FlowUI , NoLink .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendorSettings
Object
|
Settings that are specific to this vendor for this service. Currently, ONLY on CHECK services and only with Payliance and TSS vendors.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
accountDirectiveList
List
|
Account directives specifically for this service. ONLY on CASH , CHECK and CARD services.
|
billingEmails
for this Company
. These emails will receive an invoice each month and also notification when the payment on the invoice has failed or been completed successfully.
Click here to see the BillingEmails
object
Attribute | Description |
primaryList
List
|
A list of email addresses for which billing invoices and bill processing details will be posted.
These email addresses, comma separated, cannot exceed 100 characters.
The total email addresses in this BillingEmails object cannot exceed a count of 10.
|
secondaryList
List
|
A list of email addresses for which billing invoices and bill processing details will be posted.
These email addresses, comma separated, cannot exceed 100 characters.
The total email addresses in this BillingEmails object cannot exceed a count of 10.
|
Group Object
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups
POST
to create a new Group
PUT
to update a Group
overwriting all existing values
GET
to get a Group
or list of Groups
DELETE
(deprecated) to delete deactivate a Group
record. A Group
can only be deactivated if there are no ACTIVE Locations
assigned to it.
Request Examples
Response Example
Group Object:
{
"activation": true,
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"locations": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Click to view Full Group Object
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
groupId
Numeric
|
The id of the Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customId
AlphaNumeric25
|
A custom, editable id for the group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locationIds
ListN/A
|
List of ids for associated Locations in the Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locationCount
Numeric
|
The number of associated Locations in the Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
|
The Settings for this Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locations
ListN/A
|
List of associated Locations
See the Location Object definition.
NOTE: This list is only returned when a single Group is requested.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
activation
Boolean5
|
Boolean stating if this Group is Active or Inactive.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--Group Creation
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups
Sample Response:
{
"activation": true,
"customId": "NewGroupCustom12345",
"groupId": 1111,
"locationIds": [
15,
3
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customId
AlphaNumeric25
|
A custom, editable id for the group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locationIds
ListN/A
|
List of ids for associated Locations in the Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
Required
|
The Settings for this Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locations
ListN/A
Readonly
|
List of associated Locations
NOTE: This is only returned when a single Group is requested.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
activation
Boolean5
|
Boolean stating if this Group is Active or Inactive.Default: TRUE
|
--Group Modification
PUT :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{groupId}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{groupId}
Sample Response:
{
"activation": false,
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationIds": [
15,
3
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
PUT
requests will completely override the existing specified (by groupId
in the URL) group. As such, the request object the same as the group creation.
Click to view the group object
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customId
AlphaNumeric25
|
A custom, editable id for the group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locationIds
ListN/A
|
List of ids for associated Locations in the Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
Required
|
The Settings for this Group .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locations
ListN/A
Readonly
|
List of associated Locations
NOTE: This is only returned when a single Group is requested.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
activation
Boolean5
|
Boolean stating if this Group is Active or Inactive.Default: TRUE
|
--Group Retrieval List
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups
Sample Response:
{
"groupList": [
{
"activation": true,
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "2233",
"groupId": 2323,
"locationCount": 1,
"locationIds": [
3333
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "1234-10",
"name": "PPD"
},
{
"accountDirective": "1234-11",
"name": "WEB"
},
{
"accountDirective": "1234-12",
"name": "TEL"
},
{
"accountDirective": "1234-5",
"name": "CCD"
}
],
"address": {
"city": "Here",
"country": "US",
"state": "UT",
"streetAddressOne": "1",
"zip": "88444"
},
"cardAccountDirectiveList": [
{
"accountDirective": "7777-3",
"allowedCardTypeList": [
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD",
"VISA"
],
"name": "Card present"
}
],
"dateCreated": "2020-10-15 19:53:11",
"dateModified": "2020-10-15 19:53:11",
"name": "Another Group Online"
}
}
]
}
Retrieve a list of all groups.
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
--Group Retrieval Individual
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{groupId}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{groupId}
Sample Response:
{
"activation": true,
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"locations": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Retrieve an individual group by groupId
.
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/1111
--Group Retrieval Search
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups
Sample Response:
{
"groupList": [
{
"activation": true,
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "2233",
"groupId": 2323,
"locationCount": 1,
"locationIds": [
3333
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "1234-10",
"name": "PPD"
},
{
"accountDirective": "1234-11",
"name": "WEB"
},
{
"accountDirective": "1234-12",
"name": "TEL"
},
{
"accountDirective": "1234-5",
"name": "CCD"
}
],
"address": {
"city": "Here",
"country": "US",
"state": "UT",
"streetAddressOne": "1",
"zip": "88444"
},
"cardAccountDirectiveList": [
{
"accountDirective": "7777-3",
"allowedCardTypeList": [
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD",
"VISA"
],
"name": "Card present"
}
],
"dateCreated": "2020-10-15 19:53:11",
"dateModified": "2020-10-15 19:53:11",
"name": "Another Group Online"
}
}
]
}
Attribute | Description |
groupName
Alphanumeric
|
Find Groups by their Name. This will search for any name that contains the search parameter.
|
groupNameOrCustomId
Alphanumeric
|
Find Groups by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
|
groupIdList
NumericListN/A
|
Retrieve all Groups with a groupId in this list.
|
activation
Boolean
|
Find Groups by their Activation status. If parameter is not provided, Groups that are both Active or Inactive will be returned.
|
customIdList
AlphaNumericListN/A
|
Retrieve all Groups with a customId in this list.
|
Retrieve a list of all groups that match search parameters.
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
--Group Deletion (Deprecated)
DELETE :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{groupId}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{groupId}
Delete an individual group by .groupId
This endpoint will only deactivate a Group
by the groupId
.
Location
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations
POST
a new Location
record
PUT
an updated Location
which will overwrite all existing values
GET
a Location
or list of Locations
PATCH
an updated Location
which will overwrite existing values if not null
A Location
cannot be deleted. Rather, it can be inactivated such that it cannot be used, but will still be available for reporting.
Request Examples
Response Example
Location Object:
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Click to view Full Location Object
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locationId
Numeric
|
The id of the Location .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customId
Alphanumeric25
|
A custom unique identifier for referencing this location .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
activation
Boolean5
|
Boolean stating if this Location is Active or Deactivated.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
groupData
Object
Readonly
|
Data pertaining to the Group this Location is a part of. If this location does not belong to a group, this field will not be present.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
|
The Settings for this Location .
|
--Location Creation
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations
Sample Response:
{
"activation": true,
"customId": "123456",
"groupId": 1111,
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customId
Alphanumeric25
|
A custom unique identifier for referencing this location .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
activation
Boolean5
|
Boolean stating if this Location is Active or Deactivated.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
groupId
Numeric
|
The ID of the Group this location is a part of.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
|
The Settings for this Location .
|
--Location Modification
PUT :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{locationId}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{locationId}
Sample Response:
{
"activation": true,
"customId": "123456",
"groupId": 1111,
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"description": "Our company is great",
"hierarchyDisplaySetting": "LOCATION",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
PUT
requests will completely override the existing specified (by locationId
in the URL) location. As such, the request object the same as the location creation.
Click to view example
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customId
Alphanumeric25
|
A custom unique identifier for referencing this location .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
activation
Boolean5
|
Boolean stating if this Location is Active or Deactivated.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
groupId
Numeric
|
The ID of the Group this location is a part of.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings
Object
|
The Settings for this Location .
|
--Location Retrieval List
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations
Sample Response:
{
"locationList": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "1568834598",
"locationId": 16,
"settings": {
"address": {
"city": "Sweet",
"country": "US",
"state": "IN",
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "1568834598",
"zip": "11225",
"zipPlusFour": "1234"
},
"dateCreated": "2019-08-29 07:19:10",
"dateModified": "2020-06-23 04:49:57",
"description": "the #1",
"name": "Second location",
"receiptText": "Receipt Text 1568834598",
"scheduleText": "Schedule Text 1568834598"
}
},
{
"activation": true,
"customId": "898465",
"locationId": 33,
"settings": {
"dateCreated": "2019-09-10 11:53:09",
"dateModified": "2020-04-15 09:29:32",
"name": "This location name"
}
}
]
}
Retrieve a list of all locations.
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
--Location Retrieval Individual
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{locationId}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{locationId}
Sample Response:
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
}
Retrieve an individual location by locationId
.
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/12
--Location Retrieval Search
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations
Sample Response:
{
"locationList": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "1568834598",
"locationId": 16,
"settings": {
"address": {
"city": "Sweet",
"country": "US",
"state": "IN",
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "1568834598",
"zip": "11225",
"zipPlusFour": "1234"
},
"dateCreated": "2019-08-29 07:19:10",
"dateModified": "2020-06-23 04:49:57",
"description": "the #1",
"name": "Second location",
"receiptText": "Receipt Text 1568834598",
"scheduleText": "Schedule Text 1568834598"
}
},
{
"activation": true,
"customId": "898465",
"locationId": 33,
"settings": {
"dateCreated": "2019-09-10 11:53:09",
"dateModified": "2020-04-15 09:29:32",
"name": "This location name"
}
}
]
}
Attribute | Description |
locationNameOrCustomId
Alphanumeric
|
Find Locations by their Name (partial match) or Custom ID (partial match). For example, if there is a Location named "My Cool Location", this Location could be found by passing in locationNameOrCustomId=cool .
|
activation
Boolean
|
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will be returned.
|
isAssignedToGroup
Boolean
|
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will be returned.
|
locationIdList
NumericListN/A
|
Retrieve all Locations with a locationId in this list.
|
Retrieve a list of all locations that match search parameters.
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
Effective Settings
These endpoints are to retrieve all the data to be used for request. This will combine all the data, inherited up to the COMPANY if it is empty or null in any of the children (Group
or Location
).
Objects retrieved from this endpoint will also include the inheritedFromGroup
and/or the inheritedFromCompany
variables that specify which values were inherited.
--Group Effective Settings List Search
Use this endpoint to retrieve a list of group
objects, with their effective settings and an inheritedFromCompany
field that defines which fields were inherited, filtered by GroupSearchParameters
.
POST
to retrieve a list of locations.
View GroupSearchParameters - Parameters to search groups by.
View Group object - A list of Group
objects will be the response.
POST :
Test endpoint: https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/effectivesettings/search
Live endpoint: https://companyadministration.pdc4u.com/api/v1_0/groups/effectivesettings/search
Sample Response:
{
"groupList": [
{
"activation": true,
"customId": "MyFacilityId4321",
"groupId": 1111,
"locationCount": 1,
"locationIds": [
12
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "2233",
"groupId": 2323,
"locationCount": 1,
"locationIds": [
3333
],
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "1234-10",
"name": "PPD"
},
{
"accountDirective": "1234-11",
"name": "WEB"
},
{
"accountDirective": "1234-12",
"name": "TEL"
},
{
"accountDirective": "1234-5",
"name": "CCD"
}
],
"address": {
"city": "Here",
"country": "US",
"state": "UT",
"streetAddressOne": "1",
"zip": "88444"
},
"cardAccountDirectiveList": [
{
"accountDirective": "7777-3",
"allowedCardTypeList": [
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD",
"VISA"
],
"name": "Card present"
}
],
"dateCreated": "2020-10-15 19:53:11",
"dateModified": "2020-10-15 19:53:11",
"name": "Another Group Online"
}
}
]
}
POST
to retrieve a list of groups, with their effective settings, based on the parameters.
Attribute | Description |
groupName
Alphanumeric
|
Find Groups by their Name. This will search for any name that contains the search parameter.
|
groupNameOrCustomId
Alphanumeric
|
Find Groups by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
|
groupIdList
NumericListN/A
|
Retrieve all Groups with a groupId in this list.
|
activation
Boolean
|
Find Groups by their Activation status. If parameter is not provided, Groups that are both Active or Inactive will be returned.
|
customIdList
AlphaNumericListN/A
|
Retrieve all Groups with a customId in this list.
|
--Location Effective Settings List Search
Use this endpoint to retrieve a list of location
objects, with their settings inherited from their group or company, filtered by LocationSearchParameters
.
POST
to retrieve a list of locations with their inherited settings.
View LocationSearchParameters - Parameters to search locations by.
View Location object - A list of Location
objects, with their inherited settings, will be the response.
POST :
Test endpoint: https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/effectivesettings/search
Live endpoint: https://companyadministration.pdc4u.com/api/v1_0/locations/effectivesettings/search
Sample Response:
{
"locationList": [
{
"activation": true,
"customId": "123456",
"groupData": {
"customId": "Group123",
"id": 123,
"name": "Best Group"
},
"locationId": 12,
"settings": {
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"achFeeAmount": "2.50",
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cardFeeAmount": "1.25",
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"customBranding": {
"brandColor": "#000000",
"emailBranding": {
"footerHtml": "<p>I am some HTML that goes in the footer</p>",
"footerText": "I am some text that goes in the footer",
"fromEmailAddress": "yourEmail@yourDomain.com",
"verifiedDomain": {
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
},
"isActive": "true",
"logoBase64": "SSBhbSBhbiBpbWFnZSB0aGF0IGhhcyBiZWVuIGVuY29kZWQgaW4gYmFzZTY0IHRoYXQgd2lsbCBiZSB1c2VkIGFzIGEgbG9nbw==",
"logoLink": "https://www.example.com/logo"
},
"dateCreated": "2020-06-01 12:00:15",
"dateModified": "2020-12-16 05:13:22",
"description": "Our company is great",
"hierarchyDisplay": {
"address": {
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
"name": "Inherited Name",
"phoneNumber": "1231230987"
},
"hierarchyDisplaySetting": "COMPANY",
"name": "Best Name",
"receiptText": "Thank you for doing what you did.",
"scheduleText": "Thank you for setting up payments with us."
}
},
{
"activation": true,
"customId": "1568834598",
"locationId": 16,
"settings": {
"address": {
"city": "Sweet",
"country": "US",
"state": "IN",
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "1568834598",
"zip": "11225",
"zipPlusFour": "1234"
},
"dateCreated": "2019-08-29 07:19:10",
"dateModified": "2020-06-23 04:49:57",
"description": "the #1",
"name": "Second location",
"receiptText": "Receipt Text 1568834598",
"scheduleText": "Schedule Text 1568834598"
}
},
{
"activation": true,
"customId": "898465",
"locationId": 33,
"settings": {
"dateCreated": "2019-09-10 11:53:09",
"dateModified": "2020-04-15 09:29:32",
"name": "This location name"
}
}
]
}
POST
to retrieve a list of locations, with their settings inherited from the group or company, based on the parameters.
Attribute | Description |
locationNameOrCustomId
Alphanumeric
|
Find Locations by their Name (partial match) or Custom ID (partial match). For example, if there is a Location named "My Cool Location", this Location could be found by passing in locationNameOrCustomId=cool .
|
activation
Boolean
|
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will be returned.
|
isAssignedToGroup
Boolean
|
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will be returned.
|
locationIdList
NumericListN/A
|
Retrieve all Locations with a locationId in this list.
|
--Location Effective Settings List Account Directives
Use this endpoint to retrieve a list of accountDirective
objects for a list of locationIds
. This will return all the distinct account directives for the locations. If multiple locations have access to the same account directive, that directive will only be represented once in the list.
POST
to retrieve a list of inherited account directives for the list of locations.
View AccountDirectiveList object - A list of distinct accountDirective
objects, will be the response.
POST :
Test endpoint: https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/locations/effectivesettings/accountdirectives
Live endpoint: https://companyadministration.pdc4u.com/api/v1_0/lists/locations/effectivesettings/accountdirectives
Sample Response:
{
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
],
"locationIdList": [
43,
45,
11297,
11298,
11299
]
}
POST
to retrieve a list of locations, with their settings inherited from the group or company, based on the parameters.
Attribute | Description |
locationNameOrCustomId
Alphanumeric
|
Find Locations by their Name (partial match) or Custom ID (partial match). For example, if there is a Location named "My Cool Location", this Location could be found by passing in locationNameOrCustomId=cool .
|
activation
Boolean
|
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will be returned.
|
isAssignedToGroup
Boolean
|
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will be returned.
|
locationIdList
NumericListN/A
|
Retrieve all Locations with a locationId in this list.
|
Account Directives
--Search Account Directives
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/lists/companies/accountdirectives
Sample Response:
{
"achAccountDirectiveList": [
{
"accountDirective": "2071-1217",
"entryCode": "WEB",
"isActive": true,
"name": "Test 1209",
"vendor": "PAYLIANCE",
"vendorSettings": {
"apiKey": "1231312",
"dateApiKeyExpiration": "2024-01-01"
}
},
{
"accountDirective": "2071-1",
"entryCode": "TEL",
"isActive": true,
"name": "TEL payments",
"vendor": "TSS",
"vendorSettings": {
"accountSet": "01"
}
}
],
"cardAccountDirectiveList": [
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
},
{
"accountDirective": "2019-2",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card not present",
"vendor": "PAYRAZR",
"vendorSettings": {
"password": "clever",
"username": "felix",
"zid": "13213123aaa"
},
"zeroCostFeePercent": "0.35"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2109-1",
"isActive": true,
"name": "Flush with Cash",
"vendor": "PDC4U"
}
]
}
POST
an AccountDirectiveSearchParameters
object to retrieve a list of account directives that match the search parameters. Providing no search parameters will return a list of ALL accountDirectives
for the company.
Attribute | Description |
accountDirectiveList
ListN/A
|
Find all account directives with the account directive in the list. |
serviceNameList
ListN/A
|
Find account directives that belong to services in the list. Valid values: CARD , CHECK , CASH
|
nameList
ListN/A
|
Find account directives that have a name that matches a value in the list. |
nameWildcard
Alphanumeric20
|
Find all account directives with names that contain the nameWildcard .
|
activation
Boolean5
|
Only return ACTIVE or INACTIVE account directives. Leave null to return all account directives. |
vendorNameList
ListN/A
|
Find all account directives matching vendors with names in list. |
--Edit Account Directive
PATCH :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/lists/companies/accountdirectives
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
PATCH
an AccountDirective
object to modify an existing account directive. The account directive being modified must be in the request body. With a PATCH request, only passed in fields will be updated. Fields set to empty strings
in the request will be set empty on the object.
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
accountDirective
Alphanumeric10
Readonly
|
The Account Directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name
Alphanumeric20
Readonly
|
The name of the Account Directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isActive
Boolean5
|
Only editable on company accountDirective endpoint Whether the account directive is active. Only active account directives can be used for processing. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximumAmountPerTransaction
Decimal11
|
The maximum amount allowed on transactions with this account directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendor
Alpha20
|
The vendor for this account directive. Valid Values: - PDC4U : For service CASH.- TSS : For service CHECK.- USAePay : For service CARD.- Payrazr : For services CARD, CHECK.- Newtek : For service CARD.- PayNSeconds : For service CARD.- Payliance : For service CHECK. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
entryCode
Alpha3
Conditional
|
ONLY ON Check Account Directives Only editable on company accountDirective endpoint. Cannot be set to null or empty. The entry code for the ach transaction to be processed with. Valid Values: TEL , WEB , PPD , CCD , ARC , RCK . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchantId
AlphaNumeric20
|
The merchant id for this account directive. ONLY ON Card Account Directives. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchantServiceProvider
AlphaNumeric10
|
The name of the merchant service provider that this account directive is tied to. ONLY ON Card Account Directives. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendorSettings
Object
|
Settings that are specific to this vendor for this account directive.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
allowedCardTypeList
List4
Conditional
|
ONLY ON Card Account Directives. Cannot be set to an empty list. A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD , VISA , DISCOVER , AMERICAN_EXPRESS . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
zeroCostFeePercent
Numeric6
|
Only editable on company accountDirective endpoint The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%). Format: #.#### |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
replacingAccountDirective
Alphanumeric10
|
An account directive to change pending payments to. When setting an accountDirective to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.Not returned in response. |
PUT :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/lists/companies/accountdirectives
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
PUT
an AccountDirective
object to modify an existing account directive. The account directive being modified must be in the request body. With a PUT request, the entire object will be overridden.
As such, all required fields must be passed in the request.
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
accountDirective
Alphanumeric10
Readonly
|
The Account Directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name
Alphanumeric20
Readonly
|
The name of the Account Directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isActive
Boolean5
|
Only editable on company accountDirective endpoint Whether the account directive is active. Only active account directives can be used for processing. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximumAmountPerTransaction
Decimal11
|
The maximum amount allowed on transactions with this account directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendor
Alpha20
|
The vendor for this account directive. Valid Values: - PDC4U : For service CASH.- TSS : For service CHECK.- USAePay : For service CARD.- Payrazr : For services CARD, CHECK.- Newtek : For service CARD.- PayNSeconds : For service CARD.- Payliance : For service CHECK. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
entryCode
Alpha3
Conditional
|
ONLY ON Check Account Directives Only editable on company accountDirective endpoint. Cannot be set to null or empty. The entry code for the ach transaction to be processed with. Valid Values: TEL , WEB , PPD , CCD , ARC , RCK . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchantId
AlphaNumeric20
|
The merchant id for this account directive. ONLY ON Card Account Directives. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchantServiceProvider
AlphaNumeric10
|
The name of the merchant service provider that this account directive is tied to. ONLY ON Card Account Directives. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendorSettings
Object
|
Settings that are specific to this vendor for this account directive.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
allowedCardTypeList
List4
Conditional
|
ONLY ON Card Account Directives. Cannot be set to an empty list. A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD , VISA , DISCOVER , AMERICAN_EXPRESS . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
zeroCostFeePercent
Numeric6
|
Only editable on company accountDirective endpoint The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%). Format: #.#### |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
replacingAccountDirective
Alphanumeric10
|
An account directive to change pending payments to. When setting an accountDirective to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.Not returned in response. |
--GET Company Account Directive
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/effectivesettings/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/companies/effectivesettings/accountdirectives/{accountDirective}
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
GET
the details of an AccountDirective
. The serviceName
and vendorName
parameters are both optional, but providing them in the URL will retrieve an account directive only if it exists for that service or vendor or both. This is useful for validating an account directive.
--GET Group Account Directive
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
GET
the details of an AccountDirective
. The serviceName
parameter in the URL is required and will retrieve an account directive only if it exists for that service. Valid values are CARD
, CHECK
, or CASH
.
This will get the account directive if it is explicitly set on the group, or if there are no directives set on the group and this account directive is inherited from the company.
--GET Location Account Directive
GET :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{locationId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{locationId}/effectivesettings/accountdirectives/{accountDirective}?serviceName={serviceName}
Sample Response:
{
"accountDirective": "2109-1",
"allowedCardTypeList": [
"VISA",
"AMERICAN_EXPRESS",
"DISCOVER",
"MASTERCARD"
],
"isActive": true,
"name": "Card present",
"vendor": "USAEPAY",
"vendorSettings": {
"pin": "1",
"sourceKey": "123123",
"zeroCostAllowBypass": false
},
"zeroCostFeePercent": "0.025"
}
GET
the details of an AccountDirective
. The serviceName
parameter in the URL is required and will retrieve an account directive only if it exists for that service. Valid values are CARD
, CHECK
, or CASH
.
This will get the account directive if it is explicitly set on the location, or if there are no directives set on the location and this account directive is inherited from the group or company.
Setting Data List
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/settings/datalists
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/settings/datalists
Use this endpoint to retrieve all the saved values for specified Setting
parameters. You will provide a list of Setting
parameters in the dataFieldList
and the API will return all saved values for that parameter across your company and all Groups
and Locations
.
Setting Datalist Object:
{
"achFeeAmountList": [
"2.99",
"10.00"
],
"addressList": [
{
"city": "New York",
"country": "US",
"state": "AK",
"streetAddressOne": "My street",
"streetAddressTwo": "address",
"zip": "12345",
"zipPlusFour": "1234"
},
{
"city": "Nashville",
"country": "US",
"state": "TN",
"streetAddressOne": "Down the Road",
"zip": "12222"
}
],
"cardFeeAmountList": [
"2.50",
"6.99",
"1.00"
],
"dataFieldList": [
"name",
"description",
"address",
"receiptText",
"scheduleText",
"cardFeeAmount",
"achFeeAmount",
"phoneNumber",
"emailAddress",
"fromEmailAddress"
],
"descriptionList": [
"Describe location"
],
"emailAddressList": [
"admin@test.com",
"group@test.com",
"location1@test.com"
],
"fromEmailAddressList": [
"no-reply@test.com"
],
"nameList": [
"Location One",
"My Company Name",
"My Group"
],
"phoneNumberList": [
"5558675309",
"5551112345"
],
"receiptTextList": [
"Thank you for making your payment",
"Thanks for the payment, fella"
],
"scheduleTextList": []
}
Click to view Full Setting Datalist Object
Attribute | Description | ||||||||||||||||
dataFieldList
List10
Required
|
A list of fields from the Setting Object that you wish to pull all values for.
|
||||||||||||||||
nameList
List
Readonly
|
A list of all the name values across all Locations, Groups, and your company.
|
||||||||||||||||
descriptionList
List
Readonly
|
A list of all the description values across all Locations, Groups, and your company.
|
||||||||||||||||
addressList
List
Readonly
|
A list of all the address values across all Locations, Groups, and your company.
|
||||||||||||||||
receiptTextList
List
Readonly
|
A list of all the receiptText values across all Locations, Groups, and your company.
|
||||||||||||||||
scheduleTextList
List
Readonly
|
A list of all the scheduleText values across all Locations, Groups, and your company.
|
||||||||||||||||
cardFeeAmountList
List
Readonly
|
A list of all the cardFeeAmount values across all Locations, Groups, and your company.
|
||||||||||||||||
achFeeAmountList
List
Readonly
|
A list of all the achFeeAmount values across all Locations, Groups, and your company.
|
||||||||||||||||
phoneNumberList
List
Readonly
|
A list of all the phoneNumber values across all Locations, Groups, and your company.
|
||||||||||||||||
emailAddressList
List
Readonly
|
A list of all the emailAddress values across all Locations, Groups, and your company.
|
||||||||||||||||
fromEmailAddressList
List
Readonly
|
A list of all the fromEmailAddress values across all Locations, Groups, and your company.
|
--Retrieve Data
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/settings/datalists
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/settings/datalists
POST
a SettingDataList
object to retrieve all the values saved on the Company
, Groups
and Locations
. This endpoint will return empty lists for data points that are requested but have no values saved.
Domain Verification
Before you are able to send emails from a custom email domain, you need to verify you have control of that domain. To do so, you can send a request to this endpoint with the domain you wish to verify. The api response will contain 3 cnameValues
that you will need to set in your DNS server. Once those values are set, our email server will automatically verify those values. Once a domain is verified, any email address with the same domain will be usable as a fromEmailAddress
.
{
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
Click to view Full Email Domain Verification Object
Attribute | Description | ||||||
id
Numeric10
Readonly
|
The id of the domain. | ||||||
domain
Alphanumeric253
Required
|
The domain to be validated. Example: pdcflow.com
Format: {domain}.{topLevelDomain}
|
||||||
verificationStatus
Alpha7
|
The status of verification for the specified domain .
Possible values:
|
||||||
cnameList
List
Readonly
|
List of cname objects containing expected files to be available on your server to complete validation
|
||||||
insertDate
Datetime19
Readonly
|
Date the domain was first saved.
Format: ISO-8601
|
||||||
lastUpdateDate
Datetime19
Readonly
|
Date the domain was last changed/updated.
Format: ISO-8601
|
--Initiate Verification
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/domains
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/domains
Sample Response:
{
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
POST
a VerifiedDomain
object with a domain to initiate the verification process for that domain.
Attribute | Description |
domain
Alphanumeric253
Required
|
The domain to be validated. Example: pdcflow.com
Format: {domain}.{topLevelDomain}
|
--Search Domains
POST :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/search
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/domains/search
Sample Response:
{
"locationList": [
{
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
]
}
POST
a VerifiedDomainSearchParameters
object to search for a list of VerifiedDomain
objects.
Click to view full VerifiedDomainSearchParameters
Attribute | Description |
idList
List
|
A list of ids to search for. |
domainList
List
|
A list of domains to search for.
Domain Format: {domain}.{topLevelDomain}
|
insertDateStart
Date10
|
Search for domains initially inserted on or after this date.
Format: ISO-8601
|
insertDateEnd
Date10
|
Search for domains initially inserted before this date.
Format: ISO-8601
|
lastUpdateDateStart
Date10
|
Search for domains last updated on or after this date.
Format: ISO-8601
|
lastUpdateDateEnd
Date10
|
Search for domains last updated before this date.
Format: ISO-8601
|
statusList
List
|
List of verification statuses to search for.
Possible values:
|
--Delete Domain
DELETE :
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/{domainId}
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/domains/{domainId}
Sample Response:
{
"cnameList": [
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
},
{
"name": "someValue._domainkey.testing.com",
"value": "someValue.dkim.amazonses.com"
}
],
"domain": "testing.com",
"id": 77,
"insertDate": "2024-03-08 15:10:58",
"lastUpdateDate": "2024-03-08 15:10:58",
"verificationStatus": "PENDING"
}
DELETE
a VerifiedDomain
. This will invalidate the domain and thus emails will NOT be able to be sent from that domain. You will not be allowed to delete a domain that is currently configured as a fromEmailAddress
on a Company, Group or Location.
Feature
A Feature
allows you to manage what your PDCflow account can do.
Click to view full Feature object
Attribute | Description |
name
Alpha
Required
|
The name of the feature to edit Valid names:
|
isActive
Boolean5
|
A flag to turn the associated feature on/off |
user
Alphanumeric60
Required
|
The user editing the feature |
--Feature Modification
PATCH
a Feature
object to modify the setting(s) for the specified feature name.
PATCH :
https://companyadministrationdemo.pdc4u.com/api/v2_0/services/features
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/services/features
Sample Response:
{
"isActive": true,
"name": "CUSTOM_BRANDING"
}
Reference Objects
These objects are used as part of the objects defined above. These are included here for reference.
--Setting
Each Setting
field applies to a Company
or Location
or Group
.
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name
Alphanumeric100
Conditional
|
The name of the group or location for which these settings apply. Required for Group and Location .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
description
Alphanumeric150
|
A description of the company, group or location for which these settings apply. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
address
Object
|
Address for this location/group/company
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
receiptText
Alphanumeric5000
|
Text that will show on a receipt for transactions processed by this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scheduleText
Alphanumeric5000
|
Text that will show on a schedule for this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cardFeeAmount
Numeric7
|
Fee for a card transaction processed by this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
achFeeAmount
Numeric7
|
Fee for an ach transaction processed by this location/group/company. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hierarchyDisplaySetting
Enum
|
This defines whether the company, group or location name and address will display on schedules and transaction receipts. Valid Values: COMPANY , GROUP , LOCATION .There must be a group configured for the level to be GROUP .
There must be an active location configured for the level to be LOCATION .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cardAccountDirectiveList
ListN/A
|
List of Card AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
achAccountDirectiveList
ListN/A
|
List of ACH AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cashAccountDirectiveList
ListN/A
|
List of Cash AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customBranding
Object
Optional
|
Allows for customized branding options.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dateCreated
Date
Readonly
|
Date created.
Format: URL Encoded ISO-8601
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dateModified
Date
Readonly
|
Date modified.
Format: URL Encoded ISO-8601
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hierarchyDisplay
ObjectN/A
Readonly
|
Display information for the company, group, or location. This is based on the hierarchyDisplaySetting .
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inheritedFromGroup
ListN/A
Readonly
|
List of Setting field names where the setting was inherited from its Group See the Effective Settings and Effective Settings Preview endpoint definition. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inheritedFromCompany
ListN/A
Readonly
|
List of Setting field names where the setting was inherited from the Company See the Effective Settings and Effective Settings Preview endpoint definition. |
--Hierarchy Display
Attribute | Description | ||||||||||||||||
name
Alphanumeric100
|
The name of the location, group, or company. | ||||||||||||||||
address
Object
|
Address of the location/group/company. Depending on what hierarchy level this is from, parts of this object may be null. A Company will always have all parts (with the exception of streetAddressTwo ). A Group or Location may have only individual parts.
|
--Address
Attribute | Description |
streetAddressOne
Alphanumeric60
Conditional
|
Street Address One. Required for Company .
|
streetAddressTwo
Alphanumeric30
|
Street Address Two. |
city
Alphanumeric45
Conditional
|
City. Required for Company .
|
state
Alphanumeric2
Conditional
|
State. Required for Company .
|
zip
NumericString5
Conditional
|
Zip Code. Required for Company .
|
zipPlusFour
NumericString4
|
Four digit Zip Code extension. |
country
Alphanumeric2
Conditional
|
Country. Required for Company .
|
--Group Search Parameters
POST
these parameters to the Group
retrieval endpoint to filter the search.
Attribute | Description |
groupName
Alphanumeric
|
Find Groups by their Name. This will search for any name that contains the search parameter.
|
groupNameOrCustomId
Alphanumeric
|
Find Groups by their Name or Custom ID (partial match). This will search for any name or customId that contains the search parameter.
|
groupIdList
NumericListN/A
|
Retrieve all Groups with a groupId in this list.
|
activation
Boolean
|
Find Groups by their Activation status. If parameter is not provided, Groups that are both Active or Inactive will be returned.
|
customIdList
AlphaNumericListN/A
|
Retrieve all Groups with a customId in this list.
|
--Location Search Parameters
POST
these parameters to the Location
retrieval endpoint to filter the search.
Attribute | Description |
locationNameOrCustomId
Alphanumeric
|
Find Locations by their Name (partial match) or Custom ID (partial match). For example, if there is a Location named "My Cool Location", this Location could be found by passing in locationNameOrCustomId=cool .
|
activation
Boolean
|
Find Locations by their Activation status. If parameter is not provided, Locations that are both Active or Inactive will be returned.
|
isAssignedToGroup
Boolean
|
Find Locations by their Group association status. If parameter is not provided, Locations with or without a Group will be returned.
|
locationIdList
NumericListN/A
|
Retrieve all Locations with a locationId in this list.
|
--Account Directive List
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
locationIdList
ListN/A
|
The list of location ids that were used to retrieve the account directives for. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cardAccountDirectiveList
ListN/A
|
List of Card AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
achAccountDirectiveList
ListN/A
|
List of ACH AccountDirective
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cashAccountDirectiveList
ListN/A
|
List of Cash AccountDirective
|
--Account Directive
Attribute | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
accountDirective
Alphanumeric10
Readonly
|
The Account Directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name
Alphanumeric20
Readonly
|
The name of the Account Directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isActive
Boolean5
|
Only editable on company accountDirective endpoint Whether the account directive is active. Only active account directives can be used for processing. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximumAmountPerTransaction
Decimal11
|
The maximum amount allowed on transactions with this account directive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendor
Alpha20
|
The vendor for this account directive. Valid Values: - PDC4U : For service CASH.- TSS : For service CHECK.- USAePay : For service CARD.- Payrazr : For services CARD, CHECK.- Newtek : For service CARD.- PayNSeconds : For service CARD.- Payliance : For service CHECK. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
entryCode
Alpha3
Conditional
|
ONLY ON Check Account Directives Only editable on company accountDirective endpoint. Cannot be set to null or empty. The entry code for the ach transaction to be processed with. Valid Values: TEL , WEB , PPD , CCD , ARC , RCK . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchantId
AlphaNumeric20
|
The merchant id for this account directive. ONLY ON Card Account Directives. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchantServiceProvider
AlphaNumeric10
|
The name of the merchant service provider that this account directive is tied to. ONLY ON Card Account Directives. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vendorSettings
Object
|
Settings that are specific to this vendor for this account directive.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
allowedCardTypeList
List4
Conditional
|
ONLY ON Card Account Directives. Cannot be set to an empty list. A list of card types that are allowed to be processed with this account directive and its associated merchant account. Valid Values: MASTERCARD , VISA , DISCOVER , AMERICAN_EXPRESS . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
zeroCostFeePercent
Numeric6
|
Only editable on company accountDirective endpoint The percent fee charged by the merchant on zero cost transactions. This is expected in decimal basis point format (ex. use 0.04 to represent 4%). Format: #.#### |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
replacingAccountDirective
Alphanumeric10
|
An account directive to change pending payments to. When setting an accountDirective to INACTIVE,
provide this parameter and all pending payments will be updated to this new account directive.Not returned in response. |
--Billing
Attribute | Description | ||||||||||||||||
autoBilling
Boolean5
Required
|
Boolean to specify if Auto Billing is enabled. | ||||||||||||||||
paymentMethod
Alpha5
Conditional
|
The Billing Payment Method. Valid Values: CARD , CHECK .Required if autoBilling is true .
|
||||||||||||||||
billingCard
Object
Conditional
|
The BillingCard data.
Required for CARD paymentMethod .
|
||||||||||||||||
billingCheck
Object
Conditional
|
The BillingCheck data.
Required for CHECK paymentMethod .
|
||||||||||||||||
address
Object
|
Billing address of the company. This is specifically for the billing method.
|
||||||||||||||||
username
Alphanumeric60
Required
|
The name of the User performing the request. NOTE: This field is not returned in the response. |
||||||||||||||||
invoiceBreakdownLevel
Alpha8
|
To what level the company invoice will be broken down at the end of the billing cycle.
For example, if set to LOCATION , the invoice will show billing broken down by how much each location processed.
An empty value will default to COMPANY .
Valid Values: COMPANY , GROUP , LOCATION . |
--BillingCard
Attribute | Description |
cardToken
Alphanumeric16
Required
|
The billing card token that represents the credit card to be used for processing. |
expirationMonth
Numeric2
Required
|
The expiration month of the credit card. |
expirationYear
Numeric4
Required
|
The expiration year of the credit card. |
--BillingCheck
Attribute | Description |
bankAccountNumber
Alphanumeric20
Required
|
The Bank Account Number to be used for processing. |
bankRoutingNumber
Numeric9
Required
|
The Routing Number for the Bank. |
--BillingEmails
Attribute | Description |
primaryList
List
|
A list of email addresses for which billing invoices and bill processing details will be posted.
These email addresses, comma separated, cannot exceed 100 characters.
The total email addresses in this BillingEmails object cannot exceed a count of 10.
|
secondaryList
List
|
A list of email addresses for which billing invoices and bill processing details will be posted.
These email addresses, comma separated, cannot exceed 100 characters.
The total email addresses in this BillingEmails object cannot exceed a count of 10.
|
Sample Code
This section offers some client implementation examples. Keep in mind, these are only minimalistic examples used to demonstrate the Service REST API and are not meant for production use.
-- Result Status Codes
Expected Http Status codes
Status '200':
Description = 'Success.'
Status: '400':
Description = 'Malformed request. The request is either incorrectly formatted, or there are validation errors.'
Status '401':
Description = 'Invalid credentials.'
Status '403':
Description = 'Service not activated.'
Status '404':
Description = 'The requested resource was not found.'
Status '405':
Description = 'POST, GET, PUT request not supported for resource.'
Status '500':
Description = 'An internal error has occurred.'
All requests will return a status code. For example, in the case of status code 400
, check for a requestErrorList
in the response, containing information on validation failure. See RequestErrorList Object definition
--Sample Company requests
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies
Sample PUT
Company
request
Request
PUT
to modify the existing Company
for the Authenticated User
Response
Updated Company
object
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies';
$company = [
'billing' => [
'autoBilling' => true,
'paymentMethod' => 'CARD',
'billingCard' => [
'cardToken' => 'ThisIsAToken2224',
'expirationMonth' => 12,
'expirationYear' => 25
]
],
'settings' => [
'description' => 'Updated Company Description',
'receiptText' => 'Updated Receipt Text',
'scheduleText' => 'Updated Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'username' => 'Someone',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'country' => 'US'
],
"customBranding" => [
"emailBranding" => [
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
],
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
]
],
'billingEmails' => [
'primaryList' => ['test@test.com', 'primary@primary.com'],
'secondaryList' => ['test2@test.com', 'secondary@secondary.com']
],
"serviceList" => [
[
"serviceAllowId" => "123",
"serviceName" => "CHECK",
"vendor" => "Payliance",
"batchClosingHour" => 18,
"allowCredit" => true,
"exceptionReportIsEnabled" => false,
"exceptionReportLink" => "NoLink",
"vendorSettings" => [
"clientId" => "myId",
"isNachaVerifyEnabled" => true
]
]
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($company, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class Settings
{
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public string username { get; set; }
public Address address { get; set; }
public CustomBranding customBranding { get; set; }
}
public class BillingCard
{
public string cardToken { get; set; }
public int expirationMonth { get; set; }
public int expirationYear { get; set; }
}
public class Billing
{
public bool autoBilling { get; set; }
public string paymentMethod { get; set; }
public string username { get; set; }
public BillingCard billingCard { get; set; }
public Address address { get; set; }
}
public class BillingEmails
{
public List<string> primaryEmails { get; set; } = new List<string>();
public List<string> secondaryEmails { get; set; } = new List<string>();
}
public class Service
{
public long serviceAllowId { get; set; }
public string serviceName { get; set; }
public string status { get; set; }
public string vendor { get; set; }
public List<AccountDirective> accountDirectiveList { get; set; }
public string signatureCompanyLogo { get; set; }
public string signatureCompanyName { get; set; }
public string signatureMiniMiranda { get; set; }
public string signatureFromEmailAddress { get; set; }
public int batchClosingHour { get; set; }
public bool allowCredit { get; set; }
public bool exceptionReportIsEnabled { get; set; }
public string exceptionReportLink { get; set; }
public ServiceVendorSetting vendorSettings { get; set; }
}
public class ServiceVendorSetting
{
public string clientId { get; set; }
public bool isNachaVerifyEnabled { get; set; }
public string originatorName { get; set; }
public string apiUser { get; set; }
public string apiKey { get; set; }
public string locationId { get; set; }
public string batchFileNamePrefix { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting
{
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class Company
{
public Billing billing { get; set; } = new Billing();
public Settings settings { get; set; } = new Settings();
public BillingEmails billingEmails { get; set; } = new BillingEmails();
public List<Service> serviceList { get; set; }
}
public class MainClass
{
private static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
Console.WriteLine("Starting");
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/companies";
Company company = new Company();
Billing billing = new Billing();
billing.autoBilling = true;
billing.paymentMethod = "CARD";
billing.username = "testUser@test.com";
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address.country = "US";
billing.address = address;
BillingCard billingCard = new BillingCard();
billingCard.cardToken = "thisIsAToken1234";
billingCard.expirationMonth = 12;
billingCard.expirationYear = 2025;
billing.billingCard = billingCard;
company.billing = billing;
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.description = "Here I describe this company";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
settings.address = address;
settings.customBranding = customBranding;
company.settings = settings;
BillingEmails billingEmails = new BillingEmails();
billingEmails.primaryEmails.Add("test@test.com");
billingEmails.primaryEmails.Add("test2@test.com");
billingEmails.secondaryEmails.Add("testSecondary@test.com");
company.billingEmails = billingEmails;
//Set the service settings, assuming this company has only one service configured (Payliance CHECK)
Service paylianceService = new Service();
paylianceService.serviceAllowId = 3342;
paylianceService.exceptionReportIsEnabeld = false;
ServiceVendorSetting serviceVendorSetting = new ServiceVendorSetting();
serviceVendorSetting.isNachaVerifyEnabled = true;
serviceVendorSetting.clientId = "123id";
paylianceService.vendorSettings = serviceVendorSetting;
paylianceService.batchClosingHour = 17;
paylianceService.allowCredit = true;
paylianceService.exceptionReportIsEnabled = false;
paylianceService.exceptionReportLink = "NoLink";
company.serviceList = new List<Service>();
company.serviceList.Add(paylianceChanges);
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(company, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(Company company, string url)
{
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(company), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
@primaryEmails = ("test@test.com", "primary@primary.com");
@secondaryEmails = ("test2@test.com", "secondary@secondary.com");
my $data = {
"billing" => {
"autoBilling" => true,
"paymentMethod" => "CARD",
"billingCard" => {
"cardToken" => "ThisIsAToken2224",
"expirationMonth" => "12",
"expirationYear" => "25"
}
},
"settings" => {
"description" => "Updated Company Description",
"receiptText" => "Updated Receipt Text",
"scheduleText" => "Updated Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"username" => "Someone",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"country" => "US"
},
"customBranding" => {
"emailBranding" => {
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
}
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
}
},
"billingEmails" => {
"primaryList" => $primaryList,
"secondaryList" => $secondaryList
},
"serviceList" => [
{
"serviceAllowId" => "123",
"serviceName" => "CHECK",
"vendor" => "Payliance",
"batchClosingHour" => 18,
"allowCredit" => true,
"exceptionReportIsEnabled" => false,
"exceptionReportLink" => "NoLink",
"vendorSettings" => {
"clientId" => "myId",
"isNachaVerifyEnabled" => true
}
}
]
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies';
my $req = HTTP::Request->new( 'PUT', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"billing": {
"autoBilling": true,
"paymentMethod": "CARD",
"billingCard": {
"cardToken": "ThisIsAToken2224",
"expirationMonth": "12",
"expirationYear": "25"
}
},
"settings": {
"description": "Updated Company Description",
"receiptText": "Updated Receipt Text",
"scheduleText": "Updated Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"username": "Someone",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"country": "US"
},
"customBranding": {
"emailBranding": {
"fromEmailAddress": "test@test.com",
"footerHtml": "<p>Something in the footer</p>",
"footerText": "Something in the footer",
}
"brandColor": "#113333",
"logoBase64": "iVBORw..."
}
},
"billingEmails": {
"primaryList": [
"test@test.com",
"primary@primary.com"
],
"secondaryList": [
"test2@test.com",
"secondary@secondary.com"
]
},
"serviceList": [
{
"serviceAllowId": "123",
"serviceName": "CHECK",
"vendor": "Payliance",
"batchClosingHour": 18,
"allowCredit": true,
"exceptionReportIsEnabled": false,
"exceptionReportLink": "NoLink",
"vendorSettings": {
"clientId": "myId",
"isNachaVerifyEnabled": true
}
}
]
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_put(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies
Sample GET
Company
request
Request
GET
a single Company
for the Authenticated User
Response
Company
object
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Cname {
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain {
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding {
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding {
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting {
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class HierarchyDisplay {
public string name { get; set; }
public Address address { get; set; }
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string dateCreated { get; set; }
public string dateModified { get; set; }
public string hierarchyDisplaySetting { get; set; }
public HierarchyDisplay hierarchyDisplay { get; set; }
public CustomBranding customBranding { get; set; }
}
public class BillingCard {
public string cardToken { get; set; }
public int expirationMonth { get; set; }
public int expirationYear { get; set; }
}
public class Billing {
public bool autoBilling { get; set; }
public string paymentMethod { get; set; }
public string username { get; set; }
public BillingCard billingCard { get; set; }
public Address address { get; set; }
}
public class BillingEmails {
public List<string> primaryEmails { get; set; } = new List<string>();
public List<string> secondaryEmails { get; set; } = new List<string>();
}
public class Company {
public Billing billing { get; set; } = new Billing();
public Settings settings { get; set; } = new Settings();
public BillingEmails billingEmails { get; set; } = new BillingEmails();
}
public class MainClass {
public static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/api/v2_0/companies";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<Company> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<Company> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
Company company = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
company = JsonConvert.DeserializeObject<Company>(responseBody);
// Do something with it
Console.WriteLine("CompanyName: " + company.settings.name);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return company;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/companies'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies
Sample PATCH
Company
request
Request
PATCH
to modify an existing Company
Response
Updated Company
object
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies';
$company = [
'billing' => [
'autoBilling' => true,
'paymentMethod' => 'CARD',
'billingCard' => [
'cardToken' => 'ThisIsAToken2224',
'expirationMonth' => 12,
'expirationYear' => 25
]
],
'settings' => [
'description' => 'Updated Company Description',
'receiptText' => 'Updated Receipt Text',
'scheduleText' => 'Updated Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
"customBranding" => [
"emailBranding" => [
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
],
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
]
],
'billingEmails' => [
'primaryList' => [], //This will remove all current emails in primaryList
'secondaryList' => ['another@test.com']
],
"serviceList" => [
[
"serviceAllowId" => "123",
"serviceName" => "CHECK",
"vendor" => "Payliance",
"allowCredit" => true,
"vendorSettings" => [
"clientId" => "myId",
"isNachaVerifyEnabled" => true
]
]
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($company, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname {
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain {
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding {
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding {
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class Settings
{
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public string username { get; set; }
public Address address { get; set; }
public CustomBranding customBranding { get; set; }
public string hierarchyDisplaySetting { get; set; }
}
public class BillingCard
{
public string cardToken { get; set; }
public int expirationMonth { get; set; }
public int expirationYear { get; set; }
}
public class Billing
{
public bool autoBilling { get; set; }
public string paymentMethod { get; set; }
public string username { get; set; }
public BillingCard billingCard { get; set; }
public Address address { get; set; }
}
public class BillingEmails
{
public List<string> primaryEmails { get; set; } = new List<string>();
public List<string> secondaryEmails { get; set; } = new List<string>();
}
public class Service
{
public long serviceAllowId { get; set; }
public string serviceName { get; set; }
public string status { get; set; }
public string vendor { get; set; }
public List<AccountDirective> accountDirectiveList { get; set; }
public string signatureCompanyLogo { get; set; }
public string signatureCompanyName { get; set; }
public string signatureMiniMiranda { get; set; }
public string signatureFromEmailAddress { get; set; }
public int batchClosingHour { get; set; }
public bool allowCredit { get; set; }
public bool exceptionReportIsEnabled { get; set; }
public string exceptionReportLink { get; set; }
public ServiceVendorSetting vendorSettings { get; set; }
}
public class ServiceVendorSetting
{
public string clientId { get; set; }
public bool isNachaVerifyEnabled { get; set; }
public string originatorName { get; set; }
public string apiUser { get; set; }
public string apiKey { get; set; }
public string locationId { get; set; }
public string batchFileNamePrefix { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting
{
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class Company
{
public Billing billing { get; set; }
public Settings settings { get; set; }
public BillingEmails billingEmails { get; set; }
public List<Service> serviceList { get; set; }
}
public class MainClass
{
static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/companies";
Company company = new Company();
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.description = "Here I describe this company";
settings.receiptText = "Thank you for paying";
settings.cardFeeAmount = 2.25;
settings.username = "testUser@test.com";
Address address = new Address();
address.streetAddressOne = "First street";
address.country = "US";
settings.address = address;
settings.customBranding = customBranding;
company.settings = settings;
Service paylianceChanges = new Service();
paylianceChanges.serviceAllowId = 3342;
paylianceChanges.exceptionReportIsEnabeld = false;
ServiceVendorSetting serviceVendorSetting = new ServiceVendorSetting();
serviceVendorSetting.clientId = '123id';
serviceVendorSetting.isNachaVerifyEnabled = true;
paylianceChanges.vendorSettings = serviceVendorSetting;
company.serviceList = new List<Service>();
company.serviceList.Add(paylianceChanges);
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PATCHData(company, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PATCHData(Company company, string url)
{
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded companyUsername:companyPassword)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(company), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PatchAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
company = JsonConvert.DeserializeObject<Company>(responseBody);
// Do something with it
Console.WriteLine("CompanyName: " + company.settings.description);
}
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
@primaryEmails = ();
@secondaryEmails = ("another@test.com");
my $data = {
"billing" => {
"autoBilling" => true,
"paymentMethod" => "CARD",
"billingCard" => {
"cardToken" => "ThisIsAToken2224",
"expirationMonth" => "12",
"expirationYear" => "25"
}
},
"settings" => {
"description" => "Updated Company Description",
"receiptText" => "Updated Receipt Text",
"scheduleText" => "Updated Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"customBranding" => {
"emailBranding" => {
"fromEmailAddress" => "test@test.com"
}
}
},
"billingEmails" => {
"primaryList" => $primaryList,
"secondaryList" => $secondaryList
},
"serviceList" => [
{
"serviceAllowId" => "123",
"serviceName" => "CHECK",
"vendor" => "Payliance",
"allowCredit" => true,
"vendorSettings" => {
"clientId" => "myId",
"isNachaVerifyEnabled" => true
}
}
]
};
$data = JSON::XS->new->utf8->encode($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies';
my $req = HTTP::Request->new('PATCH', $url);
$req->authorization_basic('SomeSecretUsername', 'SomeSecretPassword');
$req->content_type('application/json');
$req->content_length(length($data));
$req->content($data);
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request($req);
if ($response->is_success) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ($@) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"billing": {
"autoBilling": true,
"paymentMethod": "CARD",
"billingCard": {
"cardToken": "ThisIsAToken2224",
"expirationMonth": "12",
"expirationYear": "25"
}
},
"settings": {
"description": "Updated Company Description",
"receiptText": "Updated Receipt Text",
"scheduleText": "Updated Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"customBranding": {
"emailBranding": {
"fromEmailAddress": "test@test.com",
"footerHtml": "<p>Something in the footer</p>",
"footerText": "Something in the footer",
}
"brandColor": "#113333",
"logoBase64": "iVBORw..."
}
},
"billingEmails": {
"primaryList": [],
"secondaryList": [
"another@test.com"
]
},
"serviceList": [
{
"serviceAllowId": "123",
"serviceName": "CHECK",
"vendor": "Payliance",
"allowCredit": true,
"vendorSettings": {
"clientId": "myId",
"isNachaVerifyEnabled": true
}
}
]
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_patch(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies/accountdirectives/{accountDirective}
Sample PUT
AccountDirective
request
Request
PUT
to modify an existing AccountDirective
. The account directive provided in the url is required and specifies which account directive will be edited.
When deactivating an account directive, provide a replacingAccountDirective
to update all pending payments with the replacing account directive.
Response
Updated AccountDirective
object
<?php
$accountDirectiveToUpdate = '123-1';
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
$vendorSettings = [
'sourceKey' => 'mySourceKey',
'pin' => 'myPin',
'zeroCostAllowBypass' => true
];
$accountDirective = [
'name' => 'Card not present',
'isActive' => true,
'zeroCostFeePercent' => '0.35',
'allowedCardTypeList' => ['VISA', 'MASTERCARD', 'DISCOVER', 'AMERICAN_EXPRESS'],
'vendorSettings' => $vendorSettings,
'replacingAccountDirective' => '123-2' //When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($accountDirective, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public string replacingAccountDirective { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting {
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
Console.WriteLine("Starting");
string accountDirectiveToUpdate = "123-2";
string url = "https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/accountdirectives/" + accountDirectiveToUpdate;
AccountDirective accountDirective = new AccountDirective();
accountDirective.name = "Card not present";
accountDirective.isActive = true;
List<string> allowedCardTypeList = new List<string>();
allowedCardTypeList.Add("VISA");
allowedCardTypeList.Add("MASTERCARD");
allowedCardTypeList.Add("DISCOVER");
allowedCardTypeList.Add("AMERICAN_EXPRESS");
accountDirective.allowedCardTypeList = allowedCardTypeList;
//The full vendorSetting for the vendor must be completed
VendorSetting vendorSetting = new VendorSetting();
vendorSetting.sourceKey = "newSourceKey";
vendorSetting.pin = "oldPin";
vendorSetting.zeroCostAllowBypass = false;
accountDirective.vendorSettings = vendorSetting;
//If setting an account directive to inactive, provide the replacingAccountDirective to update all pending payments to
accountDirective.replacingAccountDirective = "123-1";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(accountDirective, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(AccountDirective accountDirective, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(accountDirective), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $vendorSettings = {
'sourceKey' => 'mySourceKey',
'pin' => 'myPin',
'zeroCostAllowBypass' => true
};
my $accountDirective = {
'name' => 'Card not present',
'isActive' => false,
'zeroCostFeePercent' => '0.35',
'allowedCardTypeList' => ['VISA', 'MASTERCARD', 'DISCOVER', 'AMERICAN_EXPRESS'],
'vendorSettings' => $vendorSettings,
'replacingAccountDirective' => '123-2' #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
};
$data = JSON::XS->new->utf8->encode ($accountDirective);
my $accountDirectiveToUpdate = '123-1';
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
my $req = HTTP::Request->new( 'PUT', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
vendorSettings = {
"sourceKey":"mySourceKey",
"pin":"myPin",
"zeroCostAllowBypass":true
}
data = {
"accountDirective": "123-1",
"name":"Card not present",
"isActive":false,
"zeroCostFeePercent":"0.35",
"replacingAccountDirective": "123-2", #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
"allowedCardTypeList":%w[VISA MASTERCARD AMERICAN_EXPRESS],
"vendorSettings":vendorSettings
}
accountdirectivetoupdate = '123-1'
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/' + accountdirectivetoupdate
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_put(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies/accountdirectives/{accountDirective}
Sample PATCH
AccountDirective
request
Request
PATCH
to modify an existing AccountDirective
. The account directive provided in the url is required and specifies which account directive will be edited.
When deactivating an account directive, provide a replacingAccountDirective
to update all pending payments with the replacing account directive. The vendorSettings
objects are required in full.
Response
Updated AccountDirective
object
<?php
$accountDirectiveToUpdate = '123-1';
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
$vendorSettings = [
'sourceKey' => 'mySourceKey',
'pin' => 'myPin',
'zeroCostAllowBypass' => true
];
//Setting the zeroCostFeePercent to empty string in the request will cause the value to be nullified on the object
$accountDirective = [
'name' => 'Card not present',
'isActive' => true,
'zeroCostFeePercent' => '',
'allowedCardTypeList' => ['VISA', 'MASTERCARD', 'DISCOVER', 'AMERICAN_EXPRESS'],
'vendorSettings' => $vendorSettings,
'replacingAccountDirective' => '123-2' //When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($accountDirective, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public string replacingAccountDirective { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting {
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
Console.WriteLine("Starting");
string url = "https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/accountdirectives/123-2";
AccountDirective accountDirective = new AccountDirective();
accountDirective.name = "Card not present";
accountDirective.isActive = true;
List<string> allowedCardTypeList = new List<string>();
allowedCardTypeList.Add("VISA");
allowedCardTypeList.Add("MASTERCARD");
accountDirective.allowedCardTypeList = allowedCardTypeList;
//The full vendorSetting for the vendor must be completed
VendorSetting vendorSetting = new VendorSetting();
vendorSetting.sourceKey = "newSourceKey";
vendorSetting.pin = "oldPin";
vendorSetting.zeroCostAllowBypass = false;
accountDirective.vendorSettings = vendorSetting;
//If setting an account directive to inactive, provide the replacingAccountDirective to update all pending payments to
accountDirective.replacingAccountDirective = "123-1";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PATCHData(accountDirective, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PATCHData(AccountDirective accountDirective, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(accountDirective), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PatchAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $vendorSettings = {
'sourceKey' => 'mySourceKey',
'pin' => 'myPin',
'zeroCostAllowBypass' => true
};
#Empty zeroCostFeePercent will set the field to null on the account directive
my $accountDirective = {
'name' => 'Card not present',
'isActive' => true,
'zeroCostFeePercent' => '',
'allowedCardTypeList' => [ 'VISA', 'MASTERCARD' ],
'vendorSettings' => $vendorSettings,
'replacingAccountDirective' => '123-2' #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
};
$data = JSON::XS->new->utf8->encode ($accountDirective);
my $accountDirectiveToUpdate = '123-1';
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/'.$accountDirectiveToUpdate;
my $req = HTTP::Request->new( 'PATCH', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
vendorSettings = {
"sourceKey":"mySourceKey",
"pin":"myPin",
"zeroCostAllowBypass":true
}
#Setting the zeroCostFeePercent to empty string in the request will cause the value to be nullified on the object
data = {
"accountDirective": "123-1",
"name":"Card not present",
"isActive":true,
"zeroCostFeePercent":"",
"replacingAccountDirective": "123-2", #When deactivating an account directive, provide this to update all pending payments with old account directive to this new one
"allowedCardTypeList":%w[VISA MASTERCARD AMERICAN_EXPRESS],
"vendorSettings":vendorSettings
}
accountdirectivetoupdate = '123-1'
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/' + accountdirectivetoupdate
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_patch(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/lists/companies/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/lists/companies/accountdirectives
Sample POST
AccountDirectiveSearchParameters
request
Request
POST
AccountDirectiveSearchParameters
to search for a list of account directives
Response
AccountDirectiveList
object containing account directives that match the search parameters
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/companies/accountdirectives';
//Search for active CARD account directives
$data = [
"serviceNameList" => [ "CARD" ],
"activation" => true,
"vendorNameList" => [ "USAEPAY", "NEWTEK" ]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirectiveSearchParameters {
public string nameWildcard { get; set; }
public bool activation { get; set; }
public List<string> nameList { get; set; }
public List<string> serviceNameList { get; set; }
public List<string> accountDirectiveList { get; set; }
public List<string> vendorNameList { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting {
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class AccountDirectiveList {
public List<long> locationIdList { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
}
public class MainClass {
public static HttpClient client = new HttpClient();
private static void Main(string[] args) {
Console.WriteLine("Starting");
string url = "https://companyadministrationdemo.pdc4u.com/api/v2_0/lists/companies/accountdirectives";
//Search only for active, Card account directives
AccountDirectiveSearchParameters accountDirectiveSearchParameters = new AccountDirectiveSearchParameters();
accountDirectiveSearchParameters.activation = true;
List<string> serviceNameList = new List<string>();
serviceNameList.Add("CARD");
accountDirectiveSearchParameters.serviceNameList = serviceNameList;
List<string> vendorNameList = new List<string>();
vendorNameList.Add("USAEPAY");
vendorNameList.Add("NEWTEK");
AccountDirectiveSearchParameters.vendorNameList = vendorNameList;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirectiveList> task = POSTData(accountDirectiveSearchParameters, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirectiveList> POSTData(AccountDirectiveSearchParameters accountDirectiveSearchParameters, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
AccountDirectiveList accountDirectiveList = null;
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(accountDirectiveSearchParameters), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirectiveList = JsonConvert.DeserializeObject<AccountDirectiveList>(responseBody);
// Do something with it
Console.WriteLine("Card account directive count: " + accountDirectiveList.cardAccountDirectiveList.Count);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
return accountDirectiveList;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
#Search for active card account directives
my $data = {
"serviceNameList" => [ "CARD" ],
"activation" => true,
"vendorNameList" => [ 'USAEPAY', 'NEWTEK' ]
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/companies/accountdirectives';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
#Search for active card account directives
data = {
"serviceNameList": %w[CARD],
"activation": true,
"vendorNameList": %w[USAEPAY, NEWTEK]
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/companies/accountdirectives'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies/accountdirectives/{accountDirective}
Sample GET
AccountDirective
request
Request
GET
to get the details of the specified account directive. Include the serviceName
parameter to limit specifically to one service.
Response
AccountDirective
object
<?php
//Get the account directive 123-4 only if it is a CARD account directive using the UsaEpay vendor
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/123-4?serviceName=CARD&vendorName=USAEPAY';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting {
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class MainClass {
public static HttpClient client = new HttpClient();
private static void Main(string[] args) {
//Get the account directive 123-4 only if it is a CARD account directive using the UsaEpay vendor
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/123-4?serviceName=CARD&vendorName=USAEPAY";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirective> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirective> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
AccountDirective accountDirective = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirective = JsonConvert.DeserializeObject<AccountDirective>(responseBody);
// Do something with it
Console.WriteLine("Account Directive name: " + accountDirective.name);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return accountDirective;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
#Get the account directive 123-4 only if it is a CARD account directive using the UsaEpay vendor
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/companies/accountdirectives/123-4?serviceName=CARD&vendorName=USAEPAY';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
c = Curl::Easy.new
#Get the account directive 123-4 only if it is a CARD account directive using the UsaEpay vendor
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/accountdirectives/123-4?serviceName=CARD&vendorName=USAEPAY'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
--Sample Group requests
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups
Sample POST
Group
request
Request
POST
to create a new Group
Response
Group
object
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/';
$group = [
'locationIds' => [1],
'settings' => [
'name' => 'Group Name',
'description' => 'Group Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'receiptText' => 'Receipt Text',
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'cardAccountDirectiveList' => [
0 => [
'accountDirective' => '888-1'
],
1 => [
'accountDirective' => '888-2'
]
],
'achAccountDirectiveList' => [
0 => [
'accountDirective' => '2071-1'
],
],
'cashAccountDirectiveList' => [
0 => [
'accountDirective' => '2222-1'
],
],
"customBranding" => [
"emailBranding" => [
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
],
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
]
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($group, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if ($statusCode == '200') {
echo $result;
} else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings
{
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Group
{
public string customId { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
}
public class MainClass
{
private static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/groups";
Group group = new Group();
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.name = "Albuquerque Group";
settings.description = "Our offices in Albuquerque";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
settings.customBranding = customBranding;
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address.country = "US";
settings.address = address;
group.settings = settings;
group.customId = "Albuquerque offices";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = POSTData(group, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task POSTData(Group group, string url)
{
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(group), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
Console.WriteLine(json["groupId"]);
}
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"locationIds" => [ 1 ],
"settings" => {
"name" => "Group Name",
"description" => "Group Description",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"zipPlusFour" => "1234",
"country" => "US"
},
"receiptText" => "Receipt Text",
"scheduleText" => "Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"cardAccountDirectiveList" => [
{
"accountDirective" => "888-1"
},
{
"accountDirective" => "888-2"
}
],
"cashAccountDirectiveList" => [
{
"accountDirective" => "2222-1"
}
],
"achAccountDirectiveList" => [
{
"accountDirective" => "2071-1"
}
],
"customBranding" => {
"emailBranding" => {
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
}
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
}
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"locationIds": [
1
],
"settings": {
"name": "Group Name",
"description": "Group Description",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"zipPlusFour": "1234",
"country": "US"
},
"receiptText": "Receipt Text",
"scheduleText": "Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"cardAccountDirectiveList": [
{
"accountDirective": "888-1"
},
{
"accountDirective": "888-2"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2222-1"
}
],
"achAccountDirectiveList": [
{
"accountDirective": "2071-1"
}
],
"customBranding": {
"emailBranding": {
"fromEmailAddress": "test@test.com",
"footerHtml": "<p>Something in the footer</p>",
"footerText": "Something in the footer",
}
"brandColor": "#113333",
"logoBase64": "iVBORw..."
}
}
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{id}
Sample PUT
Group
request
Request
PUT
to modify an existing Group
by its id
Response
Updated Group
object
<?php
$groupIdToUpdate = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/' . $groupIdToUpdate;
$group = [
'locationIds' => [1],
'settings' => [
'name' => 'Updated Group Name',
'description' => 'Group Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'receiptText' => 'Receipt Text',
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'cardAccountDirectiveList' => [
0 => [
'accountDirective' => '888-1'
],
1 => [
'accountDirective' => '888-2'
]
],
'achAccountDirectiveList' => [
0 => [
'accountDirective' => '2071-1'
],
'cashAccountDirectiveList' => [
0 => [
'accountDirective' => '2222-1'
],
]
],
"customBranding" => [
"emailBranding" => [
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
],
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
]
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($group, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if ($statusCode == '200') {
echo $result;
} else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings
{
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Group
{
public string customId { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
}
public class MainClass
{
static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
int groupId = 1234;
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/" + groupId;
Group group = new Group();
group.customId = "Albuquerque offices";
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.name = "Albuquerque Group";
settings.description = "Change Our offices in Albuquerque";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
settings.customBranding = customBranding;
/*
* Not including the address in a PUT will set the group address to null
*/
group.settings = settings;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(group, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(Group group, string url)
{
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var putContent = new StringContent(JsonConvert.SerializeObject(group), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, putContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
Console.WriteLine(json["groupId"]);
}
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"locationIds" => [ 1 ],
"settings" => {
"name" => "Updated Group Name",
"description" => "Group Description",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"zipPlusFour" => "1234",
"country" => "US"
},
"receiptText" => "Receipt Text",
"scheduleText" => "Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"cardAccountDirectiveList" => [
{
"accountDirective" => "888-1"
},
{
"accountDirective" => "888-2"
}
],
"cashAccountDirectiveList" => [
{
"accountDirective" => "2222-1"
}
],
"achAccountDirectiveList" => [
{
"accountDirective" => "2071-1"
}
],
"customBranding" => {
"emailBranding" => {
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
}
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
}
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $groupIdToUpdate = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/' . $groupIdToUpdate;
my $req = HTTP::Request->new( 'PUT', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"locationIds": [
1
],
"settings": {
"name": "Updated Group Name",
"description": "Group Description",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"zipPlusFour": "1234",
"country": "US"
},
"receiptText": "Receipt Text",
"scheduleText": "Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"cardAccountDirectiveList": [
{
"accountDirective": "888-1"
},
{
"accountDirective": "888-2"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2222-1"
}
],
"achAccountDirectiveList": [
{
"accountDirective": "2071-1"
}
],
"customBranding": {
"emailBranding": {
"fromEmailAddress": "test@test.com",
"footerHtml": "<p>Something in the footer</p>",
"footerText": "Something in the footer",
}
"brandColor": "#113333",
"logoBase64": "iVBORw..."
}
}
}
groupidtoupdate = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/' + groupidtoupdate
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_put(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups
Request
GET
a list of all Groups
Response
List of Group
objects
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{id}
Sample GET
Group
request by id
Request
GET
a single Group
by its id
Response
Group
object
<?php
$desiredGroupId = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/' . $desiredGroupId;
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Cname {
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain {
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding {
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding {
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class HierarchyDisplay {
public string name { get; set; }
public Address address;
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string dateCreated { get; set; }
public string dateModified { get; set; }
public string hierarchyDisplaySetting { get; set; }
public HierarchyDisplay hierarchyDisplay { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Location {
public int locationId { get; set; }
public string customId { get; set; }
public Settings settings { get; set; }
}
public class Group {
public int groupId { get; set; }
public string customId { get; set; }
public int locationCount { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
public List<Location> locations { get; set; } = new List<Location>();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
int myGroupId = 12;
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/" + myGroupId;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<Group> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<Group> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
Group group = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
group = JsonConvert.DeserializeObject<Group>(responseBody);
// Do something with it
Console.WriteLine("GroupId: " + group.groupId);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return group;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $desiredGroupId = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/' . $desiredGroupId;
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
desiredgroupid = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/' + desiredgroupid
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/search
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/search
Sample POST
Group
request with GroupSearchParameters
Request
POST
to get a list of all Groups
with matching GroupSearchParameters
Response
List of Group
objects with matching GroupSearchParameters
<?php
$groupSearchParameters = [
'groupNameOrCustomId' => 'customName'
];
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/search/';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($groupSearchParameters, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class HierarchyDisplay
{
public string name { get; set; }
public Address address;
}
public class Settings
{
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string dateCreated { get; set; }
public string dateModified { get; set; }
public string hierarchyDisplaySetting { get; set; }
public HierarchyDisplay hierarchyDisplay { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Location
{
public int locationId { get; set; }
public string customId { get; set; }
public Settings settings { get; set; }
}
public class Group
{
public int groupId { get; set; }
public string customId { get; set; }
public int locationCount { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public Settings settings { get; set; } = new Settings();
}
public class GroupList
{
public List<Group> groupList { get; set; }
}
public class GroupSearchParameters
{
public string groupName { get; set; }
public string groupNameOrCustomId { get; set; }
public List<int> groupIdList { get; set; } = new List<int>();
public List<string> customIdList { get; set; } = new List<string>();
}
public class MainClass
{
static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/search";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
GroupSearchParameters groupSearchParameters = new GroupSearchParameters();
groupSearchParameters.groupNameOrCustomId = "customGroupId";
Task<GroupList> task = POSTData(groupSearchParameters, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<GroupList> POSTData(GroupSearchParameters groupSearch, string url)
{
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
GroupList groups = null;
var postContent = new StringContent(JsonConvert.SerializeObject(groupSearch), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
groups = JsonConvert.DeserializeObject<GroupList>(responseBody);
// Do something with it
Console.WriteLine("Groups: " + groups.groupList.Count);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return groups;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"groupNameOrCustomId" => "Custom Name"
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/search';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"groupNameOrCustomId": "CustomID"
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/search'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{id}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{id}
Request
DELETE
to delete deactivate a Group
record that does not have associated Locations
Response
Status code 200 - Successful
Status code 404 - Record could not be found
Status code 409 - Could not be deleted deactivated as there are associated Locations
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{groupId}/effectivesettings/accountdirectives/{accountDirective}
Sample GET
Group AccountDirective
request
Request
GET
to get the details of the specified account directive. The serviceName
parameter limits the request to specifically to one service.
Response
AccountDirective
object
<?php
//Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
//Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirective> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirective> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
AccountDirective accountDirective = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirective = JsonConvert.DeserializeObject<AccountDirective>(responseBody);
// Do something with it
Console.WriteLine("Account Directive name: " + accountDirective.name);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return accountDirective;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
#Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
c = Curl::Easy.new
#Get accountDirective 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for group 3
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/3/effectivesettings/accountdirectives/123-4?serviceName=CARD'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
--Sample Location requests
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations
Sample POST
Location
request
Request
POST
to create a new Location
Response
Location
object
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/';
$location = [
'customId' => 'Custom Location ID',
'activation' => true,
'groupId' => 1,
'settings' => [
'name' => 'Location Name',
'description' => 'Location Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'receiptText' => 'Receipt Text',
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'cardAccountDirectiveList' => [
0 => [
'accountDirective' => '888-1'
],
1 => [
'accountDirective' => '888-2'
]
],
'achAccountDirectiveList' => [
0 => [
'accountDirective' => '2071-1'
],
],
'cashAccountDirectiveList' => [
0 => [
'accountDirective' => '2222-1'
],
],
"customBranding" => [
"emailBranding" => [
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
],
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
]
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if ($statusCode == '200') {
echo $result;
} else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Location {
public long locationId { get; set; }
public string customId { get; set; }
public bool activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations";
Location location = new Location();
location.activation = true;
location.customId = "Alb1";
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.name = "Albuquerque Location 1";
settings.description = "First in Albuquerque";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
settings.customBranding = customBranding;
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address.country = "US";
settings.address = address;
location.settings = settings;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = POSTData(location, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task POSTData(Location location, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var putContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, putContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(responseBody);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"customId" => "Custom Location ID",
"activation" => true,
"groupId" => 1,
"settings" => {
"name" => "Group Name",
"description" => "Group Description",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"zipPlusFour" => "1234",
"country" => "US"
},
"receiptText" => "Receipt Text",
"scheduleText" => "Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"cardAccountDirectiveList" => [
{
"accountDirective" => "888-1"
},
{
"accountDirective" => "888-2"
}
],
"cashAccountDirectiveList" => [
{
"accountDirective" => "2222-1"
}
],
"achAccountDirectiveList" => [
{
"accountDirective" => "2071-1"
}
],
"customBranding" => {
"emailBranding" => {
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
}
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
}
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"customId": "Custom Location ID",
"activation": true,
"groupId": 1,
"settings": {
"name": "Group Name",
"description": "Group Description",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"zipPlusFour": "1234",
"country": "US"
},
"receiptText": "Receipt Text",
"scheduleText": "Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"cardAccountDirectiveList": [
{
"accountDirective": "888-1"
},
{
"accountDirective": "888-2"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2222-1"
}
],
"achAccountDirectiveList": [
{
"accountDirective": "2071-1"
}
],
"customBranding": {
"emailBranding": {
"fromEmailAddress": "test@test.com",
"footerHtml": "<p>Something in the footer</p>",
"footerText": "Something in the footer",
}
"brandColor": "#113333",
"logoBase64": "iVBORw..."
}
}
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{id}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{id}
Sample PUT
Location
request
Request
PUT
to modify an existing Location
by its id
Response
Updated Location
object
<?php
$locationIdToUpdate = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' . $locationIdToUpdate;
$location = [
'customId' => 'Custom Location ID',
'activation' => true,
'groupId' => 1,
'settings' => [
'name' => 'Updated Location Name',
'description' => 'Updated Location Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'receiptText' => 'Receipt Text',
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1,
'achFeeAmount' => 1,
'cardAccountDirectiveList' => [
0 => [
'accountDirective' => '888-1'
],
1 => [
'accountDirective' => '888-2'
]
],
'achAccountDirectiveList' => [
0 => [
'accountDirective' => '2071-1'
],
],
'cashAccountDirectiveList' => [
0 => [
'accountDirective' => '2222-1'
],
],
"customBranding" => [
"emailBranding" => [
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
],
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
]
]
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if ($statusCode == '200') {
echo $result;
} else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Location {
public string customId { get; set; }
public bool activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
int locationIdToUpdate = 22;
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/" + locationIdToUpdate;
Location location = new Location();
location.activation = true;
location.customId = "Alb1";
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.name = "Albuquerque Location 1";
settings.description = "First in Albuquerque";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
settings.customBranding = customBranding;
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address.country = "US";
settings.address = address;
location.settings = settings;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(location, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(Location location, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var putContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, putContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(json["locationId"]);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"customId" => "Custom Location ID",
"activation" => true,
"groupId" => 1,
"settings" => {
"name" => "Updated Group Name",
"description" => "Updated Group Description",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"zipPlusFour" => "1234",
"country" => "US"
},
"receiptText" => "Receipt Text",
"scheduleText" => "Schedule Text",
"cardFeeAmount" => 1,
"achFeeAmount" => 1,
"cardAccountDirectiveList" => [
{
"accountDirective" => "888-1"
},
{
"accountDirective" => "888-2"
}
],
"cashAccountDirectiveList" => [
{
"accountDirective" => "2222-1"
}
],
"achAccountDirectiveList" => [
{
"accountDirective" => "2071-1"
}
],
"customBranding" => {
"emailBranding" => {
"fromEmailAddress" => "test@test.com",
"footerHtml" => "<p>Something in the footer</p>",
"footerText" => "Something in the footer"
}
"brandColor" => "#113333",
"logoBase64" => "iVBORw..."
}
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $locationIdToUpdate = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' . $locationIdToUpdate;
my $req = HTTP::Request->new( 'PUT', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"customId": "Custom Location ID",
"activation": true,
"groupId": 1,
"settings": {
"name": "Updated Group Name",
"description": "Updated Group Description",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"zipPlusFour": "1234",
"country": "US"
},
"receiptText": "Receipt Text",
"scheduleText": "Schedule Text",
"cardFeeAmount": 1,
"achFeeAmount": 1,
"cardAccountDirectiveList": [
{
"accountDirective": "888-1"
},
{
"accountDirective": "888-2"
}
],
"cashAccountDirectiveList": [
{
"accountDirective": "2222-1"
}
],
"achAccountDirectiveList": [
{
"accountDirective": "2071-1"
}
],
"customBranding": {
"emailBranding": {
"fromEmailAddress": "test@test.com",
"footerHtml": "<p>Something in the footer</p>",
"footerText": "Something in the footer",
}
"brandColor": "#113333",
"logoBase64": "iVBORw..."
}
}
}
locationidtoupdate = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' + locationidtoupdate
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_put(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations
Request
GET
a list of all Locations
Response
List of Location
objects
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{id}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{id}
Sample GET
Location
request by id
Request
GET
a single Location
by its id
Response
Location
object
<?php
$desiredLocationId = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' . $desiredLocationId;
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings
{
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Location
{
public long locationId { get; set; }
public string customId { get; set; }
public bool activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class MainClass
{
static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
int myLocationId = 12;
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/" + myLocationId;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<Location> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<Location> GETData(string url)
{
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
Location location = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
location = JsonConvert.DeserializeObject<Location>(responseBody);
// Do something with it
Console.WriteLine("LocationId: " + location.locationId);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return location;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $desiredLocationId = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' . $desiredLocationId;
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
desiredlocationid = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' + desiredlocationid
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/search
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/search
Sample POST
LocationSearchParameters
to find Location
objects that match the parameters
Request
POST
a list of all Locations
with matching LocationSearchParameters
Response
List of Location
objects with matching LocationSearchParameters
<?php
$locationSearchParameters = [
'locationNameOrCustomId' => 'customName'
];
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/search/';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(locationSearchParameters, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Location {
public string customId { get; set; }
public bool activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class LocationList {
public List<Location> locationList { get; set; }
}
public class LocationSearchParameters {
public string locationNameOrCustomId { get; set; }
public bool? activation { get; set; } //This needs to be nullable as a null value will specify not to search on this parameter
public bool? isAssignedToGroup { get; set; } //This needs to be nullable as a null value will specify not to search on this parameter
public List<long> locationIdList { get; set; }
public List<String> customIdList { get; set; }
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/search";
LocationSearchParameters locationSearchParameters = new LocationSearchParameters();
locationSearchParameters.activation = true; //Only include activated locations
locationSearchParameters.isAssignedToGroup = true; //Only include locations that are assigned to a group
List<long> locationIdList = new List<long>(); //Only include locations that have a locationId in this list
locationIdList.Add(12);
locationIdList.Add(22);
locationSearchParameters.locationIdList = locationIdList;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = POSTData(locationSearchParameters, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<LocationList> POSTData(LocationSearchParameters locationSearchParameters, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
LocationList locationList = null;
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(locationSearchParameters), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(responseBody);
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
locationList = JsonConvert.DeserializeObject<LocationList>(responseBody);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
return locationList;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"locationNameOrCustomId" => "Custom Name"
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/search';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"locationNameOrCustomId": "CustomID"
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/search'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{id}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{id}
Sample PATCH
Location
request
Request
PATCH
to modify an existing Location
by its id
Response
Updated Location
object
<?php
$locationIdToUpdate = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' . $locationIdToUpdate;
$data = [
'groupId' => 1
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings
{
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
public CustomBranding customBranding { get; set; }
}
public class Location
{
public string customId { get; set; }
public bool? activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class MainClass
{
static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/22";
Location location = new Location();
location.activation = true;
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.receiptText = ""; //Set the receiptText to null, allowing for inheritance from the group (if assigned) or company
settings.username = "testUser@test.com";
settings.customBranding = customBranding;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PATCHData(location, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PATCHData(Location location, string url)
{
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var patchContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PatchAsync(url, patchContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
Console.WriteLine(responseBody);
}
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"groupId" => 1
};
$data = JSON::XS->new->utf8->encode ($data);
my $locationIdToUpdate = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' . $locationIdToUpdate;
my $req = HTTP::Request->new( 'PATCH', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"groupId": 1
}
locationidtoupdate = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/' + locationidtoupdate
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_patch(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{locationId}/effectivesettings/accountdirectives/{accountDirective}
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{locationId}/effectivesettings/accountdirectives/{accountDirective}
Sample GET
Location AccountDirective
request
Request
GET
to get the details of the specified account directive. The serviceName
parameter limits the request to specifically to one service.
Response
AccountDirective
object
<?php
//Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for location 3
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/3/effectivesettings/accountdirectives/123-4?serviceName=CARD';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
}
public class MainClass {
private static HttpClient client = new HttpClient();
private static void Main(string[] args) {
//Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for location 3
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/3/effectivesettings/accountdirectives/123-4?serviceName=CARD";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirective> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirective> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
AccountDirective accountDirective = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirective = JsonConvert.DeserializeObject<AccountDirective>(responseBody);
// Do something with it
Console.WriteLine("Account Directive name: " + accountDirective.name);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return accountDirective;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
#Get the account directive 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for location 3
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/3/effectivesettings/accountdirectives/123-4?serviceName=CARD';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
c = Curl::Easy.new
#Get accountDirective 123-4 only if it is a CARD account directive and only if it is allowed, either explicitly or inherited, for location 3
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/3/effectivesettings/accountdirectives/123-4?serviceName=CARD'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
-- Effective Settings
The Effective Settings endpoint will return Setting
fields that are inherited up the hierarchy. For example if a Location
does not have a value set for a setting field, the setting will be provided from its assigned Group
or Company
. On the Setting
object, there are two additional fields, inheritedFromGroup
and inheritedFromCompany
, that will list the fields which were inherited up the hierarchy.
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{id}/effectivesettings
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{id}/effectivesettings
Location
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{id}/effectivesettings
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{id}/effectivesettings
Group
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/effectivesettings
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies/effectivesettings
Company
Sample GET
effective settings for Location
Request
GET
a Location
, Group
or Company
effective settings
Response
A Location
, Group
or Company
with their effective settings
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/1/effectivesettings';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
}
public class Location {
public long locationId { get; set; }
public string customId { get; set; }
public bool activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
int myLocationId = 12;
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/" + myLocationId + "/effectivesettings/";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<Location> task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<Location> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
Location location = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
location = JsonConvert.DeserializeObject<Location>(responseBody);
// Do something with it
Console.WriteLine("LocationId: " + location.locationId);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return location;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/1/effectivesettings';
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/1/effectivesettings'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Effective Settings Preview
The Effective Settings Preview endpoint allows a Location
, Group
or Company
to be provided (via POST body), and the endpoint will return Setting
fields that are inherited up the hierarchy without saving the provided Location
, Group
or Company
changes.
Location
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/{id}/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/{id}/effectivesettings/preview
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/locations/effectivesettings/preview
Group
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/{id}/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/{id}/effectivesettings/preview
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/groups/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/groups/effectivesettings/preview
Company
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/companies/effectivesettings/preview
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/companies/effectivesettings/preview
Sample POST
effective settings preview for Location
Request
POST
a Location
, Group
or Company
to return effective settings.
NOTE: Use the {id}
endpoint for an existing Location
or Group
to have better validation on fields that must be unique such as Location.customId
or Group.locationIds
. This will not load the Location
or Group
settings stored in the database, but will use the settings provided.
Response
A Location
, Group
or Company
with their effective settings
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/1/effectivesettings/preview';
$location = [
'customId' => 'Custom Location ID',
'activation' => true,
'groupId' => 1,
'settings' => [
'name' => 'Location Name',
'description' => 'Location Description',
'address' => [
'streetAddressOne' => '1234 W 5678 S',
'streetAddressTwo' => 'Bldg 2',
'city' => 'Ogden',
'state' => 'UT',
'zip' => '84401',
'zipPlusFour' => '1234',
'country' => 'US',
],
'scheduleText' => 'Schedule Text',
'cardFeeAmount' => 1
],
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
}
public class Settings {
public string name { get; set; }
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
public string username { get; set; }
public Address address { get; set; }
public string hierarchyDisplaySetting { get; set; }
}
public class Location {
public string customId { get; set; }
public bool activation { get; set; }
public Settings settings { get; set; } = new Settings();
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
int myLocationId = 12;
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/"+myLocationId+"/effectivesettings/preview";
Location location = new Location();
location.activation = true;
location.customId = "Alb1";
Settings settings = new Settings();
settings.scheduleText = ""; //settings.scheduleText will get cleared from location, inherited from Group (if assigned) or location
settings.username = "testUser@test.com";
settings.address = new Address(); //settings.Address will get cleared from location, inherited from Group (if assigned) or location
location.settings = settings;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = POSTData(location, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task POSTData(Location location, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var putContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, putContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(responseBody);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"customId" => "Custom Location ID",
"activation" => true,
"groupId" => 1,
"settings" => {
"name" => "Group Name",
"description" => "Group Description",
"address" => {
"streetAddressOne" => "1234 W 5678 S",
"streetAddressTwo" => "Bldg 2",
"city" => "Ogden",
"state" => "UT",
"zip" => "84401",
"zipPlusFour" => "1234",
"country" => "US"
},
"scheduleText" => "Schedule Text",
"cardFeeAmount" => 1
}
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/1/effectivesettings/preview';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"customId": "Custom Location ID",
"activation": true,
"groupId": 1,
"settings": {
"name": "Group Name",
"description": "Group Description",
"address": {
"streetAddressOne": "1234 W 5678 S",
"streetAddressTwo": "Bldg 2",
"city": "Ogden",
"state": "UT",
"zip": "84401",
"zipPlusFour": "1234",
"country": "US"
},
"scheduleText": "Schedule Text",
"cardFeeAmount": 1
}
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/locations/1/effectivesettings/preview'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Effective Settings Account Directives
The Effective Settings account directives endpoint will return cardAccountDirectiveList
and achAccountDirectiveList
fields that are inherited up the hierarchy. For example if a Location
does not have a value set for an accountDirective field, the accountDirectives will be provided from its assigned Group
or Company
. These account directives will only be once in the list, even if multiple locations are assigned the same account directive.
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/locations/effectivesettings/accountdirectives
Live urls:
https://companyadministration.pdc4u.com/api/v1_0/ists/locations/effectivesettings/accountdirectives
Sample POST
Location
effective settings account directives
Request
POST
a list of location ids
Response
An AccountDirectivesList
object with the request location ids and all the card and ach account directives those locations have access to.
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/locations/effectivesettings/accountdirectives';
$locationIdList = [ 1, 5, 6, 10, 33];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($location, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class AccountDirective {
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
}
public class AccountDirectiveList {
public List<long> locationIdList { get; set; }
public List<AccountDirective> cardAccountDirectiveList { get; set; }
public List<AccountDirective> achAccountDirectiveList { get; set; }
public List<AccountDirective> cashAccountDirectiveList { get; set; }
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/locations/effectivesettings/accountdirectives";
AccountDirectiveList accountDirectiveList = new AccountDirectiveList();
accountDirectiveList.locationIdList = new List<long>();
accountDirectiveList.locationIdList.Add(45);
accountDirectiveList.locationIdList.Add(43);
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Task<AccountDirectiveList> task = POSTData(accountDirectiveList, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<AccountDirectiveList> POSTData(AccountDirectiveList searchParameters, string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
AccountDirectiveList accountDirectiveList = null;
var postContent = new StringContent(JsonConvert.SerializeObject(searchParameters), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
accountDirectiveList = JsonConvert.DeserializeObject<AccountDirectiveList>(responseBody);
// Do something with it
Console.WriteLine("Card Account Directives: " + accountDirectiveList.cardAccountDirectiveList.Count);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return accountDirectiveList;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"locationIdList" => [12, 444, 253, 333]
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/locations/effectivesettings/accountdirectives';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"locationIdList":[12, 33, 45, 659]
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v1_0/lists/locations/effectivesettings/accountdirectives';
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
-- Sample Setting Data List requests
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/settings/datalists
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/settings/datalists
Sample POST
SettingDataList
request
Request
POST
to retrieve data for the specified fields from the company and all its Groups
and Locations
.
Response
SettingDataList
object
<?php
$settingDataList = [
'$dataFieldList' => [
'name',
'description',
'achFeeAmount',
'phoneNumber',
'cardFeeAmount',
'emailAddress',
'receiptText',
'scheduleText',
'fromEmailAddress'
]
];
$url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/settings/datalists';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($settingDataList, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Address {
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class SettingDataList {
public List<string> nameList { get; set; }
public List<string> descriptionList { get; set; }
public List<Address> addressList { get; set; }
public List<string> receiptTextList { get; set; }
public List<string> scheduleTextList { get; set; }
public List<string> cardFeeAmountList { get; set; }
public List<string> achFeeAmountList { get; set; }
public List<string> phoneNumberList { get; set; }
public List<string> emailAddressList { get; set; }
public List<string> fromEmailAddressList { get; set; }
}
public class SettingDataListRequest {
public List<string> dataFieldList { get; set; }
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/api/v2_0/settings/datalists";
SettingDataListRequest settingDataListRequest = new SettingDataListRequest();
List<string> fieldList = new List<string>();
fieldList.Add("name");
fieldList.Add("description");
fieldList.Add("address");
fieldList.Add("receiptText");
fieldList.Add("scheduleText");
fieldList.Add("cardFeeAmount");
fieldList.Add("achFeeAmount");
fieldList.Add("phoneNumber");
fieldList.Add("emailAddress");
fieldList.Add("fromEmailAddress");
settingDataListRequest.dataFieldList = fieldList;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = POSTData(settingDataListRequest, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<SettingDataList> POSTData(SettingDataListRequest settingDataListRequest, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
SettingDataList settingDataList = null;
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(locationSearchParameters), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(responseBody);
// Deserialise the data (include the Newtonsoft JSON Nuget package if you don't already have it)
settingDataList = JsonConvert.DeserializeObject<SettingDataList>(responseBody);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
return settingDataList;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"dataFieldList" => [
"name",
"description",
"achFeeAmount",
"phoneNumber",
"cardFeeAmount",
"emailAddress",
"receiptText",
"scheduleText",
"fromEmailAddress"
]
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/settings/datalists';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"dataFieldList": [
"name",
"description",
"achFeeAmount",
"phoneNumber",
"cardFeeAmount",
"emailAddress",
"receiptText",
"scheduleText",
"fromEmailAddress"
]
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/settings/datalists'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
--Sample Verified Domain
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/domains
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/domains
Sample POST
VerifiedDomain
request
Request
POST
to initiate verification on a domain.
Response
VerifiedDomain
object
<?php
$url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/';
$data = [
"domain" => "mywebsite.com"
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if ($statusCode == '200') {
echo $result;
} else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Cname {
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain {
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
public List<Cname> cnameList { get; set; }
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
string url = "https://companyadministrationdemo.pdc4u.com/api/v2_0/domains";
VerifiedDomain verifiedDomain = new VerifiedDomain();
verifiedDomain.domain = "mydomain.com";
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = POSTData(location, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task POSTData(Location location, string url) {
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var putContent = new StringContent(JsonConvert.SerializeObject(location), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, putContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else {
Console.WriteLine(responseBody);
}
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"domain" => "mywebsite.com"
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"domain":"mywebsite.com"
};
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/{domainId}
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/domains/{domainId}
Sample GET
VerifiedDomain
request
Request
GET
to retrieve details about a domain previously submitted for verification.
Response
VerifiedDomain
object
<?php
$desiredDomainId = 1;
$url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/' . $desiredDomainId;
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient {
public class Cname {
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain {
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
public List<Cname> cnameList { get; set; }
}
public class MainClass {
static HttpClient client = new HttpClient();
private static void Main(string[] args) {
int myDomainId = 12;
string url = "https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/" + myDomainId;
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = GETData(url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task<VerifiedDomain> GETData(string url) {
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
VerifiedDomain verifiedDomain = null;
HttpResponseMessage response = await client.GetAsync(new Uri(url));
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK) {
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null) {
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList) {
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
else
{
// Deserialize the data (include the Newtonsoft JSON Nuget package if you don't already have it)
verifiedDomain = JsonConvert.DeserializeObject<VerifiedDomain>(responseBody);
// Do something with it
Console.WriteLine("VerifiedDomain Id: " + verifiedDomain.id);
}
/*
* When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
*/
return verifiedDomain;
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $desiredDomainId = 1;
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/' . $desiredDomainId;
my $req = HTTP::Request->new( 'GET', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
domainId = 1
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/' + domainId
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
Test urls:
https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/search
Live urls:
https://companyadministration.pdc4u.com/api/v2_0/domains/search
Sample POST
VerifiedDomainSearch
request
Request
POST
a VerifiedDomainSearchParameters
object to retrieve details about domains previously submitted for verification that fall within the search parameters
Response
VerifiedDomainList
object
<?php
$data = [
"idList" => [
"2",
"6"
],
"domainList" => [
"test.com",
"mydomain.com"
],
"insertDateStart" => "2024-03-13"
];
$url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/search';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution
$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// View response
print_r(json_decode($result, true));
if($statusCode == '200') {
echo $result;
}
else {
echo "cURL Error #:" . $statusCode;
}
curl_close($curl);
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RestClient
{
public class Cname
{
public string name { get; set; }
public string value { get; set; }
}
public class VerifiedDomain
{
public long id { get; set; }
public string domain { get; set; }
public string verificationStatus { get; set; }
public List<Cname> cnameList { get; set; }
public string insertDate { get; set; }
public string lastUpdateDate { get; set; }
}
public class EmailBranding
{
public string fromEmailAddress { get; set; }
public string footerHtml { get; set; }
public string footerText { get; set; }
public VerifiedDomain domainValidation { get; set; }
}
public class CustomBranding
{
public string logoBase64 { get; set; }
public string brandColor { get; set; }
public EmailBranding emailBranding { get; set; }
}
public class Address
{
public string streetAddressOne { get; set; }
public string streetAddressTwo { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string zipPlusFour { get; set; }
public string country { get; set; }
}
public class Settings
{
public string description { get; set; }
public string receiptText { get; set; }
public string scheduleText { get; set; }
public double cardFeeAmount { get; set; }
public double achFeeAmount { get; set; }
public string username { get; set; }
public Address address { get; set; }
public CustomBranding customBranding { get; set; }
}
public class BillingCard
{
public string cardToken { get; set; }
public int expirationMonth { get; set; }
public int expirationYear { get; set; }
}
public class Billing
{
public bool autoBilling { get; set; }
public string paymentMethod { get; set; }
public string username { get; set; }
public BillingCard billingCard { get; set; }
public Address address { get; set; }
}
public class BillingEmails
{
public List<string> primaryEmails { get; set; } = new List<string>();
public List<string> secondaryEmails { get; set; } = new List<string>();
}
public class Service
{
public long serviceAllowId { get; set; }
public string serviceName { get; set; }
public string status { get; set; }
public string vendor { get; set; }
public List<AccountDirective> accountDirectiveList { get; set; }
public string signatureCompanyLogo { get; set; }
public string signatureCompanyName { get; set; }
public string signatureMiniMiranda { get; set; }
public string signatureFromEmailAddress { get; set; }
public int batchClosingHour { get; set; }
public bool allowCredit { get; set; }
public bool exceptionReportIsEnabled { get; set; }
public string exceptionReportLink { get; set; }
public ServiceVendorSetting vendorSettings { get; set; }
}
public class ServiceVendorSetting
{
public string clientId { get; set; }
public bool isNachaVerifyEnabled { get; set; }
public string originatorName { get; set; }
public string apiUser { get; set; }
public string apiKey { get; set; }
public string locationId { get; set; }
public string batchFileNamePrefix { get; set; }
}
public class AccountDirective
{
public string accountDirective { get; set; }
public string name { get; set; }
public bool isActive { get; set; }
public string entryCode { get; set; }
public string zeroCostFeePercent { get; set; }
public List<string> allowedCardTypeList { get; set; }
public VendorSetting vendorSettings { get; set; }
}
public class VendorSetting
{
public string sourceKey { get; set; }
public string pin { get; set; }
public bool zeroCostAllowBypass { get; set; }
public string apiKey { get; set; }
public string affiliateId { get; set; }
public string cashierId { get; set; }
public bool isZipRequired { get; set; }
public bool isStateRequired { get; set; }
public string apiSecret { get; set; }
public string clientId { get; set; }
public string locationId { get; set; }
public string username { get; set; }
public string password { get; set; }
public string zid { get; set; }
public string dateApiKeyExpiration { get; set; }
public string payrazrUsername { get; set; }
public string payrazrPassword { get; set; }
public string achNowUsername { get; set; }
public string achNowPassword { get; set; }
public string accountSet { get; set; }
}
public class Company
{
public Billing billing { get; set; } = new Billing();
public Settings settings { get; set; } = new Settings();
public BillingEmails billingEmails { get; set; } = new BillingEmails();
public List<Service> serviceList { get; set; }
}
public class MainClass
{
private static HttpClient client = new HttpClient();
private static void Main(string[] args)
{
Console.WriteLine("Starting");
string url = "https://companyadministrationdemo.pdc4u.com/api/v1_0/companies";
Company company = new Company();
Billing billing = new Billing();
billing.autoBilling = true;
billing.paymentMethod = "CARD";
billing.username = "testUser@test.com";
Address address = new Address();
address.streetAddressOne = "First street";
address.city = "Our city";
address.state = "AL";
address.zip = "12345";
address.country = "US";
billing.address = address;
BillingCard billingCard = new BillingCard();
billingCard.cardToken = "thisIsAToken1234";
billingCard.expirationMonth = 12;
billingCard.expirationYear = 2025;
billing.billingCard = billingCard;
company.billing = billing;
EmailBranding emailBranding = new EmailBranding();
emailBranding.fromEmailAddress = "tim@test.com";
emailBranding.footerHtml = "<p>Here is my footer</p>";
emailBranding.footerText = "Here is my footer";
CustomBranding customBranding = new CustomBranding();
customBranding.logoBase64 = "Base64OfAnImage";
customBranding.brandColor = "#FFF000";
customBranding.emailBranding = emailBranding;
Settings settings = new Settings();
settings.description = "Here I describe this company";
settings.receiptText = "Thank you for paying";
settings.scheduleText = "Thank you for scheduling";
settings.cardFeeAmount = 2.25;
settings.achFeeAmount = 3.00;
settings.username = "testUser@test.com";
settings.address = address;
settings.customBranding = customBranding;
company.settings = settings;
BillingEmails billingEmails = new BillingEmails();
billingEmails.primaryEmails.Add("test@test.com");
billingEmails.primaryEmails.Add("test2@test.com");
billingEmails.secondaryEmails.Add("testSecondary@test.com");
company.billingEmails = billingEmails;
//Set the service settings, assuming this company has only one service configured (Payliance CHECK)
Service paylianceService = new Service();
paylianceService.serviceAllowId = 3342;
paylianceService.exceptionReportIsEnabeld = false;
ServiceVendorSetting serviceVendorSetting = new ServiceVendorSetting();
serviceVendorSetting.isNachaVerifyEnabled = true;
serviceVendorSetting.clientId = "123id";
paylianceService.vendorSettings = serviceVendorSetting;
paylianceService.batchClosingHour = 17;
paylianceService.allowCredit = true;
paylianceService.exceptionReportIsEnabled = false;
paylianceService.exceptionReportLink = "NoLink";
company.serviceList = new List<Service>();
company.serviceList.Add(paylianceChanges);
//specify to use TLS 1.2 as default connection
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var task = PUTData(company, url);
task.Wait();
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
static async Task PUTData(Company company, string url)
{
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Add authentication header (base64Encoded username:password)
var byteArray = Encoding.ASCII.GetBytes("companyUsername:companyPassword");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
try
{
Console.WriteLine("Sending Request");
var postContent = new StringContent(JsonConvert.SerializeObject(company), Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PutAsync(url, postContent);
// response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
JArray requestErrorList = (JArray)json["requestErrorList"];
foreach (var item in requestErrorList)
{
Console.WriteLine(item);
string errorCode = (string)item["code"];
string description = (string)item["description"];
bool retriable = (bool)item["retriable"];
Console.WriteLine("Code:" + errorCode + " Description: " + description + " Retriable: " + (retriable ? "TRUE" : "FALSE"));
//What fields does this error apply to and what are the values of those fields
if (item["apiFieldNameList"] != null)
{
JArray apiFieldNameList = (JArray)item["apiFieldNameList"];
foreach (var apiField in apiFieldNameList)
{
string fieldName = (string)apiField["apiFieldName"];
string fieldValue = (string)apiField["apiFieldValue"];
Console.WriteLine("FieldName:" + fieldName + " FieldValue: " + fieldValue);
}
}
}
}
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
}
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting
use File::Slurp;
use MIME::Base64;
eval {
my $data = {
"idList" => [
"2",
"6"
],
"domainList" => [
"test.com",
"mydomain.com"
],
"insertDateStart" => "2024-03-13"
};
$data = JSON::XS->new->utf8->encode ($data);
my $url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/search';
my $req = HTTP::Request->new( 'POST', $url );
$req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
$req->content_type('application/json');
$req->content_length( length($data) );
$req->content( $data );
my $lwp = LWP::UserAgent->new;
$lwp->timeout(30);
my $response = $lwp->request( $req );
if ( $response->is_success ) {
print $response->decoded_content;
}
else {
die $response->status_line . ": " . $response->decoded_content;
}
};
if ( $@ ) {
print "Error: $@\n";
}
#!/usr/bin/ruby
require 'curl'
require 'curb'
require 'json'
require 'base64'
begin
data = {
"idList" : [
"2",
"6"
],
"domainList" : [
"test.com",
"mydomain.com"
],
"insertDateStart" : "2024-03-13"
}
c = Curl::Easy.new
c.url = 'https://companyadministrationdemo.pdc4u.com/api/v2_0/domains/search'
c.http_auth_types = :basic
c.username = 'SomeSecretUsername'
c.password = 'SomeSecretPassword'
c.connect_timeout = 5
c.timeout = 30
c.verbose = true
headers={}
headers['Content-Type'] = 'application/json'
headers['Content-Length'] = data.to_json.length
payload = data.to_json
c.headers = headers
c.http_post(payload)
puts JSON.parse c.body_str
if c.response_code == 200
puts "Success " + c.status
else
puts "Error " + c.status
end
rescue
puts "Caught: #$!\n"
end
REST Fault
RequestErrorList
Attribute | Description | ||||||||||||||||
requestErrorList
ListN/A
|
A list of RequestError objects containing validation errors.
Constraint(s): Only returned when validation errors occur.
|
RequestError
Attribute | Description | ||||||
code
Alpha3
|
The code for the validation error. | ||||||
description
AlphanumericN/A
|
The description of the validation error. | ||||||
retriable
Boolean5
|
Boolean to specify if the same request can be retried. This indicates a temporary failure. | ||||||
apiFieldNameList
ListN/A
|
List of ApiFieldName with the specified RequestError
|
ApiFieldName
Attribute | Description |
apiFieldName
Alphanumeric
|
The name of the Api Field. |
apiFieldValue
Alphanumeric
|
The value of the Api Field. When the Api Field is a list, this will show the specific list value which failed. |